結果

問題 No.1307 Rotate and Accumulate
ユーザー 37zigen37zigen
提出日時 2020-12-04 13:19:27
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 503 ms / 5,000 ms
コード長 288 bytes
コンパイル時間 139 ms
コンパイル使用メモリ 10,500 KB
実行使用メモリ 84,420 KB
最終ジャッジ日時 2023-10-13 01:33:52
合計ジャッジ時間 9,131 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 131 ms
29,560 KB
testcase_01 AC 131 ms
29,584 KB
testcase_02 AC 130 ms
29,648 KB
testcase_03 AC 131 ms
29,652 KB
testcase_04 AC 131 ms
29,628 KB
testcase_05 AC 133 ms
29,536 KB
testcase_06 AC 132 ms
29,480 KB
testcase_07 AC 132 ms
29,696 KB
testcase_08 AC 497 ms
80,700 KB
testcase_09 AC 486 ms
84,420 KB
testcase_10 AC 340 ms
50,252 KB
testcase_11 AC 337 ms
45,900 KB
testcase_12 AC 417 ms
71,952 KB
testcase_13 AC 192 ms
39,844 KB
testcase_14 AC 278 ms
51,472 KB
testcase_15 AC 491 ms
61,904 KB
testcase_16 AC 502 ms
61,880 KB
testcase_17 AC 496 ms
61,476 KB
testcase_18 AC 469 ms
54,540 KB
testcase_19 AC 503 ms
61,412 KB
testcase_20 AC 494 ms
62,956 KB
testcase_21 AC 131 ms
29,588 KB
権限があれば一括ダウンロードができます

ソースコード

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]*(2*N+1)
for p in r:
    b[N-p]+=1
fft=np.fft
L=len(a)+len(b)-1
c=fft.irfft(fft.rfft(a,L)*fft.rfft(b,L),L)
B=[0]*N
for i in range(L):
    B[i%N]+=int(c[i]+.5)
print(*B)
0