結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
23,988 KB
testcase_01 AC 41 ms
23,988 KB
testcase_02 AC 36 ms
23,388 KB
testcase_03 AC 38 ms
24,312 KB
testcase_04 AC 36 ms
24,036 KB
testcase_05 AC 39 ms
23,988 KB
testcase_06 AC 41 ms
24,240 KB
testcase_07 AC 36 ms
23,604 KB
testcase_08 AC 41 ms
24,300 KB
testcase_09 AC 34 ms
23,352 KB
testcase_10 AC 377 ms
24,072 KB
testcase_11 AC 1,558 ms
23,892 KB
testcase_12 AC 437 ms
23,424 KB
testcase_13 AC 737 ms
23,580 KB
testcase_14 AC 1,324 ms
24,024 KB
testcase_15 AC 1,652 ms
23,352 KB
testcase_16 AC 74 ms
23,496 KB
testcase_17 AC 706 ms
24,264 KB
testcase_18 AC 1,105 ms
24,048 KB
testcase_19 AC 1,181 ms
23,580 KB
testcase_20 AC 1,712 ms
23,628 KB
testcase_21 AC 1,707 ms
23,592 KB
testcase_22 AC 1,720 ms
23,520 KB
testcase_23 AC 32 ms
23,784 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

def puts(s):
    print s
    sys.stdout.flush()

N = int(raw_input())

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

    puts(query)

    reply = raw_input().split()
    for i, s in enumerate(reply):
        p, q = pair[i]
        if s == ">": win[p - 1] += 1
        if s == "<": win[q - 1] += 1

ans = [0] * N
for i, r in enumerate(win, 1):
    ans[r] = i

puts("! " + " ".join(map(str, ans)))
0