結果

問題 No.206 数の積集合を求めるクエリ
ユーザー Eki1009
提出日時 2020-12-29 20:49:28
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 745 ms / 7,000 ms
コード長 356 bytes
コンパイル時間 98 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 120,260 KB
最終ジャッジ日時 2024-10-06 02:14:22
合計ジャッジ時間 22,229 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

import numpy as np
l, m, n = map(int, input().split())
A = tuple(map(int, input().split()))
B = tuple(map(int, input().split()))
P = [0]*(n+1)
Q = [0]*(n+1)
for a in A:P[a] = 1
for b in B:Q[n-b] = 1
fP = np.fft.rfft(P, 2**20)
fQ = np.fft.rfft(Q, 2**20)
fR = fP * fQ
R = np.rint(np.fft.irfft(fR)).astype(np.int64)
q = int(input())
print(*R[n:n+q], sep="\n")
0