結果

問題 No.1618 Convolution?
ユーザー ayaoniayaoni
提出日時 2021-08-08 17:41:09
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 761 bytes
コンパイル時間 377 ms
コンパイル使用メモリ 11,896 KB
実行使用メモリ 134,200 KB
最終ジャッジ日時 2023-10-19 18:06:30
合計ジャッジ時間 23,864 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 473 ms
42,448 KB
testcase_01 AC 465 ms
42,448 KB
testcase_02 AC 1,080 ms
111,692 KB
testcase_03 AC 1,151 ms
124,892 KB
testcase_04 WA -
testcase_05 AC 486 ms
42,432 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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)
0