結果
| 問題 |
No.206 数の積集合を求めるクエリ
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-05-09 00:51:00 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 823 bytes |
| コンパイル時間 | 94 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 29,536 KB |
| 最終ジャッジ日時 | 2024-07-05 20:54:28 |
| 合計ジャッジ時間 | 11,569 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 TLE * 1 -- * 6 |
ソースコード
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)