結果
| 問題 | No.2156 ぞい文字列 |
| コンテスト | |
| ユーザー |
norioc
|
| 提出日時 | 2026-11-01 11:02:57 |
| 言語 | PyPy3 (8.0.0 + ACL) |
| 結果 |
RE
不安定
|
| 実行時間 | - |
| コード長 | 460 bytes |
| 記録 | |
| コンパイル時間 | 89 ms |
| コンパイル使用メモリ | 64,340 KB |
| 実行使用メモリ | 60,732 KB |
| 最終ジャッジ日時 | 2026-11-01 11:03:00 |
| 合計ジャッジ時間 | 2,957 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge7_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | RE * 4 |
| other | RE * 17 |
ソースコード
import numpy as np
def mat_power(m: np.ndarray, n: int, mod: int) -> np.ndarray:
if n == 0:
return np.identity(len(m), dtype=m.dtype)
res = mat_power(m, n // 2, mod)
res = res @ res % mod
if n % 2 == 1:
res = res @ m % mod
return res
MOD = 998244353
N = int(input())
m = np.array([[1, 1],
[1, 0]])
res = mat_power(m, N-1, MOD) @ [[1], [0]]
res %= MOD
ans = (res[0][0] + res[1][0] - 1) % MOD
print(ans)
norioc