当前位置:网站首页>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;
}
边栏推荐
- 什么是代理ip?市面上好用的代理软件有哪些
- Kernel Image File Format
- 强化学习_10_Datawhale稀疏奖励
- Qt中输入框在Win10上“Win+/“快捷键的一个Bug
- 几行代码就可以把系统高崩溃;
- A*Pathfinding插件(3D)
- QEMU guest与host通过网络通信——bridge/hostfwd/guestfwd
- Unity导航与寻路系统的基本使用
- Share a professional TA's "Shader Reference"
- Talking about 3 common shadow rendering techniques in games (2): shadow cone
猜你喜欢
随机推荐
Kernel performance analysis summary
UnityShader入门精要-阴影
npm搭建私服,上传下载包
vscode + ccls环境配置
强化学习_12_Datawhale深度确定性策略梯度
关于研究鼠标绘制平滑曲线的阶段总结
剑指 Offer(第 2 版)7/12 18-20
强化学习_03_表格方法实践(CartPole-v0 And MontoCarlo)
二叉树 6/15 76-80
Screen post-processing: Sobel operator to achieve edge detection
UnityShader入门精要-高级光照基础
Teach you to change the kernel source code--sysfs virtual file system 1
netlink IPC
A*Pathfinding插件(3D)
Qt中输入框在Win10上“Win+/“快捷键的一个Bug
如何实现网格建造系统
二叉树 6/21 91-95
1413. 逐步求和得到正数的最小值
QEMU guest与host通过网络通信——bridge/hostfwd/guestfwd
修改 QtCreator 配置解决 “无法运行 rc.exe” 问题









