結果
問題 |
No.147 試験監督(2)
|
ユーザー |
|
提出日時 | 2025-05-11 17:57:09 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
TLE
|
実行時間 | - |
コード長 | 586 bytes |
コンパイル時間 | 488 ms |
コンパイル使用メモリ | 12,032 KB |
実行使用メモリ | 47,460 KB |
最終ジャッジ日時 | 2025-05-11 17:57:18 |
合計ジャッジ時間 | 8,080 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | TLE * 1 -- * 3 |
ソースコード
import numpy as np MOD = 10**9 + 7 def pow_matrix_mod(x, n, mod=MOD): x = x.astype(object) if not n: return np.eye(len(x), dtype=object) if n % 2 == 0: return pow_matrix_mod(x @ x % mod, n // 2) % mod else: return x @ pow_matrix_mod(x @ x % mod, (n - 1) // 2) % mod N = int(input()) A = np.array([[1, 1], [1, 0]], dtype=object) # フィボナッチ数列の行列 ans = 1 for _ in range(N): c, d = map(int, input().split()) fib = pow_matrix_mod(A, c + 1, MOD)[0, 0] ans *= pow(fib, d % (MOD - 1), MOD) ans %= MOD print(ans)