結果
問題 | No.1255 ハイレーツ・オブ・ボリビアン |
ユーザー | tktk_snsn |
提出日時 | 2021-04-24 15:06:55 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 553 bytes |
コンパイル時間 | 74 ms |
コンパイル使用メモリ | 10,920 KB |
実行使用メモリ | 29,004 KB |
最終ジャッジ日時 | 2023-09-17 13:36:46 |
合計ジャッジ時間 | 4,011 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 21 ms
8,972 KB |
testcase_01 | AC | 20 ms
8,840 KB |
testcase_02 | AC | 21 ms
8,904 KB |
testcase_03 | AC | 21 ms
8,812 KB |
testcase_04 | AC | 21 ms
8,904 KB |
testcase_05 | AC | 36 ms
8,996 KB |
testcase_06 | AC | 36 ms
8,976 KB |
testcase_07 | AC | 36 ms
8,932 KB |
testcase_08 | TLE | - |
testcase_09 | -- | - |
testcase_10 | -- | - |
testcase_11 | -- | - |
testcase_12 | -- | - |
testcase_13 | -- | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
ソースコード
from collections import defaultdict import heapq 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())