mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-12-24 03:31:59 +00:00
parent
47aae6d79a
commit
bfaa878ec3
66
AtCoder/AGC018/C/C.cpp
Normal file
66
AtCoder/AGC018/C/C.cpp
Normal file
@ -0,0 +1,66 @@
|
||||
#include <iostream>
|
||||
#include <algorithm>
|
||||
#include <queue>
|
||||
|
||||
using std::cin;
|
||||
using std::cout;
|
||||
const char endl = '\n';
|
||||
|
||||
const int N = 1e5 + 5;
|
||||
|
||||
int n, x, y, z;
|
||||
long long pre[N], suf[N], sum, ans;
|
||||
|
||||
struct node {
|
||||
int a, b, c, id;
|
||||
} a[N];
|
||||
|
||||
std::priority_queue<int> q1, q2;
|
||||
|
||||
int main() {
|
||||
std::ios::sync_with_stdio(false);
|
||||
cin.tie(nullptr);
|
||||
|
||||
cin >> x >> y >> z;
|
||||
|
||||
n = x + y + z;
|
||||
|
||||
for (int i = 1; i <= n; i++) {
|
||||
cin >> a[i].a >> a[i].b >> a[i].c;
|
||||
|
||||
sum += a[i].c; // 先钦定全选铜币
|
||||
a[i].id = i;
|
||||
}
|
||||
|
||||
std::sort(a + 1, a + 1 + n, [](node a, node b) {
|
||||
return a.a - a.b > b.a - b.b;
|
||||
});
|
||||
|
||||
for (int i = 1; i <= n; i++) {
|
||||
q1.push(a[i].c - a[i].a);
|
||||
pre[i] = pre[i - 1] + a[i].a - a[i].c;
|
||||
|
||||
if (q1.size() > x) {
|
||||
pre[i] += q1.top();
|
||||
q1.pop();
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = n; i; i--) {
|
||||
q2.push(a[i].c - a[i].b);
|
||||
suf[i] = suf[i + 1] + a[i].b - a[i].c;
|
||||
|
||||
if (q2.size() > y) {
|
||||
suf[i] += q2.top();
|
||||
q2.pop();
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = x; i + y <= n; i++) {
|
||||
ans = std::max(ans, sum + pre[i] + suf[i + 1]);
|
||||
}
|
||||
|
||||
cout << ans << endl;
|
||||
|
||||
return 0;
|
||||
}
|
BIN
AtCoder/AGC018/C/data/sample_01.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/AGC018/C/data/sample_01.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/AGC018/C/data/sample_01.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/AGC018/C/data/sample_01.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/AGC018/C/data/sample_02.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/AGC018/C/data/sample_02.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/AGC018/C/data/sample_02.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/AGC018/C/data/sample_02.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/AGC018/C/data/sample_03.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/AGC018/C/data/sample_03.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/AGC018/C/data/sample_03.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/AGC018/C/data/sample_03.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/AGC018/C/data/subtask_1_01.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/AGC018/C/data/subtask_1_01.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/AGC018/C/data/subtask_1_01.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/AGC018/C/data/subtask_1_01.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/AGC018/C/data/subtask_1_02.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/AGC018/C/data/subtask_1_02.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/AGC018/C/data/subtask_1_02.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/AGC018/C/data/subtask_1_02.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/AGC018/C/data/subtask_1_03.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/AGC018/C/data/subtask_1_03.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/AGC018/C/data/subtask_1_03.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/AGC018/C/data/subtask_1_03.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/AGC018/C/data/subtask_1_04.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/AGC018/C/data/subtask_1_04.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/AGC018/C/data/subtask_1_04.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/AGC018/C/data/subtask_1_04.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/AGC018/C/data/subtask_1_05.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/AGC018/C/data/subtask_1_05.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/AGC018/C/data/subtask_1_05.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/AGC018/C/data/subtask_1_05.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/AGC018/C/data/subtask_1_06.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/AGC018/C/data/subtask_1_06.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/AGC018/C/data/subtask_1_06.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/AGC018/C/data/subtask_1_06.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/AGC018/C/data/subtask_1_07.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/AGC018/C/data/subtask_1_07.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/AGC018/C/data/subtask_1_07.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/AGC018/C/data/subtask_1_07.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/AGC018/C/data/subtask_1_08.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/AGC018/C/data/subtask_1_08.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/AGC018/C/data/subtask_1_08.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/AGC018/C/data/subtask_1_08.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/AGC018/C/data/subtask_1_09.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/AGC018/C/data/subtask_1_09.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/AGC018/C/data/subtask_1_09.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/AGC018/C/data/subtask_1_09.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/AGC018/C/data/subtask_1_10.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/AGC018/C/data/subtask_1_10.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/AGC018/C/data/subtask_1_10.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/AGC018/C/data/subtask_1_10.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/AGC018/C/data/subtask_1_11.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/AGC018/C/data/subtask_1_11.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/AGC018/C/data/subtask_1_11.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/AGC018/C/data/subtask_1_11.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/AGC018/C/data/subtask_1_12.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/AGC018/C/data/subtask_1_12.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/AGC018/C/data/subtask_1_12.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/AGC018/C/data/subtask_1_12.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/AGC018/C/data/subtask_1_13.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/AGC018/C/data/subtask_1_13.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/AGC018/C/data/subtask_1_13.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/AGC018/C/data/subtask_1_13.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/AGC018/C/data/subtask_1_14.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/AGC018/C/data/subtask_1_14.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/AGC018/C/data/subtask_1_14.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/AGC018/C/data/subtask_1_14.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/AGC018/C/data/subtask_1_15.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/AGC018/C/data/subtask_1_15.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/AGC018/C/data/subtask_1_15.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/AGC018/C/data/subtask_1_15.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/AGC018/C/data/subtask_1_16.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/AGC018/C/data/subtask_1_16.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/AGC018/C/data/subtask_1_16.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/AGC018/C/data/subtask_1_16.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/AGC018/C/data/subtask_1_17.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/AGC018/C/data/subtask_1_17.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/AGC018/C/data/subtask_1_17.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/AGC018/C/data/subtask_1_17.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/AGC018/C/data/subtask_1_18.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/AGC018/C/data/subtask_1_18.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/AGC018/C/data/subtask_1_18.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/AGC018/C/data/subtask_1_18.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/AGC018/C/data/subtask_1_19.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/AGC018/C/data/subtask_1_19.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/AGC018/C/data/subtask_1_19.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/AGC018/C/data/subtask_1_19.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/AGC018/C/data/subtask_1_20.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/AGC018/C/data/subtask_1_20.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/AGC018/C/data/subtask_1_20.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/AGC018/C/data/subtask_1_20.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/AGC018/C/data/subtask_1_21.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/AGC018/C/data/subtask_1_21.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/AGC018/C/data/subtask_1_21.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/AGC018/C/data/subtask_1_21.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/AGC018/C/data/subtask_1_22.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/AGC018/C/data/subtask_1_22.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/AGC018/C/data/subtask_1_22.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/AGC018/C/data/subtask_1_22.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/AGC018/C/data/subtask_1_23.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/AGC018/C/data/subtask_1_23.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/AGC018/C/data/subtask_1_23.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/AGC018/C/data/subtask_1_23.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/AGC018/C/data/subtask_1_24.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/AGC018/C/data/subtask_1_24.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/AGC018/C/data/subtask_1_24.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/AGC018/C/data/subtask_1_24.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/AGC018/C/data/subtask_1_25.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/AGC018/C/data/subtask_1_25.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/AGC018/C/data/subtask_1_25.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/AGC018/C/data/subtask_1_25.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/AGC018/C/data/subtask_1_26.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/AGC018/C/data/subtask_1_26.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/AGC018/C/data/subtask_1_26.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/AGC018/C/data/subtask_1_26.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/AGC018/C/data/subtask_1_27.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/AGC018/C/data/subtask_1_27.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/AGC018/C/data/subtask_1_27.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/AGC018/C/data/subtask_1_27.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/AGC018/C/data/subtask_1_28.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/AGC018/C/data/subtask_1_28.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/AGC018/C/data/subtask_1_28.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/AGC018/C/data/subtask_1_28.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/AGC018/C/data/subtask_1_29.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/AGC018/C/data/subtask_1_29.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/AGC018/C/data/subtask_1_29.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/AGC018/C/data/subtask_1_29.out
(Stored with Git LFS)
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user