結果

問題 No.206 数の積集合を求めるクエリ
ユーザー rpy3cpprpy3cpp
提出日時 2015-05-09 00:49:00
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 823 bytes
コンパイル時間 129 ms
コンパイル使用メモリ 10,784 KB
実行使用メモリ 23,184 KB
最終ジャッジ日時 2023-09-19 09:09:19
合計ジャッジ時間 11,482 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
8,016 KB
testcase_01 RE -
testcase_02 AC 17 ms
7,816 KB
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 AC 16 ms
7,800 KB
testcase_11 AC 16 ms
7,908 KB
testcase_12 AC 672 ms
8,476 KB
testcase_13 AC 357 ms
8,524 KB
testcase_14 AC 242 ms
8,440 KB
testcase_15 AC 20 ms
8,672 KB
testcase_16 AC 19 ms
8,600 KB
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 RE -
testcase_24 TLE -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

def solve(L, M, N, A, B, Q):
    if Q == 1:
        As = [False] * (N + 1)
        for ai in A:
            As[ai] = True
        counter = 0
        for bi in B:
            if As[bi]:
                counter += 1
        return counter  
    A.sort()
    B.sort()
    counter = [0] * Q
    for bi in B:
        for ai in A:
            dif = ai - bi
            if dif < 0:
                continue
            if dif >= Q:
                break
            counter[dif] += 1
    return counter

if __name__ == '__main__':
    L, M, N, A, B, Q = read_data()
    counter = solve(L, M, N, A, B, Q)
    for c in counter:
        print(c)
0