結果

問題 No.1490 スライムと爆弾
ユーザー 沙耶花沙耶花
提出日時 2021-04-23 21:51:15
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 271 ms / 2,000 ms
コード長 1,143 bytes
コンパイル時間 4,249 ms
コンパイル使用メモリ 262,720 KB
実行使用メモリ 38,476 KB
最終ジャッジ日時 2023-09-17 12:05:51
合計ジャッジ時間 8,030 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 118 ms
18,460 KB
testcase_14 AC 145 ms
24,596 KB
testcase_15 AC 75 ms
19,140 KB
testcase_16 AC 108 ms
14,120 KB
testcase_17 AC 63 ms
22,100 KB
testcase_18 AC 146 ms
24,336 KB
testcase_19 AC 129 ms
22,064 KB
testcase_20 AC 92 ms
18,204 KB
testcase_21 AC 55 ms
17,020 KB
testcase_22 AC 127 ms
16,292 KB
testcase_23 AC 2 ms
4,376 KB
testcase_24 AC 2 ms
4,380 KB
testcase_25 AC 175 ms
38,476 KB
testcase_26 AC 175 ms
38,376 KB
testcase_27 AC 175 ms
38,388 KB
testcase_28 AC 128 ms
34,564 KB
testcase_29 AC 131 ms
34,576 KB
testcase_30 AC 271 ms
38,452 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <atcoder/all>
#include <bits/stdc++.h>
using namespace std;
using namespace atcoder;
using mint = modint998244353;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf 1000000000
int main(){
	
	int H,W,N,M;
	cin>>H>>W>>N>>M;
	
	vector imos(H+1,vector<long long>(W+1,0LL));
	
	vector<long long> a(N),b(N),c(N),d(N),hp(N);
	rep(i,N){
		cin>>a[i]>>b[i]>>c[i]>>d[i]>>hp[i];
	}
	
	rep(i,M){
		int x,y,z,w;
		cin>>x>>y>>z>>w;
		
		int A = max(1,x-z);
		int B = min(H,x+z);
		int C = max(1,y-z);
		int D = min(W,y+z);
		imos[B][D] += w;
		imos[B][C-1] -= w;
		imos[A-1][D] -= w;
		imos[A-1][C-1] += w;
	}
	
	
	
	for(int i=H-1;i>=0;i--){
		rep(j,W+1){
			imos[i][j] += imos[i+1][j];
		}
	}
	rep(i,H+1){
		for(int j=W-1;j>=0;j--){
			imos[i][j] += imos[i][j+1];
		}
	}
	
	
	rep(i,H){
		rep(j,W+1){
			imos[i+1][j] += imos[i][j];
		}
	}
	
	rep(i,H+1){
		rep(j,W){
			imos[i][j+1] += imos[i][j];
		}
	}
	int ans = N;
	rep(i,N){
		long long t = 0LL;
		t += imos[b[i]][d[i]];
		t -= imos[b[i]][c[i]-1];
		t -= imos[a[i]-1][d[i]];
		t += imos[a[i]-1][c[i]-1];
		if(t >= hp[i])ans--;
	}
	
	cout<<ans<<endl;
	
    return 0;
}
0