結果
| 問題 |
No.850 企業コンテスト2位
|
| コンテスト | |
| ユーザー |
chocorusk
|
| 提出日時 | 2019-07-04 15:45:46 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 608 bytes |
| コンパイル時間 | 121 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 27,864 KB |
| 平均クエリ数 | 199.11 |
| 最終ジャッジ日時 | 2024-07-16 17:17:34 |
| 合計ジャッジ時間 | 8,707 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | RE * 1 |
| other | RE * 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()
chocorusk