# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
870923 | 2023-11-09T13:15:04 Z | anha3k25cvp | Schools (IZhO13_school) | C++14 | 98 ms | 8444 KB |
#include <bits/stdc++.h> #define ll long long #define ull unsigned long long #define dl double #define st first #define nd second #define II pair <int, int> using namespace std; const int N = 5 + 1e5; const int inf = 7 + 1e9; int main() { #define TASKNAME "" ios_base :: sync_with_stdio (0); cin.tie (0); if ( fopen( TASKNAME".inp", "r" ) ) { freopen (TASKNAME".inp", "r", stdin); freopen (TASKNAME".out", "w", stdout); } int n, m, s; cin >> n >> m >> s; int cnt = n - m - s; priority_queue <II> q; ll ans = 0; for (int i = 1; i <= n; i ++) { int x, y; cin >> x >> y; q.push({y - x, x}); ans += (ll)x; } while (s --) { ans += (ll)q.top().st; q.pop(); } priority_queue <int> p; while (!q.empty()) { p.push(-q.top().nd); q.pop(); } while (cnt --) { ans += (ll)p.top(); p.pop(); } cout << ans; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Incorrect | 0 ms | 348 KB | Output isn't correct |
5 | Incorrect | 0 ms | 348 KB | Output isn't correct |
6 | Incorrect | 1 ms | 348 KB | Output isn't correct |
7 | Incorrect | 2 ms | 604 KB | Output isn't correct |
8 | Correct | 2 ms | 608 KB | Output is correct |
9 | Incorrect | 1 ms | 604 KB | Output isn't correct |
10 | Incorrect | 1 ms | 604 KB | Output isn't correct |
11 | Incorrect | 1 ms | 604 KB | Output isn't correct |
12 | Incorrect | 1 ms | 604 KB | Output isn't correct |
13 | Incorrect | 11 ms | 1500 KB | Output isn't correct |
14 | Incorrect | 25 ms | 2264 KB | Output isn't correct |
15 | Incorrect | 56 ms | 5072 KB | Output isn't correct |
16 | Correct | 51 ms | 4312 KB | Output is correct |
17 | Incorrect | 65 ms | 5640 KB | Output isn't correct |
18 | Incorrect | 71 ms | 6596 KB | Output isn't correct |
19 | Incorrect | 76 ms | 7112 KB | Output isn't correct |
20 | Incorrect | 98 ms | 8444 KB | Output isn't correct |