結果

問題 No.2577 Simple Permutation Guess
ユーザー Nikkuniku029Nikkuniku029
提出日時 2023-12-07 18:19:31
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 581 bytes
コンパイル時間 184 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 93,944 KB
平均クエリ数 251.95
最終ジャッジ日時 2024-09-27 02:14:47
合計ジャッジ時間 18,585 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 110 RE * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
seen = set()
ans = []
for i in range(N):
    s = []
    for j in range(1, N + 1):
        if j in seen:
            continue
        s.append(j)
    l = 0
    r = len(s)
    while r - l > 1:
        mid = (l + r) // 2
        Q = ans[:]
        Q.append(s[mid])
        for m in s:
            if m != s[mid]:
                Q.append(m)
        print("?", *Q, flush=True, end="\n")
        ret = int(input())
        if ret == 1:
            l = mid
        else:
            r = mid
    ans.append(s[l])
    seen.add(s[l])
print("!", *ans, end="\n", flush=True)
0