結果
問題 | No.1307 Rotate and Accumulate |
ユーザー | wolgnik |
提出日時 | 2020-12-04 00:47:17 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 451 bytes |
コンパイル時間 | 262 ms |
コンパイル使用メモリ | 10,900 KB |
実行使用メモリ | 56,268 KB |
最終ジャッジ日時 | 2023-10-12 11:38:53 |
合計ジャッジ時間 | 5,540 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 134 ms
29,568 KB |
testcase_01 | AC | 133 ms
29,652 KB |
testcase_02 | AC | 131 ms
29,428 KB |
testcase_03 | RE | - |
testcase_04 | RE | - |
testcase_05 | RE | - |
testcase_06 | RE | - |
testcase_07 | AC | 130 ms
29,608 KB |
testcase_08 | RE | - |
testcase_09 | RE | - |
testcase_10 | RE | - |
testcase_11 | RE | - |
testcase_12 | RE | - |
testcase_13 | RE | - |
testcase_14 | RE | - |
testcase_15 | RE | - |
testcase_16 | RE | - |
testcase_17 | RE | - |
testcase_18 | RE | - |
testcase_19 | RE | - |
testcase_20 | RE | - |
testcase_21 | AC | 133 ms
29,440 KB |
ソースコード
import sys import numpy as np input = sys.stdin.readline N, Q = map(int, input().split()) a = list(map(int, input().split())) r = list(map(int, input().split())) ln = 1 << 4 A = np.zeros(ln) B = np.zeros(ln) for i in range(N): A[N - i - 1] = a[i] for q in r: B[q] += 1 C = np.fft.rfft(A) * np.fft.rfft(B) c = np.fft.irfft(C) res = [0] * N for i in range(len(c)): res[i % N] += c[i] res.reverse() res = [int(res[i] + 0.5) for i in range(N)] print(*res)