結果

問題 No.282 おもりと天秤(2)
ユーザー eitahoeitaho
提出日時 2016-07-28 22:10:29
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 1,009 bytes
コンパイル時間 91 ms
コンパイル使用メモリ 11,056 KB
実行使用メモリ 24,852 KB
平均クエリ数 323.88
最終ジャッジ日時 2023-09-23 11:14:50
合計ジャッジ時間 25,783 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
24,084 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 WA -
testcase_23 AC 38 ms
24,364 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
rank = [0] * N
even = N // 2 * 2
A = list(range(0, even // 2))
B = list(range(even // 2, even))

for t in range(even - 1):
    Q = []
    A, B = B[:1] + A[:-1], B[1:] + A[-1:]
    for i in range(N):
        if i < len(A):
            Q.append(A[i] + 1)
            Q.append(B[i] + 1)
        else:
            Q.append(0)
            Q.append(0)
    print("?", " ".join(str(v) for v in Q), flush=True)
    res = input().split()
    for i in range(N):
        if Q[i * 2] != 0:
            if res[i] == ">":
                rank[Q[i * 2 + 0] - 1] += 1
            elif res[i] == "<":
                rank[Q[i * 2 + 1] - 1] += 1

if N > 1 and N % 2 == 1:
    for i in range(N - 1):
        print("?", i + 1, N, " ".join(["0"] * (2 * N - 2)), flush=True)
        res = input().split()[0]
        if res == ">":
            rank[i] += 1
        elif res == "<":
            rank[N - 1] += 1

ans = sorted(range(N), key=lambda i: rank[i])
print("!", " ".join(str(a + 1) for a in ans), flush=True)
0