結果

問題 No.282 おもりと天秤(2)
ユーザー roiti46roiti46
提出日時 2015-09-19 01:31:10
言語 Python2
(2.7.18)
結果
WA  
実行時間 -
コード長 787 bytes
コンパイル時間 56 ms
コンパイル使用メモリ 6,704 KB
実行使用メモリ 24,572 KB
平均クエリ数 220.33
最終ジャッジ日時 2023-09-23 06:19:33
合計ジャッジ時間 16,178 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
24,048 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 1,669 ms
24,268 KB
testcase_23 AC 35 ms
23,568 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
N = int(raw_input())

rank = [1] * N
used = [[False] * N for i in xrange(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]
        p -= 1
        q -= 1
        if used[p][q]: continue
        if r == ">":
            rank[p] += 1
        if r == "<":
            rank[q] += 1
        used[p][q] = True

print "! " + " ".join(map(str, rank))
sys.stdout.flush()
0