제출 #1124940

#제출 시각아이디문제언어결과실행 시간메모리
1124940seiryuu학교 설립 (IZhO13_school)C++20
25 / 100
85 ms3912 KiB
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n, m, s; cin >> n >> m >> s; vector<pair<int, int>> c(n); for (int i = 0; i < n; i++) cin >> c[i].first >> c[i].second; vector<int> idx(n); iota(idx.begin(), idx.end(), 0); sort(idx.begin(), idx.end(), [&](int a, int b) { return max(c[a].first, c[a].second) > max(c[b].first, c[b].second); }); idx.resize(m + s); sort(idx.begin(), idx.end(), [&](int a, int b) { return (c[a].first - c[a].second) > (c[b].first - c[b].second); }); long long ans = 0; for (int i = 0; i < m; i++) ans += c[idx[i]].first; for (int i = m; i < m + s; i++) ans += c[idx[i]].second; cout << ans << "\n"; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...