結果
問題 |
No.1618 Convolution?
|
ユーザー |
![]() |
提出日時 | 2021-08-08 17:39:19 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 761 bytes |
コンパイル時間 | 158 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 133,052 KB |
最終ジャッジ日時 | 2024-09-19 14:24:21 |
合計ジャッジ時間 | 23,899 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | WA * 15 |
ソースコード
import sys import numpy as np def I(): return int(sys.stdin.readline().rstrip()) def MI(): return map(int,sys.stdin.readline().rstrip().split()) def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) def LI2(): return list(map(int,sys.stdin.readline().rstrip())) def S(): return sys.stdin.readline().rstrip() def LS(): return list(sys.stdin.readline().rstrip().split()) def LS2(): return list(sys.stdin.readline().rstrip()) N = I() X = np.array([0]+LI())+np.array([0]+LI()) Y = np.array([i for i in range(N+1)]) def convolution(A,B): size = len(X)+len(Y)-1 FA = np.fft.rfft(A,size) FB = np.fft.rfft(B,size) FA *= FB Z = np.fft.irfft(FA,size) return np.rint(Z).astype(np.int32) ANS = convolution(X,Y)[1:] print(*ANS)