結果

問題 No.2359 A in S ?
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2023-06-24 17:49:48
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 532 ms / 2,000 ms
コード長 1,021 bytes
コンパイル時間 1,122 ms
コンパイル使用メモリ 86,692 KB
実行使用メモリ 260,688 KB
最終ジャッジ日時 2023-09-14 13:25:04
合計ジャッジ時間 7,715 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 80 ms
78,752 KB
testcase_01 AC 80 ms
79,652 KB
testcase_02 AC 86 ms
76,620 KB
testcase_03 AC 72 ms
71,912 KB
testcase_04 AC 251 ms
108,688 KB
testcase_05 AC 427 ms
171,148 KB
testcase_06 AC 252 ms
105,548 KB
testcase_07 AC 225 ms
103,864 KB
testcase_08 AC 532 ms
213,808 KB
testcase_09 AC 217 ms
106,412 KB
testcase_10 AC 404 ms
260,660 KB
testcase_11 AC 435 ms
260,688 KB
testcase_12 AC 243 ms
108,372 KB
testcase_13 AC 224 ms
103,668 KB
testcase_14 AC 241 ms
104,388 KB
testcase_15 AC 216 ms
103,420 KB
testcase_16 AC 243 ms
104,976 KB
testcase_17 AC 224 ms
103,792 KB
testcase_18 AC 233 ms
102,984 KB
testcase_19 AC 231 ms
104,136 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,m = map(int,input().split())
lim = 200
M = 10**5+5
small = [[] for i in range(lim+1)]
large = []

for i in range(n):
    l,r,x,y = map(int,input().split())
    if x <= lim:
        small[x].append([y,l,r])
    else:
        large.append([x,y,l,r])


A = list(map(int,input().split()))

nums = [0]*M

for x in range(1,lim+1):

    if small[x] == []:
        continue

    imos = [0]*M

    for y,l,r in small[x]:

        tl = l//x*x+y
        if tl < l:
            tl += x

        tr = (r+1)//x*x+y
        if tr <= r:
            tr += x
        
        # print(x,y,l,r,tl,tr)
        if tl < M:
            imos[tl] += 1
        
        if tr < M:
            imos[tr] -= 1

    
    for i in range(M):
        nums[i] += imos[i]
        if i+x < M:
            imos[i+x] += imos[i]


for x,y,l,r in large:
    tl = l//x*x+y
    if tl < l:
        tl += x

    tr = (r+1)//x*x+y
    if tr <= r:
        tr += x

    tr = min(tr,M)
    for p in range(tl,tr,x):
        nums[p] += 1

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