結果

問題 No.1490 スライムと爆弾
ユーザー 👑 NachiaNachia
提出日時 2021-04-23 21:28:51
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,073 bytes
コンパイル時間 644 ms
コンパイル使用メモリ 78,368 KB
実行使用メモリ 36,448 KB
最終ジャッジ日時 2023-09-17 11:44:13
合計ジャッジ時間 6,360 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 24 ms
34,824 KB
testcase_01 AC 24 ms
34,712 KB
testcase_02 AC 24 ms
34,752 KB
testcase_03 AC 23 ms
34,712 KB
testcase_04 WA -
testcase_05 AC 24 ms
34,740 KB
testcase_06 AC 24 ms
34,712 KB
testcase_07 AC 23 ms
34,716 KB
testcase_08 AC 24 ms
34,900 KB
testcase_09 WA -
testcase_10 AC 24 ms
34,704 KB
testcase_11 AC 24 ms
34,768 KB
testcase_12 AC 24 ms
34,812 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 23 ms
34,892 KB
testcase_25 AC 72 ms
36,044 KB
testcase_26 WA -
testcase_27 AC 73 ms
36,428 KB
testcase_28 AC 64 ms
34,748 KB
testcase_29 AC 67 ms
34,796 KB
testcase_30 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i=0; i<(n); i++)

struct Slime{ int l,t,r,b,a; };

int H,W;
int N,M;

vector<Slime> A;
ll X[2001][2001] = {};

int main(){
  scanf("%d%d",&H,&W);
  scanf("%d%d",&N,&M);
  A.resize(N);
  rep(i,N){
    int l,t,r,b,a; scanf("%d%d%d%d%d",&t,&b,&l,&r,&a); l--; t--;
    A[i] = {l,t,r,b,a};
  }
  rep(i,M){
    int x,y,w,a; scanf("%d%d%d%d",&x,&y,&w,&a);
    int l = max(0,x-w);
    int r = min(H,x+1+w);
    int t = max(0,y-w);
    int b = min(W,y+1+w);
    X[l][t] += a;
    X[l][b] -= a;
    X[r][t] -= a;
    X[r][b] += a;
  }
  rep(i,2000) rep(j,2001) X[i+1][j] += X[i][j];
  rep(i,2001) rep(j,2000) X[i][j+1] += X[i][j];
  rep(i,2000) rep(j,2001) X[i+1][j] += X[i][j];
  rep(i,2001) rep(j,2000) X[i][j+1] += X[i][j];
  int ans = 0;
  for(auto s : A){
    ll damage = 0;
    damage += X[s.b][s.r];
    damage -= X[s.b][s.l];
    damage -= X[s.t][s.r];
    damage += X[s.t][s.l];
    if(damage < s.a) ans++;
  }
  printf("%d\n",ans);
  return 0;
}
0