結果
問題 | No.1618 Convolution? |
ユーザー |
![]() |
提出日時 | 2021-08-08 17:41:09 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 761 bytes |
コンパイル時間 | 113 ms |
コンパイル使用メモリ | 12,800 KB |
実行使用メモリ | 132,952 KB |
最終ジャッジ日時 | 2024-09-19 14:26:19 |
合計ジャッジ時間 | 20,748 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 3 WA * 12 |
ソースコード
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.int64) ANS = convolution(X,Y)[1:] print(*ANS)