結果
問題 | No.130 XOR Minimax |
ユーザー |
![]() |
提出日時 | 2023-11-28 00:04:06 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 582 ms / 5,000 ms |
コード長 | 394 bytes |
コンパイル時間 | 275 ms |
コンパイル使用メモリ | 82,572 KB |
実行使用メモリ | 164,516 KB |
最終ジャッジ日時 | 2024-09-26 12:42:34 |
合計ジャッジ時間 | 9,081 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 |
ソースコード
def f(A, d):if d < 0:return 0L = [[], []]for i in range(len(A)):L[(A[i] >> d) & 1].append(A[i]^((1 << d)*((A[i] >> d) & 1)))if len(L[0]) == 0:return f(L[1], d-1)if len(L[1]) == 0:return f(L[0], d-1)return (1 << d) + min(f(L[0], d-1), f(L[1], d-1))N = int(input())A = list(set(map(int, input().split())))print(f(A, 65))