結果

問題 No.282 おもりと天秤(2)
ユーザー roiti46roiti46
提出日時 2015-09-19 01:38:19
言語 Python2
(2.7.18)
結果
AC  
実行時間 1,939 ms / 5,000 ms
コード長 727 bytes
コンパイル時間 615 ms
コンパイル使用メモリ 6,616 KB
実行使用メモリ 24,468 KB
平均クエリ数 220.33
最終ジャッジ日時 2023-09-23 21:37:14
合計ジャッジ時間 19,452 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
24,072 KB
testcase_01 AC 41 ms
23,412 KB
testcase_02 AC 38 ms
24,396 KB
testcase_03 AC 38 ms
24,348 KB
testcase_04 AC 38 ms
23,700 KB
testcase_05 AC 40 ms
24,120 KB
testcase_06 AC 43 ms
24,468 KB
testcase_07 AC 36 ms
23,664 KB
testcase_08 AC 43 ms
24,084 KB
testcase_09 AC 36 ms
23,568 KB
testcase_10 AC 509 ms
23,724 KB
testcase_11 AC 1,774 ms
23,676 KB
testcase_12 AC 554 ms
24,060 KB
testcase_13 AC 840 ms
23,652 KB
testcase_14 AC 1,429 ms
24,372 KB
testcase_15 AC 1,778 ms
23,472 KB
testcase_16 AC 102 ms
23,460 KB
testcase_17 AC 751 ms
24,084 KB
testcase_18 AC 1,327 ms
23,676 KB
testcase_19 AC 1,279 ms
24,288 KB
testcase_20 AC 1,923 ms
24,084 KB
testcase_21 AC 1,939 ms
23,724 KB
testcase_22 AC 1,907 ms
23,448 KB
testcase_23 AC 36 ms
24,360 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
N = int(raw_input())

rank = [0] * N
even = N % 2 == 0
pair = [[i + 1, N - i - 1 - even] for i in xrange((N - 1) / 2)]
for i in xrange(N - even):
    qs = [[(p + i) % (N - even) + 1, (q + i) % (N - even) + 1] for p, q in pair] + ([[i + 1, N]] if even else [])
    qs += [[0, 0] for i in xrange(N - len(qs))]
    query = "? " + " ".join([str(p) + " " + str(q) for p, q in qs])

    print query
    sys.stdout.flush()

    rs = raw_input().split()
    for i, r in enumerate(rs):
        p, q = qs[i]
        if r == ">":
            rank[p - 1] += 1
        if r == "<":
            rank[q - 1] += 1

ans = [0] * N
for i, r in enumerate(rank, 1):
    ans[r] = i
print "! " + " ".join(map(str, ans))
sys.stdout.flush()
0