結果
問題 |
No.2577 Simple Permutation Guess
|
ユーザー |
![]() |
提出日時 | 2023-12-05 00:23:00 |
言語 | PyPy3 (7.3.15) |
結果 |
RE
|
実行時間 | - |
コード長 | 495 bytes |
コンパイル時間 | 281 ms |
コンパイル使用メモリ | 82,304 KB |
実行使用メモリ | 82,504 KB |
平均クエリ数 | 1.81 |
最終ジャッジ日時 | 2024-09-26 23:34:24 |
合計ジャッジ時間 | 13,747 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | RE * 1 |
other | AC * 2 WA * 1 RE * 108 |
ソースコード
import sys import math N=int(input()) fact = [1] for i in range(1,501): fact.append(fact[-1]*i) def get(v): alive = [1]*N ret = [] for i in range(N,0,-1): x = v // fact[i-1] + 1 v %= fact[i-1] for a in range(N): if alive[a]==1: x -= 1 if x==0: ret.append(str(a+1)) break return ret L=0 R=fact[N] while L+1<R: M=(L+R)//2 arr = get(M) print("? "+" ".join(arr)) ret=int(input()) if ret==1: L=M else: R=M arr = get(L) print("! "+" ".join(arr))