結果

問題 No.206 数の積集合を求めるクエリ
ユーザー tcltktcltk
提出日時 2021-01-15 03:56:46
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 969 ms / 7,000 ms
コード長 836 bytes
コンパイル時間 208 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 95,152 KB
最終ジャッジ日時 2024-05-03 20:20:55
合計ジャッジ時間 22,864 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 474 ms
44,536 KB
testcase_01 AC 465 ms
44,416 KB
testcase_02 AC 475 ms
44,536 KB
testcase_03 AC 476 ms
44,540 KB
testcase_04 AC 482 ms
44,404 KB
testcase_05 AC 467 ms
44,668 KB
testcase_06 AC 478 ms
44,512 KB
testcase_07 AC 488 ms
44,672 KB
testcase_08 AC 479 ms
44,412 KB
testcase_09 AC 474 ms
44,924 KB
testcase_10 AC 484 ms
44,416 KB
testcase_11 AC 488 ms
44,604 KB
testcase_12 AC 495 ms
44,536 KB
testcase_13 AC 491 ms
44,416 KB
testcase_14 AC 496 ms
44,412 KB
testcase_15 AC 497 ms
44,412 KB
testcase_16 AC 488 ms
44,540 KB
testcase_17 AC 755 ms
74,064 KB
testcase_18 AC 768 ms
93,188 KB
testcase_19 AC 685 ms
72,976 KB
testcase_20 AC 645 ms
65,716 KB
testcase_21 AC 658 ms
64,612 KB
testcase_22 AC 661 ms
65,524 KB
testcase_23 AC 685 ms
73,376 KB
testcase_24 AC 929 ms
73,820 KB
testcase_25 AC 904 ms
72,288 KB
testcase_26 AC 884 ms
63,708 KB
testcase_27 AC 806 ms
62,684 KB
testcase_28 AC 969 ms
95,152 KB
testcase_29 AC 887 ms
64,660 KB
testcase_30 AC 884 ms
63,172 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#region Header
#!/usr/bin/env python3
# from typing import *

import sys
import io
import math
import collections
import decimal
import itertools
from queue import PriorityQueue
import bisect
import heapq
import numpy as np

def input():
    return sys.stdin.readline()[:-1]

sys.setrecursionlimit(1000000)
#endregion

# _INPUT = """4 2 5
# 1 2 3 5
# 1 2
# 5
# """
# sys.stdin = io.StringIO(_INPUT)


def main():
    L, M, N = map(int, input().split())
    A = set(list(map(int, input().split())))
    B = set(list(map(int, input().split())))
    Q = int(input())

    f = [1 if i in A else 0 for i in range(N+1)]
    g = [1 if (N-i) in B else 0 for i in range(N+1)]
    fg = np.fft.irfft(np.fft.rfft(f, 2*N+1) * np.fft.rfft(g, 2*N+1), 2*N+1)

    for v in range(Q):
        print(round(fg[N+v]))

if __name__ == '__main__':
    main()
0