# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
367346 |
2021-02-16T23:05:08 Z |
ijxjdjd |
Sails (IOI07_sails) |
C++14 |
|
1000 ms |
3048 KB |
#include <bits/stdc++.h>
#define FR(i, N) for (int i = 0; i < int(N); i++)
#define all(x) begin(x), end(x)
using namespace std;
using ll = long long;
int main() {
cin.tie(0);
cin.sync_with_stdio(0);
int N;
cin >> N;
vector<pair<int, int>> masts;
priority_queue<int, vector<int>, greater<int>> pq;
FR(i, N) {
int h, k;
cin >> h >> k;
masts.push_back({h, k});
}
sort(all(masts));
// int costs[100000];
int last = 0;
ll ans = 0;
vector<int> remd;
FR(i, N) {
remd.clear();
while (last<masts[i].first) {
pq.push(0);
last++;
}
while (masts[i].second-->0) {
int next = pq.top();
pq.pop();
ans += next;
next++;
remd.push_back(next);
}
for (auto& a : remd) {
pq.push(a);
}
}
cout << ans << '\n';
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
8 ms |
364 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
205 ms |
364 KB |
Output is correct |
2 |
Correct |
188 ms |
1036 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1082 ms |
768 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1081 ms |
1008 KB |
Time limit exceeded |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1048 ms |
1520 KB |
Time limit exceeded |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1094 ms |
3048 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1090 ms |
2540 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1077 ms |
2500 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |