結果
| 問題 | No.2577 Simple Permutation Guess | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2023-12-05 01:31:55 | 
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) | 
| 結果 | 
                                RE
                                 
                             | 
| 実行時間 | - | 
| コード長 | 652 bytes | 
| コンパイル時間 | 398 ms | 
| コンパイル使用メモリ | 12,800 KB | 
| 実行使用メモリ | 28,104 KB | 
| 平均クエリ数 | 33.13 | 
| 最終ジャッジ日時 | 2024-09-26 23:52:46 | 
| 合計ジャッジ時間 | 13,560 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 1 | 
| other | AC * 63 WA * 15 RE * 33 | 
ソースコード
import sys
sys.set_int_max_str_digits(100000)
n = int(input())
v = 1
for i in range(n):
    v *= i + 1
def make(mid):
    tmp = [0] * n
    used = [False] * n
    cur = mid
    c = v
    for i in range(n):
        c /= n - i
        for j in range(n):
            if used[j]:
                continue
            if cur - c < 0:
                tmp[i] = j + 1
                break
            cur -= c
        used[tmp[i] - 1] = True
    return tmp
ok, ng = 0, v
while ok + 1 < ng:
    mid = (ok + ng) // 2
    print("?", *make(mid), flush=True)
    if input() == "1":
        ok = mid
    else:
        ng = mid
print("!", *make(ok), flush=True)
            
            
            
        