結果

問題 No.2359 A in S ?
ユーザー ニックネームニックネーム
提出日時 2023-06-23 23:14:44
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 595 bytes
コンパイル時間 2,031 ms
コンパイル使用メモリ 86,744 KB
実行使用メモリ 146,264 KB
最終ジャッジ日時 2023-09-13 18:22:59
合計ジャッジ時間 6,785 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 91 ms
72,504 KB
testcase_01 AC 92 ms
72,456 KB
testcase_02 AC 116 ms
78,300 KB
testcase_03 AC 90 ms
72,436 KB
testcase_04 AC 334 ms
127,448 KB
testcase_05 AC 373 ms
113,136 KB
testcase_06 AC 326 ms
123,916 KB
testcase_07 AC 237 ms
96,244 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 #

from collections import defaultdict
n,m = map(int,input().split())
xylr = defaultdict(list)
for _ in range(n):
    l,r,x,y = map(int,input().split())
    xylr[(x,y)].append((l,r))
z = 10**5; a = [0]*(z+1)
for (x,y),lr in xylr.items():
    d = {}; mi = z; ma = 0
    for l,r in lr:
        p = l+(y-l%x)%x; q = r+1+(y-(r+1)%x)%x
        mi = min(mi,p); ma = max(ma,q)
        if p<=z: d[p] = d.get(p,0)+1
        if q<=z: d[q] = d.get(q,0)-1
    i = mi
    while i<=min(ma,z)-x: d[i+x] = d.get(i+x,0)+d[i]; i += x
    for k,v in d.items(): a[k] += v
for v in map(int,input().split()): print(a[v])
0