結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 45 ms
23,564 KB
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 AC 40 ms
24,420 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