結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
23,988 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 AC 36 ms
23,552 KB
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,012 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
rank = [0] * N
even = N // 2 * 2

for d in range(1, even):
    Q = []
    seen = [0] * even
    for i in range(N):
        if i < even and not seen[i] and not seen[i - d]:
            seen[i] = seen[i - d] = 1
            Q.append(i + 1)
            Q.append((i + even - d) % even + 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("?", N, i + 1, " ".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