結果

問題 No.2359 A in S ?
ユーザー titiatitia
提出日時 2023-06-23 23:09:41
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 623 bytes
コンパイル時間 1,062 ms
コンパイル使用メモリ 87,172 KB
実行使用メモリ 122,464 KB
最終ジャッジ日時 2023-09-13 18:18:13
合計ジャッジ時間 12,992 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
72,304 KB
testcase_01 AC 77 ms
72,304 KB
testcase_02 AC 117 ms
78,688 KB
testcase_03 AC 77 ms
72,272 KB
testcase_04 TLE -
testcase_05 TLE -
testcase_06 TLE -
testcase_07 AC 185 ms
101,344 KB
testcase_08 TLE -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
from heapq import heappop,heappush

N,M=map(int,input().split())
LRXY=[list(map(int,input().split())) for i in range(N)]
A=list(map(int,input().split()))

H=[]

for l,r,x,y in LRXY:
    a=l//x*x+y-x

    while a<l:
        a+=x

    b=r//x*x+y-x

    while b<=r:
        b+=x

    if a<b:
        H.append((a,x,1))
        H.append((b,x,-1))

H.sort()

ANS=[0]*(10**5+1)

while H:
    a,x,ko=heappop(H)

    while H and H[0][0]==a and H[0][1]==x:
        a,x,ko2=heappop(H)
        ko+=ko2

    if ko!=0:
        ANS[a]+=ko
        heappush(H,(a+x,x,ko))

for a in A:
    print(ANS[a])
0