0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-12-24 03:31:59 +00:00
Baoshuo Ren 2022-01-23 21:23:13 +08:00
parent 5ef94afc51
commit bbbe6dc6df
Signed by: baoshuo
GPG Key ID: 70F90A673FB1AB68

36
AtCoder/ABC236/D/D.cpp Normal file
View File

@ -0,0 +1,36 @@
#include <iostream>
using std::cin;
using std::cout;
using std::endl;
int n, a[20][20], ans;
bool vis[20];
void dfs(int pos, int val) {
while (vis[pos]) pos++;
if (pos == n + 1) {
ans = std::max(ans, val);
return;
}
for (int i = pos + 1; i <= n; i++) {
if (vis[i]) continue;
vis[i] = true;
dfs(pos + 1, val ^ a[i][pos]);
vis[i] = false;
}
}
int main() {
cin >> n;
n <<= 1;
for (int i = 1; i <= n; i++) {
for (int j = i + 1; j <= n; j++) {
cin >> a[i][j];
a[j][i] = a[i][j];
}
}
dfs(1, 0);
cout << ans << endl;
return 0;
}