結果
問題 |
No.2577 Simple Permutation Guess
|
ユーザー |
|
提出日時 | 2023-12-05 21:05:18 |
言語 | PyPy3 (7.3.15) |
結果 |
RE
|
実行時間 | - |
コード長 | 749 bytes |
コンパイル時間 | 344 ms |
コンパイル使用メモリ | 82,444 KB |
実行使用メモリ | 93,512 KB |
平均クエリ数 | 251.96 |
最終ジャッジ日時 | 2024-09-27 00:25:04 |
合計ジャッジ時間 | 18,989 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 110 RE * 1 |
ソースコード
N = int(input()) if N == 1: print("? 1", flush=True, end="\n") ret = int(input()) exit(print("! 1", end="\n", flush=True)) 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 k = s[mid] Q = ans[:] Q.append(k) for m in s: if m != k: Q.append(m) print("?", *Q, flush=True, end="\n") ret = int(input()) if ret == -1: exit() if ret == 1: l = mid else: r = mid ans.append(s[l]) seen.add(s[l]) print("!", *ans, end="\n", flush=True)