結果

問題 No.1490 スライムと爆弾
ユーザー netyo715netyo715
提出日時 2021-01-04 00:59:43
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 415 ms / 2,000 ms
コード長 941 bytes
コンパイル時間 548 ms
コンパイル使用メモリ 87,088 KB
実行使用メモリ 123,668 KB
最終ジャッジ日時 2023-08-03 21:46:12
合計ジャッジ時間 8,584 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,576 KB
testcase_01 AC 71 ms
71,416 KB
testcase_02 AC 80 ms
76,140 KB
testcase_03 AC 81 ms
76,220 KB
testcase_04 AC 80 ms
75,752 KB
testcase_05 AC 78 ms
75,752 KB
testcase_06 AC 80 ms
75,908 KB
testcase_07 AC 80 ms
76,012 KB
testcase_08 AC 80 ms
75,876 KB
testcase_09 AC 81 ms
76,084 KB
testcase_10 AC 74 ms
71,584 KB
testcase_11 AC 78 ms
75,512 KB
testcase_12 AC 81 ms
75,924 KB
testcase_13 AC 278 ms
97,744 KB
testcase_14 AC 287 ms
108,752 KB
testcase_15 AC 254 ms
96,968 KB
testcase_16 AC 259 ms
95,456 KB
testcase_17 AC 211 ms
98,608 KB
testcase_18 AC 320 ms
107,764 KB
testcase_19 AC 297 ms
104,048 KB
testcase_20 AC 284 ms
97,072 KB
testcase_21 AC 230 ms
94,464 KB
testcase_22 AC 274 ms
98,848 KB
testcase_23 AC 72 ms
71,240 KB
testcase_24 AC 71 ms
71,276 KB
testcase_25 AC 332 ms
122,724 KB
testcase_26 AC 337 ms
122,500 KB
testcase_27 AC 329 ms
122,572 KB
testcase_28 AC 316 ms
110,052 KB
testcase_29 AC 310 ms
109,372 KB
testcase_30 AC 415 ms
123,668 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