結果

問題 No.1307 Rotate and Accumulate
ユーザー trineutrontrineutron
提出日時 2020-12-04 00:17:56
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 404 ms / 5,000 ms
コード長 345 bytes
コンパイル時間 103 ms
コンパイル使用メモリ 10,668 KB
実行使用メモリ 53,304 KB
最終ジャッジ日時 2023-10-12 10:51:28
合計ジャッジ時間 9,735 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 132 ms
29,600 KB
testcase_01 AC 130 ms
29,552 KB
testcase_02 AC 129 ms
29,540 KB
testcase_03 AC 129 ms
29,636 KB
testcase_04 AC 131 ms
29,620 KB
testcase_05 AC 131 ms
29,716 KB
testcase_06 AC 133 ms
29,516 KB
testcase_07 AC 132 ms
29,644 KB
testcase_08 AC 348 ms
50,568 KB
testcase_09 AC 314 ms
51,092 KB
testcase_10 AC 306 ms
47,976 KB
testcase_11 AC 246 ms
38,420 KB
testcase_12 AC 322 ms
50,576 KB
testcase_13 AC 195 ms
38,760 KB
testcase_14 AC 228 ms
41,340 KB
testcase_15 AC 404 ms
53,192 KB
testcase_16 AC 403 ms
53,160 KB
testcase_17 AC 401 ms
53,040 KB
testcase_18 AC 361 ms
42,164 KB
testcase_19 AC 401 ms
53,304 KB
testcase_20 AC 396 ms
53,148 KB
testcase_21 AC 132 ms
29,564 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import numpy as np

n, q = map(int, input().split())
a = np.array(list(map(int, input().split())))
r = list(map(int, input().split()))
b = np.zeros(n, dtype=int)
for i in r:
    if i:
        b[n - i] += 1
    else:
        b[0] += 1
ans = np.round(np.real(np.fft.ifft(np.fft.fft(a) * np.fft.fft(b))))
ans = np.array(ans, dtype=int)
print(*ans)
0