結果

問題 No.1490 スライムと爆弾
ユーザー Navier_BoltzmannNavier_Boltzmann
提出日時 2022-09-04 11:10:35
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,419 bytes
コンパイル時間 167 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 187,392 KB
最終ジャッジ日時 2024-04-29 10:22:22
合計ジャッジ時間 10,273 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 50 ms
55,936 KB
testcase_01 AC 49 ms
55,936 KB
testcase_02 AC 55 ms
62,720 KB
testcase_03 AC 59 ms
62,336 KB
testcase_04 AC 57 ms
63,232 KB
testcase_05 AC 55 ms
62,848 KB
testcase_06 AC 54 ms
62,208 KB
testcase_07 AC 56 ms
62,656 KB
testcase_08 AC 55 ms
62,464 KB
testcase_09 AC 56 ms
63,232 KB
testcase_10 AC 55 ms
62,720 KB
testcase_11 AC 57 ms
64,256 KB
testcase_12 AC 59 ms
64,896 KB
testcase_13 AC 435 ms
118,288 KB
testcase_14 WA -
testcase_15 AC 411 ms
127,792 KB
testcase_16 AC 359 ms
113,180 KB
testcase_17 AC 287 ms
135,472 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 49 ms
55,808 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 597 ms
167,888 KB
testcase_29 AC 516 ms
160,040 KB
testcase_30 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import *
from itertools import *
from functools import *
from heapq import *
import sys,math
input = sys.stdin.readline

H,W,N,M = map(int,input().split())
class cs_2d():
    
    def __init__(self,x):
        
            n = len(x)
            m = len(x[0])
            tmp = [[0]*(m+1) for _ in range(n+1)]
            for i in range(n):
                tmp[i+1][1:] = x[i]
                for j in range(m):
                    tmp[i+1][j+1] += tmp[i+1][j]
            
            for j in range(m):
                for i in range(n):
                    tmp[i+1][j+1] += tmp[i][j+1]
                    
            self.S = tmp
    
    def query(self,ix,jx,iy,jy):
        ##[ix,jx)×[iy,jy)
        
        T = self.S
        
        return T[jx][jy] - T[jx][iy] - T[ix][jy] + T[ix][iy]
        
        
X = [[0]*(W+2) for _ in range(H+2)]
G = [tuple(map(int,input().split())) for _ in range(N)]
fx = lambda x : min(max(0,x),H)
fy = lambda x : min(max(0,x),W)
for _ in range(M):
    x,y,b,c = map(int,input().split())
    X[fx(x-b)][fy(y-b)] += c
    X[fx(x+b)+1][fy(y+b)+1] += c
    X[fx(x-b)][fy(y+b)+1] -= c
    X[fx(x+b)+1][fy(y-b)] -= c
TX =  cs_2d(X).S
for i in range(H+2):
    TX[i][W+1]=0
    TX[i][0]=0
for i in range(W+2):
    TX[H+1][i]=0
    TX[0][i]=0
SX = cs_2d(TX)
ans = N
for t,u,l,r,a in G:
    
    if SX.query(fx(t),fx(u)+1,fy(l),fy(r)+1)>=a:
        ans -= 1
print(ans)
0