結果

問題 No.850 企業コンテスト2位
ユーザー nimonnimon
提出日時 2019-08-30 23:27:37
言語 Nim
(2.0.2)
結果
RE  
実行時間 -
コード長 514 bytes
コンパイル時間 4,980 ms
コンパイル使用メモリ 71,124 KB
実行使用メモリ 24,348 KB
平均クエリ数 143.36
最終ジャッジ日時 2023-09-23 18:09:55
合計ジャッジ時間 11,852 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 WA -
testcase_02 AC 23 ms
23,556 KB
testcase_03 AC 22 ms
24,324 KB
testcase_04 RE -
testcase_05 RE -
testcase_06 WA -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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]
0