mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-11-23 19:48:51 +00:00
parent
bcd385b829
commit
7e9e0be909
45
LibreOJ/2593/2593.cpp
Normal file
45
LibreOJ/2593/2593.cpp
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
#include <iostream>
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
|
using std::cin;
|
||||||
|
using std::cout;
|
||||||
|
const char endl = '\n';
|
||||||
|
|
||||||
|
const int N = 355,
|
||||||
|
M = 125;
|
||||||
|
|
||||||
|
int n, m, a[N], b[5], f[M][M][M][M];
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
std::ios::sync_with_stdio(false);
|
||||||
|
|
||||||
|
cin >> n >> m;
|
||||||
|
for (int i = 1; i <= n; i++) {
|
||||||
|
cin >> a[i];
|
||||||
|
}
|
||||||
|
for (int i = 1, x; i <= m; i++) {
|
||||||
|
cin >> x;
|
||||||
|
b[x]++;
|
||||||
|
}
|
||||||
|
|
||||||
|
f[0][0][0][0] = a[1];
|
||||||
|
for (int i = 0; i <= b[1]; i++) {
|
||||||
|
for (int j = 0; j <= b[2]; j++) {
|
||||||
|
for (int k = 0; k <= b[3]; k++) {
|
||||||
|
for (int l = 0; l <= b[4]; l++) {
|
||||||
|
f[i][j][k][l] = std::max({
|
||||||
|
i ? f[i - 1][j][k][l] : 0,
|
||||||
|
j ? f[i][j - 1][k][l] : 0,
|
||||||
|
k ? f[i][j][k - 1][l] : 0,
|
||||||
|
l ? f[i][j][k][l - 1] : 0,
|
||||||
|
}) +
|
||||||
|
a[1 + i + j * 2 + k * 3 + l * 4];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cout << f[b[1]][b[2]][b[3]][b[4]] << endl;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
BIN
LibreOJ/2593/data/tortoise1.ans
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2593/data/tortoise1.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2593/data/tortoise1.in
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2593/data/tortoise1.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2593/data/tortoise10.ans
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2593/data/tortoise10.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2593/data/tortoise10.in
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2593/data/tortoise10.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2593/data/tortoise2.ans
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2593/data/tortoise2.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2593/data/tortoise2.in
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2593/data/tortoise2.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2593/data/tortoise3.ans
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2593/data/tortoise3.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2593/data/tortoise3.in
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2593/data/tortoise3.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2593/data/tortoise4.ans
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2593/data/tortoise4.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2593/data/tortoise4.in
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2593/data/tortoise4.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2593/data/tortoise5.ans
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2593/data/tortoise5.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2593/data/tortoise5.in
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2593/data/tortoise5.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2593/data/tortoise6.ans
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2593/data/tortoise6.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2593/data/tortoise6.in
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2593/data/tortoise6.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2593/data/tortoise7.ans
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2593/data/tortoise7.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2593/data/tortoise7.in
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2593/data/tortoise7.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2593/data/tortoise8.ans
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2593/data/tortoise8.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2593/data/tortoise8.in
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2593/data/tortoise8.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2593/data/tortoise9.ans
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2593/data/tortoise9.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2593/data/tortoise9.in
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2593/data/tortoise9.in
(Stored with Git LFS)
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user