結果

問題 No.3347 Guess The Array
コンテスト
ユーザー とりゐ
提出日時 2025-11-13 21:52:20
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 558 bytes
コンパイル時間 338 ms
コンパイル使用メモリ 82,592 KB
実行使用メモリ 96,756 KB
平均クエリ数 4431.48
最終ジャッジ日時 2025-11-13 21:52:48
合計ジャッジ時間 26,212 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 9 RE * 37
権限があれば一括ダウンロードができます

ソースコード

diff #

def ask(arr):
    if len(arr) > n:
        return False
    print("?", len(arr), *arr, flush=True)
    s = input()
    return s == "Yes"


n = int(input())
ans = []
for v in range(1, n + 1):
    cnt = 0
    while len(ans) < n:
        cnt += 1
        ng, ok = len(ans) + 1, -1
        while ng - ok > 1:
            mid = (ok + ng) // 2
            if ask(ans[:mid] + [v] * cnt):
                ok = mid
            else:
                ng = mid
        if ok == -1:
            break
        ans = ans[:ok] + [v] + ans[ok:]

print("!", *ans, flush=True)
0