0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-11-09 16:38:47 +00:00

#1614. 【2022.10.9 联考】卷积之王(ztl)

https://sjzezoj.com/submission/59855
This commit is contained in:
Baoshuo Ren 2022-10-09 20:08:07 +08:00
parent 17c13ed975
commit 666a989ee6
Signed by: baoshuo
GPG Key ID: 00CB9680AB29F51A
26 changed files with 125 additions and 0 deletions

50
S2OJ/1614/1614.cpp Normal file
View File

@ -0,0 +1,50 @@
#include <iostream>
using std::cin;
using std::cout;
const char endl = '\n';
const int K = 17;
int k, a[1 << K], b[1 << K], c[1 << K], f[K + 1][1 << K];
void dfs(int s, int d, int x) {
int t = ((1 << k) - 1) ^ s;
for (int i = t;; i = (i - 1) & t) {
if (d) f[d][i] = std::max(f[d - 1][i], f[d - 1][i | (1 << x)]);
c[s | i] = std::max(c[s | i], f[d][i] + a[s]);
if (!i) break;
}
for (int i = x + 1; i < k; i++) {
dfs(s | (1 << i), d + 1, i);
}
}
int main() {
std::ios::sync_with_stdio(false);
cin.tie(nullptr);
cin >> k;
for (int i = 0; i < 1 << k; i++) {
cin >> a[i];
}
for (int i = 0; i < 1 << k; i++) {
cin >> b[i];
f[0][i] = b[i];
}
dfs(0, 0, -1);
for (int i = 0; i < 1 << k; i++) {
cout << c[i] << ' ';
}
cout << endl;
return 0;
}

BIN
S2OJ/1614/data/ex_ztl1.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1614/data/ex_ztl1.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1614/data/ex_ztl2.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1614/data/ex_ztl2.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1614/data/problem.conf (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1614/data/ztl1.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1614/data/ztl1.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1614/data/ztl10.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1614/data/ztl10.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1614/data/ztl2.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1614/data/ztl2.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1614/data/ztl3.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1614/data/ztl3.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1614/data/ztl4.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1614/data/ztl4.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1614/data/ztl5.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1614/data/ztl5.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1614/data/ztl6.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1614/data/ztl6.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1614/data/ztl7.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1614/data/ztl7.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1614/data/ztl8.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1614/data/ztl8.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1614/data/ztl9.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1614/data/ztl9.out (Stored with Git LFS) Normal file

Binary file not shown.