結果

問題 No.1255 ハイレーツ・オブ・ボリビアン
ユーザー tktk_snsntktk_snsn
提出日時 2021-04-24 15:08:33
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,363 ms / 2,000 ms
コード長 578 bytes
コンパイル時間 668 ms
コンパイル使用メモリ 86,916 KB
実行使用メモリ 308,124 KB
最終ジャッジ日時 2023-09-17 13:37:13
合計ジャッジ時間 9,172 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 92 ms
71,784 KB
testcase_01 AC 92 ms
72,084 KB
testcase_02 AC 103 ms
77,424 KB
testcase_03 AC 103 ms
77,560 KB
testcase_04 AC 103 ms
77,824 KB
testcase_05 AC 114 ms
77,976 KB
testcase_06 AC 116 ms
77,988 KB
testcase_07 AC 113 ms
77,708 KB
testcase_08 AC 914 ms
235,248 KB
testcase_09 AC 955 ms
247,744 KB
testcase_10 AC 933 ms
242,424 KB
testcase_11 AC 935 ms
237,520 KB
testcase_12 AC 968 ms
256,056 KB
testcase_13 AC 199 ms
122,716 KB
testcase_14 AC 1,363 ms
308,124 KB
testcase_15 AC 913 ms
234,604 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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


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

    ans = inf
    memo = defaultdict(list)

    X = pow(2, n, mod)
    two = 1
    for p in range(1, n+1):
        two = two * X % mod
        memo[two].append(p)
    two = 1
    for q in range(n):
        if memo[two]:
            val = n * memo[two][0] - q
            if val:
                ans = min(ans, val)
        two = two * 2 % mod

    return ans


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