結果

問題 No.1490 スライムと爆弾
ユーザー netyo715netyo715
提出日時 2021-01-04 00:58:16
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 941 bytes
コンパイル時間 139 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 187,684 KB
最終ジャッジ日時 2024-04-21 20:10:56
合計ジャッジ時間 8,333 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
16,256 KB
testcase_01 AC 30 ms
10,752 KB
testcase_02 AC 42 ms
11,264 KB
testcase_03 AC 35 ms
11,008 KB
testcase_04 AC 40 ms
11,136 KB
testcase_05 AC 38 ms
11,136 KB
testcase_06 AC 35 ms
11,008 KB
testcase_07 AC 34 ms
10,880 KB
testcase_08 AC 38 ms
11,264 KB
testcase_09 AC 34 ms
11,008 KB
testcase_10 AC 31 ms
10,880 KB
testcase_11 AC 32 ms
11,008 KB
testcase_12 AC 34 ms
11,136 KB
testcase_13 TLE -
testcase_14 TLE -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
権限があれば一括ダウンロードができます

ソースコード

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