| Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|---|
| 435490 | 俞杰 | 26年3月-B组(才俊)B. 排雷 | C++ | 通过 | 100 | 87 MS | 516 KB | 434 | 2026-04-06 14:54:48 |
#include<bits/stdc++.h> using namespace std; int n; struct s{ int c; int t; }a[150002]; bool cmp(s x,s y){ return x.t<y.t; } int main(){ cin>>n; for(int i=1;i<=n;i++){ cin>>a[i].c>>a[i].t; } sort(a,a+n,cmp); priority_queue<int> pq; long long now=0; for(int i=1;i<=n;i++){ now+=a[i].c; pq.push(a[i].c); if(now>a[i].t){ now-=pq.top(); pq.pop(); } } cout<<pq.size(); return 0; }