Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- const int N = 17;
- int n, ans = 0;
- int A[N][N], used[N];
- void rec(int couples, int xr) {
- if (couples == n) {
- ans = max(ans, xr);
- return;
- }
- int i = 1;
- while (used[i]) i++;
- for (int j = i + 1; j <= 2 * n; j++) {
- if (used[j] == 0) {
- used[i] = used[j] = 1;
- rec(couples + 1, xr ^ A[i][j]);
- used[i] = used[j] = 0;
- }
- }
- }
- int main(){
- cin >> n;
- for (int i = 1; i <= 2 * n; i++) {
- for (int j = i + 1; j <= 2 * n; j++) {
- cin >> A[i][j];
- }
- }
- rec(0, 0);
- cout << ans << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement