結果

問題 No.2359 A in S ?
ユーザー FromBooskaFromBooska
提出日時 2023-06-24 17:57:48
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 948 bytes
コンパイル時間 1,754 ms
コンパイル使用メモリ 86,444 KB
実行使用メモリ 76,284 KB
最終ジャッジ日時 2023-09-14 13:33:38
合計ジャッジ時間 6,050 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
71,196 KB
testcase_01 AC 75 ms
71,292 KB
testcase_02 AC 97 ms
76,284 KB
testcase_03 AC 76 ms
71,440 KB
testcase_04 TLE -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

# 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)
0