結果

問題 No.2359 A in S ?
ユーザー rin204rin204
提出日時 2024-04-14 21:21:18
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 650 ms / 2,000 ms
コード長 669 bytes
コンパイル時間 644 ms
コンパイル使用メモリ 82,520 KB
実行使用メモリ 113,620 KB
最終ジャッジ日時 2024-04-14 21:21:26
合計ジャッジ時間 7,031 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,148 KB
testcase_01 AC 47 ms
53,420 KB
testcase_02 AC 64 ms
64,504 KB
testcase_03 AC 42 ms
53,312 KB
testcase_04 AC 204 ms
102,928 KB
testcase_05 AC 263 ms
109,668 KB
testcase_06 AC 206 ms
100,080 KB
testcase_07 AC 180 ms
96,528 KB
testcase_08 AC 650 ms
113,620 KB
testcase_09 AC 176 ms
99,580 KB
testcase_10 AC 238 ms
111,608 KB
testcase_11 AC 252 ms
111,364 KB
testcase_12 AC 202 ms
102,956 KB
testcase_13 AC 252 ms
97,348 KB
testcase_14 AC 194 ms
98,396 KB
testcase_15 AC 173 ms
97,660 KB
testcase_16 AC 195 ms
98,524 KB
testcase_17 AC 177 ms
96,380 KB
testcase_18 AC 173 ms
95,876 KB
testcase_19 AC 239 ms
96,740 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, m = map(int, input().split())
dic = {}

for _ in range(n):
    l, r, x, y = map(int, input().split())
    tmp = (x << 20) | y
    dic.setdefault(tmp, []).append((l, r))

A = list(map(int, input().split()))
ma = max(A)
cnt = [0] * (ma + 1)

for key, lst in dic.items():
    x = key >> 20
    y = key & 0xFFFFF

    le = ma // x
    imos = [0] * (le + 5)
    for l, r in lst:
        s = (l - y + x - 1) // x
        t = (r - y) // x
        imos[s] += 1
        imos[t + 1] -= 1
    for i in range(le + 4):
        imos[i + 1] += imos[i]
        if i * x + y <= ma:
            cnt[i * x + y] += imos[i]
        else:
            break

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