結果

問題 No.1255 ハイレーツ・オブ・ボリビアン
ユーザー tktk_snsntktk_snsn
提出日時 2021-04-24 13:11:47
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 491 bytes
コンパイル時間 429 ms
コンパイル使用メモリ 87,288 KB
実行使用メモリ 214,236 KB
最終ジャッジ日時 2023-09-17 13:34:59
合計ジャッジ時間 5,044 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 97 ms
76,540 KB
testcase_01 AC 98 ms
72,132 KB
testcase_02 AC 108 ms
77,516 KB
testcase_03 AC 108 ms
77,588 KB
testcase_04 AC 109 ms
77,508 KB
testcase_05 AC 129 ms
77,692 KB
testcase_06 AC 131 ms
77,836 KB
testcase_07 AC 130 ms
77,700 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