結果
| 問題 |
No.1490 スライムと爆弾
|
| コンテスト | |
| ユーザー |
沙耶花
|
| 提出日時 | 2021-04-23 21:51:15 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 312 ms / 2,000 ms |
| コード長 | 1,143 bytes |
| コンパイル時間 | 4,372 ms |
| コンパイル使用メモリ | 252,684 KB |
| 最終ジャッジ日時 | 2025-01-20 23:47:16 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 28 |
ソースコード
#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;
}
沙耶花