結果
| 問題 |
No.282 おもりと天秤(2)
|
| コンテスト | |
| ユーザー |
yaoshimax
|
| 提出日時 | 2016-05-14 02:27:50 |
| 言語 | PyPy2 (7.3.15) |
| 結果 |
TLE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 2,624 bytes |
| コンパイル時間 | 750 ms |
| コンパイル使用メモリ | 77,216 KB |
| 実行使用メモリ | 99,808 KB |
| 平均クエリ数 | 62.58 |
| 最終ジャッジ日時 | 2024-07-16 23:42:32 |
| 合計ジャッジ時間 | 11,060 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 11 TLE * 1 -- * 12 |
ソースコード
import sys
N=int(raw_input())
ans=[]
ans2=[]
used=[False for i in range(N+1)]
used[0]=True
while True:
cand = [i for i in range(N+1) if used[i]==False]
if len(cand)==0:
break
elif len(cand)==1:
ans.append(cand[0])
used[cand[0]]=True
elif len(cand)%2==1:
while len(cand)>=2:
print '?',
for c in cand:
print c,
for d in range(N*2-len(cand)):
print 0,
print
sys.stdout.flush()
ncand=[]
res=raw_input().split()
for i in range(0,len(cand),2):
if i==len(cand)-1:
ncand.append(cand[i])
elif res[i/2]=='>':
ncand.append(cand[i+1])
elif res[i/2]=='<':
ncand.append(cand[i])
cand=ncand
ans.append(cand[0])
used[cand[0]]=True
else:
left=[]
right=[]
print '?',
for c in cand:
print c,
for d in range(N*2-len(cand)):
print 0,
print
sys.stdout.flush()
ncand=[]
res=raw_input().split()
for i in range(0,len(cand),2):
if res[i/2]=='>':
left.append(cand[i+1])
right.append(cand[i])
if res[i/2]=='<':
left.append(cand[i])
right.append(cand[i+1])
while len(left)>=2:
nleft=[]
nright=[]
if len(left)%2==1:
nleft.append(left[0])
nright.append(right[0])
left.pop(0)
right.pop(0)
print '?',
for l in left:
print l,
for r in right:
print r,
for d in range(N*2-len(left)-len(right)):
print 0,
print
sys.stdout.flush()
res=raw_input().split()
for i in range(len(left)/2):
if res[i]=='>':
nleft.append(left[2*i+1])
else:
nleft.append(left[2*i])
for i in range(len(right)/2):
if res[len(left)/2+i]=='>':
nright.append(right[2*i])
else:
nright.append(right[2*i+1])
left=nleft
right=nright
ans.append(left[0])
ans2.append(right[0])
used[left[0]]=True
used[right[0]]=True
ans2.reverse()
ans+=ans2
print '!',
for a in ans:
print a,
print
sys.stdout.flush()
yaoshimax