結果
| 問題 |
No.850 企業コンテスト2位
|
| コンテスト | |
| ユーザー |
nimon
|
| 提出日時 | 2019-08-30 23:27:37 |
| 言語 | Nim (2.2.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 514 bytes |
| コンパイル時間 | 4,020 ms |
| コンパイル使用メモリ | 65,536 KB |
| 実行使用メモリ | 25,604 KB |
| 平均クエリ数 | 143.36 |
| 最終ジャッジ日時 | 2024-07-16 18:03:26 |
| 合計ジャッジ時間 | 9,599 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 1 |
| other | AC * 2 WA * 2 RE * 23 |
ソースコード
from strutils import parseInt
from sequtils import mapIt
let N = stdin.readLine.parseInt
var participants = (1..N).mapIt(it)
proc ask(x, y: int): int =
echo "? ", x, " ", y
stdin.readLine.parseInt
var next = newSeq[int]()
while participants.len > 2:
next = @[]
for i in countup(1, participants.len, 2):
let ans = ask(participants[i - 1], participants[i])
next.add(ans)
participants = next
let ans = ask(participants[0], participants[1])
echo "! ", participants[participants.find(ans) xor 1]
nimon