結果
問題 | No.2577 Simple Permutation Guess |
ユーザー |
![]() |
提出日時 | 2023-12-05 00:22:16 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
RE
|
実行時間 | - |
コード長 | 495 bytes |
コンパイル時間 | 525 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 28,000 KB |
平均クエリ数 | 1.81 |
最終ジャッジ日時 | 2024-09-26 23:33:26 |
合計ジャッジ時間 | 10,994 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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))