結果

問題 No.1307 Rotate and Accumulate
ユーザー 37zigen
提出日時 2020-12-04 13:24:57
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
RE  
実行時間 -
コード長 288 bytes
コンパイル時間 205 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 65,272 KB
最終ジャッジ日時 2024-09-14 23:26:21
合計ジャッジ時間 15,562 ms
ジャッジサーバーID
(参考情報)
judge2 / judge6
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample RE * 3
other RE * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

import numpy as np
N,Q=map(int,input().split())
a=list(map(int,input().split()))
r=list(map(int,input().split()))
b=[0]*N
for p in r:
    b[(-p)%N]+=1
fft=np.fft
L=len(a)+len(b)-1
c=list(map(int,fft.irfft(fft.rfft(a)*fft.rfft(b))+.5))
B=[0]*N
for i in range(L):
    B[i%N]+=c[i]
print(*B)
0