結果

問題 No.282 おもりと天秤(2)
ユーザー nebukuro09
提出日時 2016-10-20 01:41:43
言語 Python2
(2.7.18)
結果
AC  
実行時間 3,866 ms / 5,000 ms
コード長 541 bytes
コンパイル時間 54 ms
コンパイル使用メモリ 6,912 KB
実行使用メモリ 25,616 KB
平均クエリ数 1001.00
最終ジャッジ日時 2024-07-17 00:33:20
合計ジャッジ時間 42,533 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

def ask(L):
    print '? ' + ' '.join(map(str, L))
    sys.stdout.flush()
    return raw_input().split()

N = int(raw_input())
A = range(1, N+1) + [0]*N

for i in xrange(1000):
    if i % 2 == 0:
        ans = ask(A)
        for j in xrange(N/2):
            if ans[j] == '>':
                A[j*2], A[j*2+1] = A[j*2+1], A[j*2]
    else:
        ans = ask(A[1:]+[0])
        for j in xrange(N/2-1+N%2):
            if ans[j] == '>':
                A[j*2+1], A[j*2+2] = A[j*2+2], A[j*2+1]
print '! ' + ' '.join(map(str, A[:N]))
0