# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
616892 |
2022-08-01T07:29:02 Z |
1ne |
Sails (IOI07_sails) |
C++14 |
|
1000 ms |
6668 KB |
#include<bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
int n;cin>>n;
vector<pair<int,int>>arr(n);
vector<long long>v(100001,0);
for (int i = 0;i<n;++i){
cin>>arr[i].first>>arr[i].second;
}
sort(arr.begin(),arr.end(),[&](auto x,auto y){
return x.first < y.first;
});
long long ans = 0;
priority_queue<pair<long long,long long>>q;
int right = 0;
for (int i = 0;i<n;++i){
while(right < arr[i].first){
q.push({-v[right],right});
++right;
}
vector<pair<long long,long long>>temp;
for (int j = 0;j<arr[i].second;++j){
auto u = q.top();
q.pop();
ans+=-u.first;
v[u.second]++;
temp.push_back({-v[u.second],u.second});
}
for (auto x:temp)q.push(x);
}
cout<<ans<<'\n';
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
980 KB |
Output is correct |
2 |
Correct |
1 ms |
1108 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
1108 KB |
Output is correct |
2 |
Correct |
1 ms |
1108 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
1108 KB |
Output is correct |
2 |
Correct |
1 ms |
1108 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
1108 KB |
Output is correct |
2 |
Correct |
13 ms |
1108 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
347 ms |
1304 KB |
Output is correct |
2 |
Correct |
304 ms |
3388 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1069 ms |
2144 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1082 ms |
1736 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1085 ms |
1848 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1095 ms |
6668 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1076 ms |
2196 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1088 ms |
2644 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |