結果

問題 No.1490 スライムと爆弾
ユーザー たたき@競プロたたき@競プロ
提出日時 2023-09-04 03:32:58
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 343 ms / 2,000 ms
コード長 1,245 bytes
コンパイル時間 7,123 ms
コンパイル使用メモリ 310,148 KB
実行使用メモリ 72,844 KB
最終ジャッジ日時 2023-09-04 03:33:09
合計ジャッジ時間 10,464 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 137 ms
33,132 KB
testcase_14 AC 173 ms
45,096 KB
testcase_15 AC 94 ms
35,096 KB
testcase_16 AC 121 ms
24,980 KB
testcase_17 AC 83 ms
40,684 KB
testcase_18 AC 173 ms
44,752 KB
testcase_19 AC 149 ms
40,572 KB
testcase_20 AC 109 ms
32,864 KB
testcase_21 AC 69 ms
30,824 KB
testcase_22 AC 145 ms
29,004 KB
testcase_23 AC 2 ms
4,376 KB
testcase_24 AC 2 ms
4,376 KB
testcase_25 AC 244 ms
72,788 KB
testcase_26 AC 219 ms
72,760 KB
testcase_27 AC 218 ms
72,760 KB
testcase_28 AC 159 ms
65,664 KB
testcase_29 AC 161 ms
65,636 KB
testcase_30 AC 343 ms
72,844 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
using mint=modint998244353; //1000000007;
using ll=long long;
using pp=pair<int,int>;
#define sr string 
#define vc vector
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define pb push_back
#define all(v) v.begin(),v.end()
#define pque priority_queue
#define bpc(a) __builtin_popcount(a)
int main(){
  int h,w,n,m;cin>>h>>w>>n>>m;
  vc sl(n,vc<ll>(5)); rep(i,n)rep(j,5)cin>>sl[i][j];
  vc v(h,vc<ll>(w,0));
  rep(z,m){
    int x,y,b,c;cin>>x>>y>>b>>c;
    x--;y--;
    int nx=x-b,ny=y-b;
    nx=max(nx,0); ny=max(ny,0);
    v[nx][ny]+=c;
    ny=y+b+1;
    if(ny<w)v[nx][ny]-=c;
    nx=x+b+1; if(nx>=h)continue;
    ny=y-b; ny=max(ny,0);
    v[nx][ny]-=c;
    ny=y+b+1;
    if(ny<w)v[nx][ny]+=c;
  }
 
  rep(i,h)rep(j,w-1)v[i][j+1]+=v[i][j];
  rep(i,h-1)rep(j,w)v[i+1][j]+=v[i][j];
  vc vs(h+1,vc<ll>(w+1,0));
  rep(i,h)rep(j,w)vs[i+1][j+1]=v[i][j];
  rep(i,h+1)rep(j,w)vs[i][j+1]+=vs[i][j];
  rep(i,h)rep(j,w+1)vs[i+1][j]+=vs[i][j];
  int ans=0;
  rep(i,n){
    auto t=sl[i];
    ll a=t[0],b=t[1],c=t[2],d=t[3],h=t[4];
    a--;c--;
    h-=vs[b][d]-vs[a][d]-vs[b][c]+vs[a][c];
    if(h>0)ans++;
  }
  cout<<ans<<"\n";
 
}
0