# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
249700 | srvlt | 학교 설립 (IZhO13_school) | C++14 | 109 ms | 6264 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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 |
---|---|---|---|---|
Fetching results... |