結果

問題 No.1490 スライムと爆弾
ユーザー netyo715netyo715
提出日時 2021-01-04 01:45:46
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 398 ms / 2,000 ms
コード長 941 bytes
コンパイル時間 166 ms
コンパイル使用メモリ 82,344 KB
実行使用メモリ 121,712 KB
最終ジャッジ日時 2024-04-28 22:33:48
合計ジャッジ時間 7,928 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
53,444 KB
testcase_01 AC 44 ms
53,880 KB
testcase_02 AC 53 ms
61,584 KB
testcase_03 AC 49 ms
62,404 KB
testcase_04 AC 48 ms
61,156 KB
testcase_05 AC 48 ms
60,948 KB
testcase_06 AC 48 ms
62,300 KB
testcase_07 AC 48 ms
61,732 KB
testcase_08 AC 48 ms
60,232 KB
testcase_09 AC 49 ms
61,632 KB
testcase_10 AC 42 ms
54,584 KB
testcase_11 AC 44 ms
59,260 KB
testcase_12 AC 48 ms
61,692 KB
testcase_13 AC 249 ms
96,352 KB
testcase_14 AC 257 ms
106,820 KB
testcase_15 AC 225 ms
95,532 KB
testcase_16 AC 227 ms
94,288 KB
testcase_17 AC 184 ms
98,288 KB
testcase_18 AC 290 ms
107,352 KB
testcase_19 AC 270 ms
102,944 KB
testcase_20 AC 266 ms
95,484 KB
testcase_21 AC 206 ms
93,500 KB
testcase_22 AC 247 ms
97,568 KB
testcase_23 AC 39 ms
53,832 KB
testcase_24 AC 39 ms
53,744 KB
testcase_25 AC 308 ms
121,424 KB
testcase_26 AC 310 ms
121,596 KB
testcase_27 AC 309 ms
121,436 KB
testcase_28 AC 295 ms
108,392 KB
testcase_29 AC 287 ms
108,004 KB
testcase_30 AC 398 ms
121,712 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

H, W, N, M = map(int, input().split())
SLIMES = [list(map(int, input().split())) for _ in range(N)]

grid = [[0]*(W+1) for _ in range(H+1)]
for _ in range(M):
    x, y, b, c = map(int, input().split())
    x -= 1
    y -= 1
    grid[max(0, x-b)][max(0, y-b)] += c
    grid[min(H, x+b+1)][min(W, y+b+1)] += c
    grid[max(0, x-b)][min(W, y+b+1)] -= c
    grid[min(H, x+b+1)][max(0, y-b)] -= c

for h in range(H+1):
    for w in range(1, W+1):
        grid[h][w] += grid[h][w-1]
for h in range(1, H+1):
    for w in range(W+1):
        grid[h][w] += grid[h-1][w]

for h in range(H):
    for w in range(1, W):
        grid[h][w] += grid[h][w-1]
for h in range(1, H):
    for w in range(W):
        grid[h][w] += grid[h-1][w]

ans = N
for t, u, l, r, a in SLIMES:
    t -= 1
    u -= 1
    l -= 1
    r -= 1
    if grid[u][r] + grid[t-1][l-1] - grid[u][l-1] -grid[t-1][r] >= a:
        ans -= 1

print(ans)
0