結果

問題 No.2359 A in S ?
ユーザー 遭難者遭難者
提出日時 2023-01-08 14:10:30
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 756 ms / 2,000 ms
コード長 666 bytes
コンパイル時間 342 ms
コンパイル使用メモリ 86,900 KB
実行使用メモリ 339,260 KB
最終ジャッジ日時 2023-08-29 05:23:18
合計ジャッジ時間 18,991 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 675 ms
325,480 KB
testcase_01 AC 672 ms
325,236 KB
testcase_02 AC 644 ms
325,320 KB
testcase_03 AC 638 ms
325,456 KB
testcase_04 AC 731 ms
338,848 KB
testcase_05 AC 735 ms
335,656 KB
testcase_06 AC 729 ms
338,824 KB
testcase_07 AC 718 ms
337,452 KB
testcase_08 AC 756 ms
338,820 KB
testcase_09 AC 726 ms
338,600 KB
testcase_10 AC 698 ms
338,792 KB
testcase_11 AC 728 ms
339,260 KB
testcase_12 AC 730 ms
338,604 KB
testcase_13 AC 756 ms
338,916 KB
testcase_14 AC 711 ms
338,816 KB
testcase_15 AC 678 ms
338,760 KB
testcase_16 AC 707 ms
339,064 KB
testcase_17 AC 686 ms
338,836 KB
testcase_18 AC 705 ms
338,804 KB
testcase_19 AC 718 ms
338,840 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
n, m = map(int, input().split())
inf = 10 ** 5 + 1
s_inf = 316
pl = [[0 for i in range(inf)] for j in range(s_inf)]
a = [0 for i in range(inf)]
for _ in range(n):
    l, r, x, y = map(int, input().split())
    l = (l - y + x - 1) // x * x + y
    r = (r - y + x) // x * x + y
    if x < s_inf:
        pl[x][l] += 1
        if r < inf:
            pl[x][r] -= 1
    else:
        while l < r:
            a[l] += 1
            l += x
for x in range(1, s_inf):
    for y in range(x, inf):
        pl[x][y] += pl[x][y - x]
    for y in range(inf):
        a[y] += pl[x][y]
for i in list(map(int, input().split())):
    print(a[i])
0