結果
| 問題 |
No.3237 Find the Treasure!
|
| コンテスト | |
| ユーザー |
sasa8uyauya
|
| 提出日時 | 2025-08-16 02:30:09 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 675 bytes |
| コンパイル時間 | 353 ms |
| コンパイル使用メモリ | 82,656 KB |
| 実行使用メモリ | 97,216 KB |
| 平均クエリ数 | 13.65 |
| 最終ジャッジ日時 | 2025-08-16 02:30:20 |
| 合計ジャッジ時間 | 10,966 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 1 |
| other | WA * 22 |
ソースコード
n=int(input())
e=[[] for i in range(n)]
es=[]
for i in range(n-1):
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