Submission #249700

# Submission time Handle Problem Language Result Execution time Memory
249700 2020-07-15T14:55:00 Z srvlt Schools (IZhO13_school) C++14
25 / 100
109 ms 6264 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 {
		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 1 ms 384 KB Output is correct
4 Incorrect 0 ms 384 KB Output isn't correct
5 Incorrect 1 ms 384 KB Output isn't correct
6 Incorrect 1 ms 384 KB Output isn't correct
7 Incorrect 2 ms 384 KB Output isn't correct
8 Correct 2 ms 384 KB Output is correct
9 Incorrect 2 ms 512 KB Output isn't correct
10 Incorrect 2 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 1024 KB Output isn't correct
14 Incorrect 39 ms 1784 KB Output isn't correct
15 Incorrect 63 ms 3320 KB Output isn't correct
16 Correct 70 ms 3704 KB Output is correct
17 Incorrect 80 ms 4600 KB Output isn't correct
18 Incorrect 85 ms 5112 KB Output isn't correct
19 Incorrect 90 ms 5368 KB Output isn't correct
20 Incorrect 109 ms 6264 KB Output isn't correct