結果
問題 | No.130 XOR Minimax |
ユーザー |
![]() |
提出日時 | 2020-03-12 22:16:48 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 529 ms / 5,000 ms |
コード長 | 546 bytes |
コンパイル時間 | 174 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 61,088 KB |
最終ジャッジ日時 | 2024-09-12 22:57:00 |
合計ジャッジ時間 | 6,097 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 |
ソースコード
#!/usr/bin/env python3.8# %%import sysread = sys.stdin.buffer.readreadline = sys.stdin.buffer.readlinereadlines = sys.stdin.buffer.readlines# %%N, *A = map(int, read().split())# %%def solve(A, n):if len(A) == 1:return 0bit = 1 << nA0 = [x for x in A if not (x & bit)]A1 = [x ^ bit for x in A if x & bit]if not A0:return solve(A1, n - 1)elif not A1:return solve(A0, n - 1)else:return bit + min(solve(A0, n - 1), solve(A1, n - 1))# %%print(solve(set(A), 30))