# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
249701 |
2020-07-15T14:55:52 Z |
srvlt |
Schools (IZhO13_school) |
C++14 |
|
117 ms |
2680 KB |
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ll long long
#define ld long double
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define SZ(x) (int)(x).size()
template <typename T> using ord_set = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int n0 = 3e5 + 123;
int n, m, s;
struct Pair {
int x, y;
bool operator < (const Pair & p) const {
if (x - y == p.x - p.y) return x > p.x;
return x - y > p.x - p.y;
}
};
Pair p[n0];
bool cmp(const Pair & a, const Pair & b) {
return a.y > b.y;
}
int main() {
ios_base::sync_with_stdio(false), cin.tie(NULL);
#ifdef LOCAL
freopen("input.txt", "r", stdin);
#endif
cin >> n >> m >> s;
for (int i = 0; i < n; i++) cin >> p[i].x >> p[i].y;
sort(p, p + n);
ll res = 0;
for (int i = 0; i < m; i++) res += p[i].x;
sort(p + m, p + n, cmp);
for (int i = m; i < m + s; i++) res += p[i].y;
cout << res;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
384 KB |
Output is correct |
2 |
Correct |
0 ms |
384 KB |
Output is correct |
3 |
Correct |
0 ms |
384 KB |
Output is correct |
4 |
Incorrect |
0 ms |
384 KB |
Output isn't correct |
5 |
Incorrect |
0 ms |
384 KB |
Output isn't correct |
6 |
Incorrect |
0 ms |
384 KB |
Output isn't correct |
7 |
Incorrect |
2 ms |
384 KB |
Output isn't correct |
8 |
Correct |
1 ms |
384 KB |
Output is correct |
9 |
Incorrect |
1 ms |
384 KB |
Output isn't correct |
10 |
Incorrect |
1 ms |
384 KB |
Output isn't correct |
11 |
Incorrect |
2 ms |
384 KB |
Output isn't correct |
12 |
Incorrect |
2 ms |
384 KB |
Output isn't correct |
13 |
Incorrect |
11 ms |
640 KB |
Output isn't correct |
14 |
Incorrect |
30 ms |
896 KB |
Output isn't correct |
15 |
Incorrect |
71 ms |
1632 KB |
Output isn't correct |
16 |
Correct |
73 ms |
1784 KB |
Output is correct |
17 |
Incorrect |
87 ms |
2076 KB |
Output isn't correct |
18 |
Incorrect |
95 ms |
2168 KB |
Output isn't correct |
19 |
Incorrect |
100 ms |
2424 KB |
Output isn't correct |
20 |
Incorrect |
117 ms |
2680 KB |
Output isn't correct |