結果

問題 No.2577 Simple Permutation Guess
ユーザー t98slidert98slider
提出日時 2023-12-05 01:37:10
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 651 bytes
コンパイル時間 820 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 110,968 KB
平均クエリ数 18.07
最終ジャッジ日時 2023-12-05 01:37:21
合計ジャッジ時間 9,532 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 62 ms
69,468 KB
testcase_01 TLE -
testcase_02 AC 250 ms
91,908 KB
testcase_03 AC 61 ms
69,468 KB
testcase_04 AC 450 ms
91,912 KB
testcase_05 AC 600 ms
92,032 KB
testcase_06 TLE -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
testcase_48 -- -
testcase_49 -- -
testcase_50 -- -
testcase_51 -- -
testcase_52 -- -
testcase_53 -- -
testcase_54 -- -
testcase_55 -- -
testcase_56 -- -
testcase_57 -- -
testcase_58 -- -
testcase_59 -- -
testcase_60 -- -
testcase_61 -- -
testcase_62 -- -
testcase_63 -- -
testcase_64 -- -
testcase_65 -- -
testcase_66 -- -
testcase_67 -- -
testcase_68 -- -
testcase_69 -- -
testcase_70 -- -
testcase_71 -- -
testcase_72 -- -
testcase_73 -- -
testcase_74 -- -
testcase_75 -- -
testcase_76 -- -
testcase_77 -- -
testcase_78 -- -
testcase_79 -- -
testcase_80 -- -
testcase_81 -- -
testcase_82 -- -
testcase_83 -- -
testcase_84 -- -
testcase_85 -- -
testcase_86 -- -
testcase_87 -- -
testcase_88 -- -
testcase_89 -- -
testcase_90 -- -
testcase_91 -- -
testcase_92 -- -
testcase_93 -- -
testcase_94 -- -
testcase_95 -- -
testcase_96 -- -
testcase_97 -- -
testcase_98 -- -
testcase_99 -- -
testcase_100 -- -
testcase_101 -- -
evil_1_rnd_1.txt -- -
evil_1_rnd_2.txt -- -
evil_2_big_1.txt -- -
evil_2_big_2.txt -- -
evil_2_big_3.txt -- -
evil_3_sorted_1.txt -- -
evil_4_sorted_rev_1.txt -- -
evil_4_sorted_rev_2.txt -- -
evil_400_sorted.txt -- -
evil_400_sorted_rev.txt -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
v = 1
fact = [1] * (n + 1)
for i in range(n):
    fact[i + 1] = fact[i] * (i + 1)

def make(mid):
    tmp = [0] * n
    used = [False] * n
    cur = mid
    for i in range(n):
        for j in range(n):
            if used[j]:
                continue
            if cur - fact[n - 1 - i] < 0:
                tmp[i] = j + 1
                break
            cur -= fact[n - 1 - i]
        used[tmp[i] - 1] = True
    return tmp

ok, ng = 0, fact[n]
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)
0