# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
970251 |
2024-04-26T09:32:33 Z |
NoMercy |
Sails (IOI07_sails) |
C++14 |
|
1000 ms |
8996 KB |
#include <bits/stdc++.h>
using namespace std;
int TIME = clock();
#define file \
freopen("in.txt" , "r" , stdin); \
freopen("out.txt" , "w" , stdout);
typedef long long ll;
void test_case () {
int n , mx = 0;
cin >> n;
vector<array<int , 2>> a(n);
for (int i = 0;i < n;i ++) {
cin >> a[i][0] >> a[i][1];
mx = max(mx , a[i][0]);
}
set<pair<int , int>> s;
for (int i = 0;i < mx;i ++) {
s.insert({0 , i});
}
ll res = 0;
for (int i = n - 1;i >= 0;i --) {
vector<pair<int , int>> _s;
while (a[i][1] --) {
assert((int)s.size() > 0);
auto it = *s.begin();
s.erase(s.begin());
if (it.second >= a[i][0]) {
a[i][1] ++;
_s.push_back(it);
continue;
}
res += it.first;
_s.push_back({it.first + 1 , it.second});
}
for (int j = 0;j < (int)_s.size();j ++) {
s.insert(_s[j]);
}
}
cout << res << "\n";
}
int32_t main () {
//// file
int t = 1;
// cin >> t;
while (t --) {
test_case();
}
cerr << "\nTime elapsed: " << (clock() - TIME) * 1000.0 / CLOCKS_PER_SEC << " ms\n";
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
581 ms |
704 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1035 ms |
2752 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1050 ms |
2900 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1069 ms |
4728 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1016 ms |
8260 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1057 ms |
8668 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1032 ms |
8996 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |