結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 53 ms
55,680 KB
testcase_01 AC 53 ms
55,680 KB
testcase_02 AC 62 ms
62,080 KB
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 WA -
testcase_24 AC 52 ms
55,296 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 618 ms
167,424 KB
testcase_29 AC 536 ms
160,896 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]*(H+2) for _ in range(W+2)]
G = [tuple(map(int,input().split())) for _ in range(N)]
fx = lambda x : min(max(0,x),H+1)
fy = lambda x : min(max(0,x),W+1)
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
    
SX = cs_2d(cs_2d(X).S)
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