結果

問題 No.2577 Simple Permutation Guess
ユーザー Nikkuniku029
提出日時 2023-12-05 17:28:21
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 640 bytes
コンパイル時間 286 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 82,248 KB
平均クエリ数 0.91
最終ジャッジ日時 2024-09-27 00:18:03
合計ジャッジ時間 15,368 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample RE * 1
other RE * 111
権限があれば一括ダウンロードができます

ソースコード

diff #

from sortedcontainers import SortedList

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