結果
問題 |
No.1255 ハイレーツ・オブ・ボリビアン
|
ユーザー |
![]() |
提出日時 | 2021-04-24 13:11:14 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
TLE
|
実行時間 | - |
コード長 | 491 bytes |
コンパイル時間 | 80 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 26,772 KB |
最終ジャッジ日時 | 2024-07-04 09:04:35 |
合計ジャッジ時間 | 4,185 ms |
ジャッジサーバーID (参考情報) |
judge2 / 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()