結果
問題 |
No.130 XOR Minimax
|
ユーザー |
|
提出日時 | 2024-04-15 09:35:52 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 846 ms / 5,000 ms |
コード長 | 405 bytes |
コンパイル時間 | 253 ms |
コンパイル使用メモリ | 12,416 KB |
実行使用メモリ | 79,668 KB |
最終ジャッジ日時 | 2024-10-05 02:47:43 |
合計ジャッジ時間 | 10,361 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 |
ソースコード
N = int(input()) A = list(map(int, input().split())) def rec(X, digit): if digit == -1: return 0 X0, X1 = [], [] for x in X: if x >> digit & 1: X1.append(x ^ (1 << digit)) else: X0.append(x) if X0 and X1: return (1 << digit) + min(rec(X0, digit - 1), rec(X1, digit - 1)) else: return rec(X, digit - 1) print(rec(A, 30))