結果

問題 No.2577 Simple Permutation Guess
ユーザー Nikkuniku029
提出日時 2023-12-05 17:26:51
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 628 bytes
コンパイル時間 260 ms
コンパイル使用メモリ 82,560 KB
実行使用メモリ 82,600 KB
平均クエリ数 0.91
最終ジャッジ日時 2024-09-27 00:17:46
合計ジャッジ時間 16,403 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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)
0