# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
996660 |
2024-06-11T03:59:34 Z |
ezzzay |
Sails (IOI07_sails) |
C++14 |
|
1000 ms |
3912 KB |
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ff first
#define ss second
#define pb push_back
const int N=2e6+5;
int h[N];
signed main(){
int n;
cin>>n;
vector<pair<int,int>>vc;
for(int i=1;i<=n;i++){
int m,k;
cin>>m>>k;
vc.pb({m,k});
}
sort(vc.begin(),vc.end());
priority_queue<int>q;
int w=0;
for(auto p:vc){
int m= p.ff;
int k= p.ss;
for(int i=0;i<m-w;i++){
q.push(0);
}
vector<int>tmp;
while(k--){
int g= q.top();
q.pop();
tmp.pb(g);
}
for(auto a:tmp){
q.push(a-1);
}
w=m;
}
int k=0;
while(!q.empty()){
int a= -q.top();
k+= (a-1)*a/2;
q.pop();
}
cout<<k;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
4 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
141 ms |
564 KB |
Output is correct |
2 |
Correct |
135 ms |
1484 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1079 ms |
928 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1090 ms |
1284 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1090 ms |
1596 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1054 ms |
3912 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1022 ms |
2508 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1058 ms |
2400 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |