結果

問題 No.3347 Guess The Array
コンテスト
ユーザー とりゐ
提出日時 2025-11-13 21:42:36
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 564 bytes
コンパイル時間 382 ms
コンパイル使用メモリ 82,360 KB
実行使用メモリ 97,856 KB
平均クエリ数 4059.11
最終ジャッジ日時 2025-11-13 21:43:32
合計ジャッジ時間 27,245 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 34 RE * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

def ask(arr):
    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 True:
        if not ask([v] * (cnt + 1)):
            break
        cnt += 1

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

print("!", *ans)
0