結果
問題 |
No.699 ペアでチームを作ろう2
|
ユーザー |
|
提出日時 | 2019-01-26 16:53:32 |
言語 | Nim (2.2.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 663 bytes |
コンパイル時間 | 2,210 ms |
コンパイル使用メモリ | 61,164 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-01 10:58:27 |
合計ジャッジ時間 | 3,011 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 WA * 1 |
other | AC * 3 WA * 9 |
コンパイルメッセージ
/home/judge/data/code/Main.nim(1, 17) Warning: imported and not used: 'algorithm' [UnusedImport]
ソースコード
import sequtils,algorithm template `max=`*(x,y) = x = max(x,y) template `min=`*(x,y) = x = min(x,y) proc getchar_unlocked():char {. importc:"getchar_unlocked",header: "<stdio.h>" .} proc scan(): int = while true: let k = getchar_unlocked() if k < '0': break result = 10 * result + k.ord - '0'.ord let n = scan() let A = newSeqWith(n,scan()) proc solve(s:int) : int = for i in 0..<n: if ((1 shl i) and s) > 0 : continue for j in (i+1)..<n: if ((1 shl j) and s) > 0 : continue result .max= (A[i] + A[j]) xor solve(s or (1 shl i) or (1 shl j)) # 最高のペアが分かったのでbreakしてよい break echo solve(0)