結果

問題 No.1959 Prefix MinMax
ユーザー tktk_snsntktk_snsn
提出日時 2022-05-28 02:38:09
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
RE  
実行時間 -
コード長 869 bytes
コンパイル時間 128 ms
コンパイル使用メモリ 12,000 KB
実行使用メモリ 26,900 KB
平均クエリ数 16.62
最終ジャッジ日時 2023-10-20 22:29:18
合計ジャッジ時間 6,957 ms
ジャッジサーバーID
(参考情報)
judge10 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 54 ms
26,500 KB
testcase_01 AC 52 ms
26,500 KB
testcase_02 AC 53 ms
26,500 KB
testcase_03 AC 52 ms
26,500 KB
testcase_04 AC 53 ms
26,500 KB
testcase_05 AC 53 ms
26,500 KB
testcase_06 AC 59 ms
26,500 KB
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 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
testcase_31 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
write = sys.stdout.write
flush = sys.stdout.flush


def query(A):
    write("? {}\n".format(" ".join(str(x) for x in A)))
    flush()
    B = list(map(int, input().split()))
    return B


def answer(A):
    write("! {}\n".format(" ".join(str(x) for x in A)))
    flush()


def solve():
    N = int(input())

    sgn = 0
    P = [-1] * N
    fix = [-1] * N
    for _ in range(10):
        A = [sgn] * N
        for i in range(N):
            if fix[i] != -1:
                A[i] = fix[i]

        B = query(A[1:])
        P[0] = B[0]
        for i in range(1, N):
            if B[i] != B[i-1]:
                P[i] = B[i]
                if fix[i] == -1:
                    fix[i] = sgn
        sgn = 1 - sgn

        if all(p != -1 for p in P):
            break

    answer(P)


T = int(input())
for _ in range(T):
    solve()
0