結果

問題 No.1490 スライムと爆弾
ユーザー ああいいああいい
提出日時 2022-02-26 15:33:06
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 543 ms / 2,000 ms
コード長 846 bytes
コンパイル時間 295 ms
コンパイル使用メモリ 86,824 KB
実行使用メモリ 127,792 KB
最終ジャッジ日時 2023-09-17 17:01:52
合計ジャッジ時間 10,723 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,348 KB
testcase_01 AC 72 ms
71,592 KB
testcase_02 AC 82 ms
75,896 KB
testcase_03 AC 82 ms
75,876 KB
testcase_04 AC 84 ms
75,880 KB
testcase_05 AC 83 ms
75,940 KB
testcase_06 AC 83 ms
75,900 KB
testcase_07 AC 84 ms
75,904 KB
testcase_08 AC 83 ms
75,784 KB
testcase_09 AC 83 ms
75,880 KB
testcase_10 AC 77 ms
71,104 KB
testcase_11 AC 83 ms
75,948 KB
testcase_12 AC 84 ms
75,976 KB
testcase_13 AC 334 ms
98,944 KB
testcase_14 AC 373 ms
112,784 KB
testcase_15 AC 321 ms
98,540 KB
testcase_16 AC 308 ms
98,220 KB
testcase_17 AC 259 ms
101,036 KB
testcase_18 AC 398 ms
113,592 KB
testcase_19 AC 369 ms
107,616 KB
testcase_20 AC 321 ms
98,376 KB
testcase_21 AC 284 ms
94,912 KB
testcase_22 AC 341 ms
102,088 KB
testcase_23 AC 75 ms
71,184 KB
testcase_24 AC 74 ms
71,264 KB
testcase_25 AC 422 ms
127,400 KB
testcase_26 AC 431 ms
127,676 KB
testcase_27 AC 418 ms
127,792 KB
testcase_28 AC 423 ms
110,064 KB
testcase_29 AC 412 ms
109,844 KB
testcase_30 AC 543 ms
126,596 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

H,W,N,M = map(int,input().split())

dat = [[0] * (W + 2) for _ in range(H+2)]
slime = []
for _ in range(N):
    t,u,l,r,a = map(int,input().split())
    slime.append((t,u,l,r,a))
for _ in range(M):
    x,y,b,c = map(int,input().split())
    dat[max(0,x-b)][max(0,y-b)] += c
    dat[min(H,x+b)+1][max(0,y-b)] -= c
    dat[max(0,x-b)][min(W,y+b)+1] -= c
    dat[min(H,x+b)+1][min(W,y+b)+1] += c
for h in range(H+1):
    for w in range(W+1):
        dat[h][w+1] += dat[h][w]
for w in range(W+1):
    for h in range(H+1):
        dat[h+1][w] += dat[h][w]
for h in range(H+1):
    for w in range(W+1):
        dat[h][w+1] += dat[h][w]
for w in range(W+1):
    for h in range(H+1):
        dat[h+1][w] += dat[h][w]
ans = 0
for t,u,l,r,a in slime:
    damage = dat[u][r] + dat[t-1][l-1] - dat[u][l-1] - dat[t-1][r]
    if damage < a:ans += 1
print(ans)
0