結果

問題 No.2520 L1 Explosion
ユーザー ShirotsumeShirotsume
提出日時 2023-10-04 23:37:39
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,428 ms / 2,000 ms
コード長 923 bytes
コンパイル時間 2,165 ms
コンパイル使用メモリ 86,932 KB
実行使用メモリ 83,692 KB
最終ジャッジ日時 2023-10-04 23:38:01
合計ジャッジ時間 19,882 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 114 ms
74,652 KB
testcase_01 AC 112 ms
74,376 KB
testcase_02 AC 112 ms
74,692 KB
testcase_03 AC 114 ms
74,796 KB
testcase_04 AC 112 ms
74,772 KB
testcase_05 AC 113 ms
74,880 KB
testcase_06 AC 1,336 ms
82,956 KB
testcase_07 AC 393 ms
82,840 KB
testcase_08 AC 1,344 ms
82,828 KB
testcase_09 AC 1,428 ms
83,116 KB
testcase_10 AC 1,354 ms
83,668 KB
testcase_11 AC 1,364 ms
83,692 KB
testcase_12 AC 1,347 ms
83,612 KB
testcase_13 AC 1,361 ms
82,928 KB
testcase_14 AC 1,389 ms
82,696 KB
testcase_15 AC 186 ms
80,960 KB
testcase_16 AC 1,003 ms
82,912 KB
testcase_17 AC 683 ms
82,360 KB
testcase_18 AC 700 ms
82,308 KB
testcase_19 AC 601 ms
82,192 KB
testcase_20 AC 146 ms
80,780 KB
testcase_21 AC 950 ms
82,700 KB
testcase_22 AC 227 ms
81,292 KB
testcase_23 AC 183 ms
81,552 KB
testcase_24 AC 818 ms
82,552 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys, time, random
from collections import deque, Counter, defaultdict
input = lambda: sys.stdin.readline().rstrip()
ii = lambda: int(input())
mi = lambda: map(int, input().split())
li = lambda: list(mi())
inf = 2 ** 63 - 1
mod = 998244353

n, m = mi()

XYH = [li() for _ in range(n)]
XYH = [[v[0] - v[1], v[0] + v[1],m - v[2]] for v in XYH]

L = []
for x, y, h in XYH:
    L.append((x - h, y - h, 1))
    L.append((x + h, y - h, -1))
    L.append((x - h, y + h, -1))
    L.append((x + h, y + h, 1))
L.sort()
a = [0] * (n + 1)

ans = [0] * (n + 1)

now = []
nowx = -inf
for x, y, c in L:
    if nowx != x:
        now.sort()
        cnt = 0
        bef = -inf
        for i in range(0, len(now)-1):
            cnt += now[i][1]
            ans[cnt] += (now[i + 1][0] - now[i][0]) * (x - nowx)
        nowx = x
    now.append((y, c))
for v in [v * pow(2, mod - 2, mod) % mod for v in ans[1:]]:
    print(v)
        


0