結果

問題 No.1255 ハイレーツ・オブ・ボリビアン
ユーザー tktk_snsntktk_snsn
提出日時 2021-04-24 13:11:14
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 491 bytes
コンパイル時間 100 ms
コンパイル使用メモリ 10,896 KB
実行使用メモリ 21,852 KB
最終ジャッジ日時 2023-09-17 13:34:54
合計ジャッジ時間 4,462 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 19 ms
13,292 KB
testcase_01 AC 20 ms
8,700 KB
testcase_02 AC 22 ms
8,800 KB
testcase_03 AC 22 ms
8,800 KB
testcase_04 AC 21 ms
8,760 KB
testcase_05 AC 69 ms
8,852 KB
testcase_06 AC 70 ms
8,896 KB
testcase_07 AC 70 ms
8,932 KB
testcase_08 TLE -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict
import sys
input = sys.stdin.readline
inf = 10**18


def main():
    N = int(input())
    mod = 2*N-1

    d = defaultdict(int)
    n = int(mod**0.5) + 1

    ans = inf

    for p in range(1, n+1)[::-1]:
        val = pow(2, n*p, mod)
        d[val] = p
    for q in range(n)[::-1]:
        val = pow(2, q, mod)
        if d[val]:
            K = n * d[val] - q
            ans = min(ans, K)
    print(ans)


T = int(input())
for _ in range(T):
    main()
0