結果
| 問題 |
No.1839 Concatenation Matrix
|
| コンテスト | |
| ユーザー |
gew1fw
|
| 提出日時 | 2025-06-12 16:10:09 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 898 bytes |
| コンパイル時間 | 343 ms |
| コンパイル使用メモリ | 82,688 KB |
| 実行使用メモリ | 267,136 KB |
| 最終ジャッジ日時 | 2025-06-12 16:10:17 |
| 合計ジャッジ時間 | 7,475 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 7 TLE * 1 -- * 8 |
ソースコード
MOD = 998244353
def main():
import sys
input = sys.stdin.read
data = input().split()
N = int(data[0])
a = list(map(int, data[1:N+1]))
MOD1 = MOD
MOD2 = MOD - 1
# Precompute pow_10 for each step 2 <= i <= N
pows = [0] * (N + 1) # pows[i] is pow_10 for step i (i ranges from 2 to N)
for i in range(2, N + 1):
exponent = pow(2, i-2, MOD2)
pows[i] = pow(10, exponent, MOD1)
# Initialize mod_prev as a's
mod_prev = a.copy()
for step in range(2, N + 1):
mod_curr = [0] * N
p = pows[step]
for j in range(N):
j_next = (j + 1) % N
term1 = (mod_prev[j] * p) % MOD1
term2 = mod_prev[j_next]
mod_curr[j] = (term1 + term2) % MOD1
mod_prev = mod_curr
for val in mod_prev:
print(val)
if __name__ == '__main__':
main()
gew1fw