結果
| 問題 | No.130 XOR Minimax |
| コンテスト | |
| ユーザー |
6soukiti29
|
| 提出日時 | 2017-09-06 18:16:09 |
| 言語 | Nim (2.2.8) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 574 bytes |
| 記録 | |
| コンパイル時間 | 2,474 ms |
| コンパイル使用メモリ | 69,928 KB |
| 実行使用メモリ | 36,480 KB |
| 最終ジャッジ日時 | 2026-03-19 20:28:57 |
| 合計ジャッジ時間 | 3,643 ms |
|
ジャッジサーバーID (参考情報) |
judge1_1 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 1 |
| other | AC * 19 WA * 2 |
コンパイルメッセージ
/home/judge/data/code/Main.nim(1, 26) Warning: imported and not used: 'algorithm' [UnusedImport]
ソースコード
import sequtils,strutils,algorithm,math
var
N = stdin.readline.parseInt
A2 = stdin.readline.split.map(parseInt)
flag : array[100001, bool]
proc solve(d : int, A : openarray[int]) : int =
if A.len <= 1 or d == 0:
return 0
var
B = newSeqWith(2, newSeq[int](0))
for a in A:
B[((a shr d) and 1)].add(a - (1 shl d))
if B[0].len == 0:
return solve(d - 1, B[1])
elif B[1].len == 0:
return solve(d - 1, B[0])
else:
return (1 shl d) + min(solve(d - 1, B[0]), solve(d - 1, B[1]))
echo solve(29, A2)
6soukiti29