# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
616899 |
2022-08-01T07:33:49 Z |
1ne |
Sails (IOI07_sails) |
C++14 |
|
1000 ms |
6608 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;
});
vector<pair<long long,long long>>q;
long long ans = 0;
int right = 0;
for (int i = 0;i<n;++i){
while(right < arr[i].first){
q.push_back({v[right],right});
++right;
}
vector<pair<long long,long long>>temp;
sort(q.rbegin(),q.rend());
for (int j = 0;j<arr[i].second;++j){
auto u = q.back();
q.pop_back();
ans+=u.first;
v[u.second]++;
temp.push_back({v[u.second],u.second});
}
for (auto x:temp)q.push_back(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 |
980 KB |
Output is correct |
# |
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 |
980 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 |
7 ms |
1108 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
222 ms |
1304 KB |
Output is correct |
2 |
Execution timed out |
1090 ms |
3328 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1081 ms |
1800 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1083 ms |
1752 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1091 ms |
1956 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1086 ms |
6608 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1092 ms |
2228 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1082 ms |
2636 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |