Submission #856415

# Submission time Handle Problem Language Result Execution time Memory
856415 2023-10-03T12:23:10 Z overwatch9 Sails (IOI07_sails) C++17
30 / 100
1000 ms 5356 KB
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
using namespace std;
using ll = long long;
int main() {
    int n;
    cin >> n;
    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;
    vector <ll> sails(1e5 + 1);
    for (int i = 0; i < n; i++) {
        priority_queue <pair <ll, int>> pq;
        for (int j = 1; j <= updates[i].first; j++)
            pq.push({-sails[j], j});
        for (int j = 0; j < updates[i].second; j++) {
            ll x = -pq.top().first;
            int id = pq.top().second;
            pq.pop();
            ans += x;
            sails[id]++;
        }
    }
    cout << ans << '\n';
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1116 KB Output is correct
2 Correct 1 ms 1116 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1116 KB Output is correct
2 Correct 0 ms 1116 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1116 KB Output is correct
2 Correct 0 ms 1116 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 1048 KB Output is correct
2 Correct 11 ms 1368 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 319 ms 1320 KB Output is correct
2 Execution timed out 1024 ms 4812 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1082 ms 1820 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1025 ms 1844 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1088 ms 1872 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1029 ms 5356 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1057 ms 2356 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1010 ms 2912 KB Time limit exceeded
2 Halted 0 ms 0 KB -