結果
問題 |
No.850 企業コンテスト2位
|
ユーザー |
![]() |
提出日時 | 2019-07-04 15:59:01 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 61 ms / 2,000 ms |
コード長 | 610 bytes |
コンパイル時間 | 148 ms |
コンパイル使用メモリ | 12,800 KB |
実行使用メモリ | 27,736 KB |
平均クエリ数 | 200.11 |
最終ジャッジ日時 | 2024-07-16 17:17:20 |
合計ジャッジ時間 | 3,232 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 27 |
ソースコード
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()