結果
問題 |
No.2272 多項式乗算 mod 258280327
|
ユーザー |
![]() |
提出日時 | 2025-03-31 17:48:08 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 642 bytes |
コンパイル時間 | 315 ms |
コンパイル使用メモリ | 82,600 KB |
実行使用メモリ | 84,444 KB |
最終ジャッジ日時 | 2025-03-31 17:49:15 |
合計ジャッジ時間 | 8,164 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 24 WA * 3 TLE * 1 -- * 5 |
ソースコード
mod = 258280327 n = int(input()) f_coeffs = list(map(lambda x: int(x) % mod, input().split())) m = int(input()) g_coeffs = list(map(lambda x: int(x) % mod, input().split())) len_f = n + 1 len_g = m + 1 max_degree = n + m result = [0] * (max_degree + 1) for i in range(len_f): a = f_coeffs[i] for j in range(len_g): k = i + j result[k] = (result[k] + a * g_coeffs[j]) % mod # Determine the highest non-zero coefficient degree = max_degree while degree >= 0 and result[degree] == 0: degree -= 1 if degree == -1: print(0) print(0) else: print(degree) print(' '.join(map(str, result[:degree+1])))