結果

問題 No.2520 L1 Explosion
ユーザー MasKoaTSMasKoaTS
提出日時 2023-10-05 11:12:58
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,430 ms / 2,000 ms
コード長 833 bytes
コンパイル時間 267 ms
コンパイル使用メモリ 87,332 KB
実行使用メモリ 79,400 KB
最終ジャッジ日時 2023-10-05 11:13:17
合計ジャッジ時間 18,435 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,348 KB
testcase_01 AC 75 ms
71,576 KB
testcase_02 AC 80 ms
71,464 KB
testcase_03 AC 71 ms
71,392 KB
testcase_04 AC 77 ms
71,620 KB
testcase_05 AC 75 ms
71,532 KB
testcase_06 AC 1,324 ms
79,276 KB
testcase_07 AC 360 ms
79,056 KB
testcase_08 AC 1,325 ms
78,804 KB
testcase_09 AC 1,430 ms
78,848 KB
testcase_10 AC 1,312 ms
79,044 KB
testcase_11 AC 1,319 ms
79,172 KB
testcase_12 AC 1,304 ms
79,120 KB
testcase_13 AC 1,357 ms
79,120 KB
testcase_14 AC 1,341 ms
79,400 KB
testcase_15 AC 135 ms
77,364 KB
testcase_16 AC 1,001 ms
78,948 KB
testcase_17 AC 681 ms
78,028 KB
testcase_18 AC 698 ms
78,200 KB
testcase_19 AC 568 ms
77,968 KB
testcase_20 AC 101 ms
77,088 KB
testcase_21 AC 918 ms
78,852 KB
testcase_22 AC 182 ms
77,488 KB
testcase_23 AC 140 ms
77,388 KB
testcase_24 AC 806 ms
78,748 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
MOD = 998244353
INV2 = pow(2, MOD - 2, MOD)


n, m = map(int, input().split())
mons = [(x - y, x + y, m - h) for x, y, h in (map(int, input().split()) for _ in [0] * n)]

imos = []
for x, y, d in mons:
    imos.append((x - d, y - d, 1))
    imos.append((x + d, y - d, -1))
    imos.append((x - d, y + d, -1))
    imos.append((x + d, y + d, 1))
imos.sort()

area = [0] * (n + 1)
col_nows = []
x_now = -10 ** 18
for x, y, c in imos:
    if(x_now != x):
        col_nows.sort()
        cnt = 0
        for i, (y_now, c_now) in enumerate(col_nows[:-1]):
            cnt += c_now
            y_next = col_nows[i + 1][0]
            area[cnt] += (y_next - y_now) % MOD * (x - x_now) % MOD
        x_now = x
    col_nows.append((y, c))

for s in area[1:]:
    ans = s % MOD * INV2 % MOD
    print(ans)
0