結果

問題 No.2359 A in S ?
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2023-06-24 17:48:41
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 1,019 bytes
コンパイル時間 404 ms
コンパイル使用メモリ 86,912 KB
実行使用メモリ 260,716 KB
最終ジャッジ日時 2023-09-14 13:23:35
合計ジャッジ時間 7,872 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 82 ms
78,948 KB
testcase_01 AC 85 ms
79,684 KB
testcase_02 AC 89 ms
76,760 KB
testcase_03 AC 74 ms
72,140 KB
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 AC 238 ms
103,628 KB
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

n,m = map(int,input().split())
lim = 200
M = 10**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