# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
856405 |
2023-10-03T12:00:19 Z |
overwatch9 |
Sails (IOI07_sails) |
C++17 |
|
1000 ms |
7004 KB |
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
using namespace std;
using ll = long long;
int main() {
int n;
cin >> n;
priority_queue <pair <ll, int>> pq;
for (int i = 1; i <= 1e5; i++)
pq.push({0, i});
vector <pair <int, int>> updates(n);
for (int i = 0; i < n; i++)
cin >> updates[i].first >> updates[i].second;
sort(updates.begin(), updates.end());
ll ans = 0;
for (int i = 0; i < n; i++) {
priority_queue <pair <ll, int>> tp;
int done = 0;
while (done < updates[i].second) {
pair <ll, int> x = pq.top();
pq.pop();
if (x.second <= updates[i].first) {
ans += (-x.first);
tp.push({x.first-1, x.second});
done++;
} else {
tp.push(x);
}
}
while (!tp.empty()) {
pq.push(tp.top());
tp.pop();
}
}
cout << ans << '\n';
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
80 ms |
5864 KB |
Output is correct |
2 |
Correct |
122 ms |
5612 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
122 ms |
5568 KB |
Output is correct |
2 |
Correct |
121 ms |
5616 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
230 ms |
5616 KB |
Output is correct |
2 |
Correct |
107 ms |
5596 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1061 ms |
5952 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1012 ms |
5808 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1052 ms |
5712 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1030 ms |
5948 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1031 ms |
6112 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1066 ms |
6164 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1056 ms |
6592 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1047 ms |
7004 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |