結果

問題 No.2359 A in S ?
ユーザー ntudantuda
提出日時 2023-06-27 22:07:44
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 757 bytes
コンパイル時間 826 ms
コンパイル使用メモリ 87,236 KB
実行使用メモリ 123,260 KB
最終ジャッジ日時 2023-09-17 20:29:04
合計ジャッジ時間 9,908 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 94 ms
71,692 KB
testcase_01 AC 94 ms
71,596 KB
testcase_02 AC 120 ms
78,780 KB
testcase_03 RE -
testcase_04 AC 295 ms
103,888 KB
testcase_05 AC 328 ms
121,724 KB
testcase_06 AC 286 ms
103,900 KB
testcase_07 AC 265 ms
102,596 KB
testcase_08 AC 633 ms
123,260 KB
testcase_09 AC 267 ms
106,356 KB
testcase_10 AC 319 ms
121,216 KB
testcase_11 AC 328 ms
123,184 KB
testcase_12 AC 283 ms
103,964 KB
testcase_13 RE -
testcase_14 AC 279 ms
103,764 KB
testcase_15 AC 267 ms
104,244 KB
testcase_16 AC 285 ms
103,936 KB
testcase_17 AC 270 ms
103,792 KB
testcase_18 AC 264 ms
103,940 KB
testcase_19 AC 273 ms
103,924 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, M = map(int, input().split())
LRXY = [list(map(int, input().split())) for _ in range(N)]
A = list(map(int, input().split()))
maxa = max(A)
from collections import defaultdict
dic = defaultdict(list)

for i, (l, r, x, y) in enumerate(LRXY):
    if maxa < r:
        LRXY[1] = maxa
        r = maxa
    dic[(x, y)].append((l, r))
    maxa = max(maxa, y)
ans = [0] * (maxa + 1)
for k, v in dic.items():
    x, y = k
    n = maxa // x + 2
    imost = [0] * (n + 1)
    for l, r in v:
        L = - ((y - l) // x)
        R = (r - y) // x
        imost[L] += 1
        imost[R + 1] -= 1
    for i in range(n - 1):
        tmp = imost[i]
        imost[i + 1] += tmp
        if i * x + y <= maxa:
            ans[i * x + y] += tmp
for a in A:
    print(ans[a])
0