結果

問題 No.1307 Rotate and Accumulate
ユーザー Eki1009Eki1009
提出日時 2021-03-21 03:36:23
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 794 ms / 5,000 ms
コード長 315 bytes
コンパイル時間 201 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 72,272 KB
最終ジャッジ日時 2024-05-01 13:13:10
合計ジャッジ時間 17,760 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 574 ms
57,380 KB
testcase_01 AC 566 ms
56,484 KB
testcase_02 AC 556 ms
56,552 KB
testcase_03 AC 558 ms
56,720 KB
testcase_04 AC 556 ms
58,336 KB
testcase_05 AC 567 ms
57,824 KB
testcase_06 AC 562 ms
57,356 KB
testcase_07 AC 571 ms
57,760 KB
testcase_08 AC 677 ms
61,268 KB
testcase_09 AC 676 ms
62,036 KB
testcase_10 AC 701 ms
65,496 KB
testcase_11 AC 659 ms
60,364 KB
testcase_12 AC 693 ms
65,176 KB
testcase_13 AC 606 ms
62,724 KB
testcase_14 AC 625 ms
61,708 KB
testcase_15 AC 788 ms
70,640 KB
testcase_16 AC 788 ms
71,444 KB
testcase_17 AC 794 ms
72,272 KB
testcase_18 AC 761 ms
59,952 KB
testcase_19 AC 780 ms
68,356 KB
testcase_20 AC 784 ms
67,536 KB
testcase_21 AC 564 ms
56,272 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import numpy as np
n, q = map(int, input().split())
A = tuple(map(int, input().split()))
R = tuple(map(int, input().split()))
B = [0]*n
for r in R:
    B[n-1-r] += 1
B *= 2
A = np.array(A)
B = np.array(B)
m = 1 << 18
C = np.round(np.fft.irfft(np.fft.rfft(A, m) * np.fft.rfft(B, m)))[n-1:2*n-1].astype(int)
print(*C)
0