結果
| 問題 | No.1618 Convolution? | 
| コンテスト | |
| ユーザー |  ayaoni | 
| 提出日時 | 2021-08-08 17:58:59 | 
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 838 bytes | 
| コンパイル時間 | 94 ms | 
| コンパイル使用メモリ | 12,800 KB | 
| 実行使用メモリ | 77,404 KB | 
| 最終ジャッジ日時 | 2024-09-19 14:41:48 | 
| 合計ジャッジ時間 | 20,544 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| 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(),np.int64)
Y = np.array([i for i in range(N+1)],np.int64)
def convolution(A,B):
    size = 1
    while 2*size < len(A)+len(B)-1:
        size *= 2
    size *= 2
    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:2*N+1]
print(*ANS)
            
            
            
        