結果
| 問題 |
No.2359 A in S ?
|
| コンテスト | |
| ユーザー |
FromBooska
|
| 提出日時 | 2023-06-24 17:57:48 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 948 bytes |
| コンパイル時間 | 654 ms |
| コンパイル使用メモリ | 82,300 KB |
| 実行使用メモリ | 117,368 KB |
| 最終ジャッジ日時 | 2024-07-01 20:56:31 |
| 合計ジャッジ時間 | 4,428 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 2 TLE * 1 -- * 15 |
ソースコード
# N<10**5だから毎回すべてをチェックすれば二重ループで間に合わない
# 逆に各クエリから見て、適合するAiを探すのであればbisectも使えるのでどうか
# bisectは数のリストに対してのみ使える、リストのリストには使えない
N, M = map(int, input().split())
LRXY = []
for i in range(N):
l, r, x, y = map(int, input().split())
LRXY.append((l, r, x, y))
A = list(map(int, input().split()))
A_with_idx = []
for i in range(M):
A_with_idx.append((A[i], i))
A_with_idx.sort()
A_order = []
idx_order = []
for a, i in A_with_idx:
idx_order.append(i)
A_order.append(a)
from bisect import *
ans_count = [0]*M
for l, r, x, y in LRXY:
idx = bisect_left(A_order, l)
while idx < M and A_order[idx] <= r:
if A_order[idx]%x == y:
ans_count[idx_order[idx]] += 1
idx += 1
#print(ans_count)
for a in ans_count:
print(a)
FromBooska