当前位置:网站首页>2022河南萌新联赛第(五)场:信息工程大学 H - 小明喝奶茶
2022河南萌新联赛第(五)场:信息工程大学 H - 小明喝奶茶
2022-08-10 05:46:00 【WA_自动机】
H - 小明喝奶茶
正解是用一个权值线段树什么的维护一下,取一下第K小值,但是我不会。只能打打暴力,发现数据比较水,也能过,就当练练模拟了。
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> PII;
const int N = 100010;
vector<PII> d[N];
signed main()
{
int n,m,k;cin>>n>>m>>k;
for(int i=1;i<=m;i++)
{
int l,r,c,p;cin>>l>>r>>c>>p;
for(int j=l;j<=r;j++)
d[j].push_back({
p,c});
}
for(int i=1;i<=n;i++)
sort(d[i].begin(),d[i].end());
int res=0;
for(int i=1;i<=n;i++)
{
int p=k;
for(auto &[a,b]:d[i])
if(p>=b) res+=a*b,p-=b;
else
{
res+=a*p;
break;
}
}
cout<<res;
return 0;
}
边栏推荐
猜你喜欢
随机推荐
强化学习_11_Datawhale模仿学习
Unity的GetComponentsInChildren1、2、3
Talking about the realization idea of "frame" of "frame synchronization online game"
全网可达,实现备份
R language cluster analysis - code analysis
CAP介绍
手把手教你改内核源码--sysfs虚拟文件系统1
剑指 Offer(第 2 版)7/6 9-13
Unity screen coordinates to world coordinates, mouse click to get 3D position
Unity资源热更新--资源管理、Addressable
OSPF的dr和bdr
驱动的参数传入:module_param,module_param_array,module_param_cb
Qt信号槽与事件循环的关系
Log4j2基本使用
UnityShader入门精要-unity shader基础
Myunity框架笔记
qemu和主机共享磁盘
tqdm高级使用方法(类keras进度条)
UnityShader入门精要-阴影
Two-dimensional cartoon rendering - coloring








