// yukicoder: No.699 ペアでチームを作ろう2 // 2019.7.20 bal4u #include #if 1 #define gc() getchar_unlocked() #else #define gc() getchar() #endif int in() { // 非負整数の入力 int n = 0, c = gc(); do n = 10 * n + (c & 0xf); while ((c = gc()) >= '0'); return n; } int a[16], N; int ans; void rec(int i, int b, int v) { int j; while ((b >> i) & 1) i++; if (i == N) { if (v > ans) ans = v; return; } for (j = i+1; j < N; j++) if (!((b >> j) & 1)) { rec(i+1, b | (1<