結果

問題 No.699 ペアでチームを作ろう2
ユーザー flippergo
提出日時 2026-07-16 08:03:02
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 154 ms / 1,000 ms
+ 146µs
コード長 509 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 266 ms
コンパイル使用メモリ 95,860 KB
実行使用メモリ 85,456 KB
最終ジャッジ日時 2026-07-16 08:03:06
合計ジャッジ時間 3,319 ms
ジャッジサーバーID
(参考情報)
judge3_1 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 12
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

N = int(input())
A = list(map(int,input().split()))
B = [0]*N
C = []
ans = 0
def dfs(n):
    global ans
    if n==N:
        cnt = 0
        for k in range(len(C)):
            cnt = cnt^C[k]
        ans = max(ans,cnt)
        return
    ind0 = B.index(0)
    for ind1 in range(ind0+1,N):
        if B[ind1]==0:
            C.append(A[ind0]+A[ind1])
            B[ind0] = 1
            B[ind1] = 1
            dfs(n+2)
            B[ind0] = 0
            B[ind1] = 0
            C.pop()
dfs(0)
print(ans)     
0