結果
問題 | No.698 ペアでチームを作ろう |
ユーザー | 👑 Kazun |
提出日時 | 2021-03-09 04:39:14 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 62 ms / 1,000 ms |
コード長 | 361 bytes |
コンパイル時間 | 317 ms |
コンパイル使用メモリ | 82,304 KB |
実行使用メモリ | 64,640 KB |
最終ジャッジ日時 | 2024-04-19 01:27:13 |
合計ジャッジ時間 | 1,894 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 40 ms
52,224 KB |
testcase_01 | AC | 40 ms
51,712 KB |
testcase_02 | AC | 40 ms
51,968 KB |
testcase_03 | AC | 40 ms
52,352 KB |
testcase_04 | AC | 47 ms
59,392 KB |
testcase_05 | AC | 57 ms
62,592 KB |
testcase_06 | AC | 60 ms
64,512 KB |
testcase_07 | AC | 60 ms
64,128 KB |
testcase_08 | AC | 62 ms
64,640 KB |
testcase_09 | AC | 60 ms
64,128 KB |
testcase_10 | AC | 60 ms
64,512 KB |
testcase_11 | AC | 59 ms
64,512 KB |
testcase_12 | AC | 61 ms
64,384 KB |
testcase_13 | AC | 59 ms
64,384 KB |
testcase_14 | AC | 60 ms
64,000 KB |
ソースコード
def f(S=0): if Memo[S]!=-1: return Memo[S] for i in range(N): if S&(1<<i)==0: break X=0 for j in range(i+1,N): if S&(1<<j): continue X=max(X,(A[i]^A[j])+f(S|(1<<i)|(1<<j))) Memo[S]=X return X N=int(input()) A=list(map(int,input().split())) Memo=[-1]*(1<<N) Memo[-1]=0 print(f())