結果

問題 No.1490 スライムと爆弾
ユーザー tktk_snsntktk_snsn
提出日時 2021-04-23 23:05:49
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 989 bytes
コンパイル時間 2,443 ms
コンパイル使用メモリ 86,752 KB
実行使用メモリ 143,952 KB
最終ジャッジ日時 2023-09-17 13:01:58
合計ジャッジ時間 8,116 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,292 KB
testcase_01 AC 77 ms
71,440 KB
testcase_02 AC 86 ms
75,840 KB
testcase_03 AC 87 ms
76,048 KB
testcase_04 WA -
testcase_05 AC 85 ms
75,836 KB
testcase_06 AC 82 ms
75,760 KB
testcase_07 AC 83 ms
76,168 KB
testcase_08 AC 82 ms
75,916 KB
testcase_09 WA -
testcase_10 AC 76 ms
71,288 KB
testcase_11 AC 81 ms
75,764 KB
testcase_12 AC 82 ms
75,900 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 71 ms
71,156 KB
testcase_25 AC 346 ms
123,480 KB
testcase_26 WA -
testcase_27 AC 341 ms
123,596 KB
testcase_28 AC 368 ms
125,724 KB
testcase_29 AC 356 ms
125,820 KB
testcase_30 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 7)

H, W, N, M = map(int, input().split())
slime = tuple(tuple(map(int, input().split())) for _ in range(N))
bomb = tuple(tuple(map(int, input().split())) for _ in range(M))

G = [[0] * (W+2) for _ in range(H+2)]
for x, y, b, c in bomb:
    Lx = max(0, x-b)
    Rx = min(H, x+b+1)
    Ly = max(0, y-b)
    Ry = min(W, y+b+1)
    G[Lx][Ly] += c
    G[Lx][Ry] -= c
    G[Rx][Ly] -= c
    G[Rx][Ry] += c

for i in range(H+1):
    for j in range(W+1):
        if i:
            G[i][j] += G[i-1][j]
for i in range(H+1):
    for j in range(W+1):
        if j:
            G[i][j] += G[i][j-1]
for i in range(H+1):
    for j in range(W+1):
        if i:
            G[i][j] += G[i-1][j]
for i in range(H+1):
    for j in range(W+1):
        if j:
            G[i][j] += G[i][j-1]
ans = 0
for t, u, l, r, a in slime:
    t -= 1
    l -= 1
    damage = G[t][l] + G[u][r] - G[t][r] - G[u][l]
    ans += damage < a
print(ans)
0