結果

問題 No.206 数の積集合を求めるクエリ
ユーザー Eki1009Eki1009
提出日時 2020-12-29 20:49:28
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 826 ms / 7,000 ms
コード長 356 bytes
コンパイル時間 186 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 120,344 KB
最終ジャッジ日時 2024-04-15 21:14:52
合計ジャッジ時間 25,329 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 679 ms
110,148 KB
testcase_01 AC 649 ms
110,568 KB
testcase_02 AC 651 ms
109,576 KB
testcase_03 AC 641 ms
110,464 KB
testcase_04 AC 646 ms
110,904 KB
testcase_05 AC 657 ms
110,380 KB
testcase_06 AC 653 ms
109,484 KB
testcase_07 AC 645 ms
109,872 KB
testcase_08 AC 652 ms
109,240 KB
testcase_09 AC 641 ms
109,624 KB
testcase_10 AC 643 ms
110,256 KB
testcase_11 AC 646 ms
109,924 KB
testcase_12 AC 653 ms
110,052 KB
testcase_13 AC 650 ms
110,108 KB
testcase_14 AC 649 ms
110,916 KB
testcase_15 AC 661 ms
109,356 KB
testcase_16 AC 657 ms
109,908 KB
testcase_17 AC 750 ms
120,136 KB
testcase_18 AC 710 ms
114,136 KB
testcase_19 AC 748 ms
119,128 KB
testcase_20 AC 712 ms
115,772 KB
testcase_21 AC 722 ms
117,416 KB
testcase_22 AC 716 ms
117,328 KB
testcase_23 AC 788 ms
120,276 KB
testcase_24 AC 826 ms
120,128 KB
testcase_25 AC 810 ms
120,344 KB
testcase_26 AC 775 ms
114,712 KB
testcase_27 AC 751 ms
113,140 KB
testcase_28 AC 781 ms
117,124 KB
testcase_29 AC 781 ms
116,296 KB
testcase_30 AC 768 ms
114,020 KB
権限があれば一括ダウンロードができます

ソースコード

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