結果

問題 No.2359 A in S ?
ユーザー ニックネームニックネーム
提出日時 2023-06-24 01:35:43
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 768 ms / 2,000 ms
コード長 452 bytes
コンパイル時間 254 ms
コンパイル使用メモリ 87,220 KB
実行使用メモリ 113,360 KB
最終ジャッジ日時 2023-09-13 20:46:51
合計ジャッジ時間 7,039 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 97 ms
77,744 KB
testcase_01 AC 97 ms
77,652 KB
testcase_02 AC 108 ms
77,848 KB
testcase_03 AC 87 ms
72,364 KB
testcase_04 AC 231 ms
94,040 KB
testcase_05 AC 334 ms
112,860 KB
testcase_06 AC 234 ms
93,836 KB
testcase_07 AC 222 ms
95,328 KB
testcase_08 AC 768 ms
110,060 KB
testcase_09 AC 218 ms
94,096 KB
testcase_10 AC 307 ms
110,024 KB
testcase_11 AC 315 ms
113,360 KB
testcase_12 AC 246 ms
93,640 KB
testcase_13 AC 233 ms
94,308 KB
testcase_14 AC 228 ms
94,712 KB
testcase_15 AC 208 ms
94,092 KB
testcase_16 AC 241 ms
94,212 KB
testcase_17 AC 216 ms
94,248 KB
testcase_18 AC 220 ms
93,984 KB
testcase_19 AC 221 ms
94,332 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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