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