結果

問題 No.1490 スライムと爆弾
ユーザー tktk_snsntktk_snsn
提出日時 2021-04-23 23:14:49
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,974 ms / 2,000 ms
コード長 1,030 bytes
コンパイル時間 566 ms
コンパイル使用メモリ 86,940 KB
実行使用メモリ 390,172 KB
最終ジャッジ日時 2023-09-17 13:07:12
合計ジャッジ時間 15,562 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 647 ms
203,440 KB
testcase_01 AC 643 ms
202,988 KB
testcase_02 AC 668 ms
206,420 KB
testcase_03 AC 657 ms
206,028 KB
testcase_04 AC 660 ms
206,264 KB
testcase_05 AC 664 ms
206,296 KB
testcase_06 AC 663 ms
206,116 KB
testcase_07 AC 657 ms
205,804 KB
testcase_08 AC 663 ms
206,272 KB
testcase_09 AC 658 ms
206,324 KB
testcase_10 AC 652 ms
204,780 KB
testcase_11 AC 653 ms
204,980 KB
testcase_12 AC 662 ms
206,320 KB
testcase_13 AC 1,436 ms
315,024 KB
testcase_14 AC 1,383 ms
332,356 KB
testcase_15 AC 1,390 ms
314,324 KB
testcase_16 AC 1,097 ms
292,972 KB
testcase_17 AC 1,223 ms
324,264 KB
testcase_18 AC 1,289 ms
331,668 KB
testcase_19 AC 1,258 ms
326,988 KB
testcase_20 AC 1,197 ms
313,184 KB
testcase_21 AC 1,187 ms
306,064 KB
testcase_22 AC 1,168 ms
303,584 KB
testcase_23 AC 654 ms
202,824 KB
testcase_24 AC 656 ms
202,980 KB
testcase_25 AC 1,760 ms
376,376 KB
testcase_26 AC 1,974 ms
376,684 KB
testcase_27 AC 1,507 ms
376,464 KB
testcase_28 AC 1,514 ms
374,292 KB
testcase_29 AC 1,471 ms
374,320 KB
testcase_30 AC 1,593 ms
390,172 KB
権限があれば一括ダウンロードができます

ソースコード

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+4004) for _ in range(H+4004)]
for x, y, b, c in bomb:
    x += 2000
    y += 2000
    G[x-b][y-b] += c
    G[x-b][y+b+1] -= c
    G[x+b+1][y-b] -= c
    G[x+b+1][y+b+1] += c

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