# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
243505 |
2020-07-01T09:16:27 Z |
abacaba |
Schools (IZhO13_school) |
C++14 |
|
148 ms |
8568 KB |
#include <iostream>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <cstring>
#include <chrono>
#include <vector>
#include <map>
#include <random>
#include <set>
#include <algorithm>
#include <math.h>
#include <cstdio>
#include <stdio.h>
#include <queue>
#include <bitset>
#include <cstdlib>
#include <deque>
#include <cassert>
#include <stack>
using namespace std;
#define mp make_pair
#define f first
#define se second
#define pb push_back
#define ppb pop_back
#define emb emplace_back
#define ll long long
#define ull unsigned long long
#define cntbit(x) __builtin_popcount(x)
#define endl '\n'
#define uset unordered_set
#define umap unordered_map
#define pii pair<int, int>
#define ld long double
#define pll pair<long long, long long>
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template <typename T> inline T range(T l, T r) {
return uniform_int_distribution<T>(l, r)(rng);
}
inline void setin(string s) {
freopen(s.c_str(), "r", stdin);
}
inline void setout(string s) {
freopen(s.c_str(), "w", stdout);
}
template <typename T> void Min(T &a, T b) {
a = min(a, b);
}
template <typename T> void Max(T &a, T b) {
a = max(a, b);
}
#define int long long
const int mod = 998244353;
const int inf = 0x3f3f3f3f;
const int N = 3e5 + 15;
int n, x, y;
pii a[N];
int ans1, ans2;
inline int solve() {
int ans = 0;
sort(a + 1, a + 1 + n, [&](pii a, pii b) {
return mp(a.f - a.se, a.f) > mp(b.f - b.se, b.f);
});
for(int i = 1; i <= x; ++i)
ans += a[i].f;
sort(a + x + 1, a + n + 1, [&](pii a, pii b) {
return a.se > b.se;
});
for(int i = x + 1; i <= x + y; ++i)
ans += a[i].se;
return ans;
}
main() {
ios_base::sync_with_stdio(0); cout.tie(0); cin.tie(0);
// setin("input.txt");
cin >> n >> x >> y;
for(int i = 1; i <= n; ++i)
cin >> a[i].f >> a[i].se;
int ans1 = solve();
for(int i = 1; i <= n; ++i)
swap(a[i].f, a[i].se);
swap(x, y);
int ans2 = solve();
cout << max(ans1, ans2) << endl;
return 0;
}
Compilation message
school.cpp:85:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
main() {
^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
3 |
Correct |
4 ms |
384 KB |
Output is correct |
4 |
Incorrect |
5 ms |
384 KB |
Output isn't correct |
5 |
Incorrect |
5 ms |
384 KB |
Output isn't correct |
6 |
Incorrect |
5 ms |
384 KB |
Output isn't correct |
7 |
Incorrect |
7 ms |
512 KB |
Output isn't correct |
8 |
Correct |
7 ms |
512 KB |
Output is correct |
9 |
Incorrect |
6 ms |
512 KB |
Output isn't correct |
10 |
Incorrect |
7 ms |
512 KB |
Output isn't correct |
11 |
Incorrect |
7 ms |
512 KB |
Output isn't correct |
12 |
Incorrect |
7 ms |
512 KB |
Output isn't correct |
13 |
Incorrect |
20 ms |
1280 KB |
Output isn't correct |
14 |
Incorrect |
44 ms |
2432 KB |
Output isn't correct |
15 |
Incorrect |
93 ms |
4600 KB |
Output isn't correct |
16 |
Correct |
105 ms |
5112 KB |
Output is correct |
17 |
Incorrect |
107 ms |
6268 KB |
Output isn't correct |
18 |
Incorrect |
118 ms |
7032 KB |
Output isn't correct |
19 |
Incorrect |
132 ms |
7420 KB |
Output isn't correct |
20 |
Incorrect |
148 ms |
8568 KB |
Output isn't correct |