제출 #249700

#제출 시각아이디문제언어결과실행 시간메모리
249700srvlt학교 설립 (IZhO13_school)C++14
25 / 100
109 ms6264 KiB
#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 timeMemoryGrader output
Fetching results...