結果
問題 | No.1255 ハイレーツ・オブ・ボリビアン |
ユーザー |
![]() |
提出日時 | 2021-04-24 13:11:47 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 491 bytes |
コンパイル時間 | 303 ms |
コンパイル使用メモリ | 82,256 KB |
実行使用メモリ | 215,556 KB |
最終ジャッジ日時 | 2024-07-04 09:04:40 |
合計ジャッジ時間 | 4,331 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 7 TLE * 1 -- * 7 |
ソースコード
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()