結果

問題 No.1490 スライムと爆弾
ユーザー たたき@競プロたたき@競プロ
提出日時 2023-09-04 03:23:21
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,243 bytes
コンパイル時間 6,737 ms
コンパイル使用メモリ 307,508 KB
実行使用メモリ 72,756 KB
最終ジャッジ日時 2023-09-04 03:23:34
合計ジャッジ時間 12,430 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,384 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 91 ms
34,952 KB
testcase_16 AC 120 ms
25,208 KB
testcase_17 AC 80 ms
40,544 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 67 ms
30,788 KB
testcase_22 AC 151 ms
28,880 KB
testcase_23 WA -
testcase_24 AC 2 ms
4,376 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 155 ms
65,572 KB
testcase_29 AC 169 ms
65,576 KB
testcase_30 WA -
権限があれば一括ダウンロードができます

ソースコード

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; 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