# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
616913 |
2022-08-01T07:39:05 Z |
1ne |
Sails (IOI07_sails) |
C++14 |
|
1000 ms |
7088 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){
vector<pair<long long,long long>>temp;
while(right < arr[i].first){
if (arr[i].second > 0){
temp.push_back({-1,right});
v[right]++;
arr[i].second--;
}
else{
temp.push_back({0,right});
}
++right;
}
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 |
1108 KB |
Output is correct |
2 |
Correct |
1 ms |
1108 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
1084 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 |
14 ms |
1108 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
346 ms |
1436 KB |
Output is correct |
2 |
Correct |
321 ms |
3264 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1088 ms |
1904 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1087 ms |
2532 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1084 ms |
2396 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1066 ms |
7088 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1076 ms |
2772 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1086 ms |
3056 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |