結果
| 問題 |
No.3237 Find the Treasure!
|
| コンテスト | |
| ユーザー |
sasa8uyauya
|
| 提出日時 | 2025-08-16 02:26:20 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 673 bytes |
| コンパイル時間 | 323 ms |
| コンパイル使用メモリ | 82,184 KB |
| 実行使用メモリ | 130,660 KB |
| 最終ジャッジ日時 | 2025-08-16 02:26:29 |
| 合計ジャッジ時間 | 9,069 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | TLE * 1 |
| other | -- * 22 |
ソースコード
n=int(input())
e=[[] for i in range(n)]
es=[]
for i in range(n):
u,v=map(int,input().split())
u-=1
v-=1
e[u]+=[v]
e[v]+=[u]
es+=[(u,v)]
v=[0]*n
u=[0]*n
q=[0]
v[0]=1
for s in q:
for t in e[s]:
if v[t]==0:
v[t]=1
u[t]=u[s]^1
q+=[t]
q=[a+1 if u[a] else b+1 for a,b in es]
print("?",*q)
a=input()
if a=="Yes":
p=[i for i in range(n) if u[i]==1]
else:
p=[i for i in range(n) if u[i]==0]
while len(p)>1:
pl=p[:len(p)//2]
pr=p[len(p)//2:]
u=[0]*n
for i in pl:
u[i]=1
for i in pr:
u[i]=-1
q=[a+1 if u[a]!=0 else b+1 for a,b in es]
print("?",*q)
a=input()
if a=="Yes":
p=pl
else:
p=pr
a=p[0]+1
print("!",a)
sasa8uyauya