結果

問題 No.282 おもりと天秤(2)
ユーザー nebukuro09nebukuro09
提出日時 2016-10-20 01:41:43
言語 Python2
(2.7.18)
結果
AC  
実行時間 3,529 ms / 5,000 ms
コード長 541 bytes
コンパイル時間 52 ms
コンパイル使用メモリ 6,704 KB
実行使用メモリ 24,336 KB
平均クエリ数 1001.00
最終ジャッジ日時 2023-09-24 00:39:23
合計ジャッジ時間 38,764 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
23,340 KB
testcase_01 AC 353 ms
23,784 KB
testcase_02 AC 236 ms
23,592 KB
testcase_03 AC 196 ms
23,364 KB
testcase_04 AC 170 ms
23,328 KB
testcase_05 AC 292 ms
23,388 KB
testcase_06 AC 375 ms
23,364 KB
testcase_07 AC 171 ms
24,216 KB
testcase_08 AC 376 ms
23,628 KB
testcase_09 AC 74 ms
24,000 KB
testcase_10 AC 1,744 ms
23,784 KB
testcase_11 AC 3,155 ms
23,496 KB
testcase_12 AC 1,863 ms
23,988 KB
testcase_13 AC 2,273 ms
24,336 KB
testcase_14 AC 2,997 ms
24,168 KB
testcase_15 AC 3,214 ms
23,340 KB
testcase_16 AC 854 ms
23,376 KB
testcase_17 AC 2,215 ms
23,364 KB
testcase_18 AC 2,877 ms
24,300 KB
testcase_19 AC 2,849 ms
23,496 KB
testcase_20 AC 3,529 ms
23,784 KB
testcase_21 AC 3,279 ms
23,580 KB
testcase_22 AC 3,323 ms
23,496 KB
testcase_23 AC 67 ms
23,796 KB
権限があれば一括ダウンロードができます

ソースコード

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