0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-12-26 06:51:59 +00:00

P2392 kkksc03考前临时抱佛脚

R43069180
This commit is contained in:
Baoshuo Ren 2020-12-03 08:06:25 +08:00 committed by Baoshuo Ren
parent 4f96b7d8eb
commit 8366ed437a
Signed by: baoshuo
GPG Key ID: 70F90A673FB1AB68

33
problem/P2392/P2392.cpp Normal file
View File

@ -0,0 +1,33 @@
#include <bits/stdc++.h>
using namespace std;
int l, r, ans, m, s[5], a[25][5];
void dfs(int x, int y) {
if (x > s[y]) {
m = min(m, max(l, r));
return;
}
l += a[x][y];
dfs(x + 1, y);
l -= a[x][y];
r += a[x][y];
dfs(x + 1, y);
r -= a[x][y];
}
int main() {
cin >> s[1] >> s[2] >> s[3] >> s[4];
for (int i = 1; i <= 4; i++) {
l = r = 0;
m = 0x3f3f3f3f;
for (int j = 1; j <= s[i]; j++) {
cin >> a[j][i];
}
dfs(1, i);
ans += m;
}
cout << ans << endl;
return 0;
}