結果
問題 | No.850 企業コンテスト2位 |
ユーザー |
![]() |
提出日時 | 2019-08-30 23:28:58 |
言語 | Nim (2.2.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 580 bytes |
コンパイル時間 | 3,056 ms |
コンパイル使用メモリ | 65,568 KB |
実行使用メモリ | 25,476 KB |
平均クエリ数 | 194.79 |
最終ジャッジ日時 | 2024-07-16 18:03:54 |
合計ジャッジ時間 | 10,864 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 1 |
other | AC * 3 WA * 24 |
ソースコード
from strutils import parseIntfrom sequtils import mapItlet N = stdin.readLine.parseIntvar participants = (1..N).mapIt(it)proc ask(x, y: int): int =echo "? ", x, " ", ystdin.readLine.parseIntvar next = newSeq[int]()while participants.len > 2:next = @[]for i in countup(1, participants.high, 2):let ans = ask(participants[i - 1], participants[i])next.add(ans)if participants.len mod 2 == 1:next.add(participants[^1])participants = nextlet ans = ask(participants[0], participants[1])echo "! ", participants[participants.find(ans) xor 1]