結果

問題 No.850 企業コンテスト2位
ユーザー chocoruskchocorusk
提出日時 2019-07-04 15:59:01
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 54 ms / 2,000 ms
コード長 610 bytes
コンパイル時間 72 ms
コンパイル使用メモリ 10,752 KB
実行使用メモリ 24,360 KB
平均クエリ数 200.11
最終ジャッジ日時 2023-09-23 17:23:40
合計ジャッジ時間 3,235 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
24,312 KB
testcase_01 AC 37 ms
23,684 KB
testcase_02 AC 37 ms
24,360 KB
testcase_03 AC 38 ms
23,540 KB
testcase_04 AC 38 ms
23,988 KB
testcase_05 AC 38 ms
23,376 KB
testcase_06 AC 38 ms
23,684 KB
testcase_07 AC 42 ms
23,616 KB
testcase_08 AC 44 ms
23,492 KB
testcase_09 AC 44 ms
24,336 KB
testcase_10 AC 48 ms
23,344 KB
testcase_11 AC 49 ms
23,632 KB
testcase_12 AC 50 ms
23,592 KB
testcase_13 AC 52 ms
23,472 KB
testcase_14 AC 52 ms
23,556 KB
testcase_15 AC 50 ms
23,940 KB
testcase_16 AC 50 ms
23,440 KB
testcase_17 AC 51 ms
24,348 KB
testcase_18 AC 49 ms
23,620 KB
testcase_19 AC 52 ms
24,000 KB
testcase_20 AC 54 ms
24,012 KB
testcase_21 AC 51 ms
23,676 KB
testcase_22 AC 50 ms
23,432 KB
testcase_23 AC 51 ms
23,376 KB
testcase_24 AC 51 ms
23,952 KB
testcase_25 AC 52 ms
23,940 KB
testcase_26 AC 51 ms
23,784 KB
testcase_27 AC 38 ms
23,808 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
n=int(input())
lose=[[] for i in range(n)]
v=[i for i in range(n)]
while len(v)>1:
  w=[]
  for i in range(0, len(v), 2):
    if i+1==len(v):
      w.append(v[i])
    else:
      print("? %d %d" % (v[i]+1, v[i+1]+1))
      sys.stdout.flush()
      res=int(input())
      res-=1
      w.append(res)
      if res==v[i]:
        lose[res].append(v[i+1])
      else:
        lose[res].append(v[i])
  v=w
a=v[0]
ans=lose[a][0]
for i in range(1, len(lose[a])):
  print("? %d %d" % (lose[a][i]+1, ans+1))
  sys.stdout.flush()
  res=int(input())
  res-=1
  ans=res
print("! %d" % (ans+1))
sys.stdout.flush()
0