結果
| 問題 | No.1490 スライムと爆弾 | 
| コンテスト | |
| ユーザー |  Kude | 
| 提出日時 | 2021-04-23 22:49:29 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 1,734 bytes | 
| コンパイル時間 | 6,074 ms | 
| コンパイル使用メモリ | 254,012 KB | 
| 最終ジャッジ日時 | 2025-01-21 00:16:45 | 
| ジャッジサーバーID (参考情報) | judge3 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 17 WA * 11 | 
ソースコード
#include<bits/stdc++.h>
#include<atcoder/all>
using namespace std;
using namespace atcoder;
#define rep(i,n)for (int i = 0; i < int(n); ++i)
#define rrep(i,n)for (int i = int(n)-1; i >= 0; --i)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
template<class T> void chmax(T& a, const T& b) {a = max(a, b);}
template<class T> void chmin(T& a, const T& b) {a = min(a, b);}
using ll = long long;
using P = pair<int,int>;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<ll>;
using VVL = vector<VL>;
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int h, w, n, m;
    cin >> h >> w >> n >> m;
    VVL s(h + 1, VL(w + 1));
    struct Slime {
        int u, d, l, r, a;
    };
    vector<Slime> slimes(n);
    for(auto& slm: slimes) cin >> slm.u >> slm.d >> slm.l >> slm.r >> slm.a, slm.u--, slm.l--;
    rep(_, m) {
        int x, y, b, c;
        cin >> x >> y >> b >> c;
        int u = max(0, x - b), d = min(x + b + 1, h), l = max(0, y - b), r = min(w, y + b + 1);
        s[u][l] += c;
        s[u][r] -= c;
        s[d][l] -= c;
        s[d][r] += c;
    }
    rep(i, h + 1) {
        ll now = 0;
        rep(j, w + 1) {
            now += s[i][j];
            s[i][j] = now;
        }
    }
    rep(j, w + 1) {
        ll now = 0;
        rep(i, h + 1) {
            now += s[i][j];
            s[i][j] = now;
        }
    }
    VVL sm(h + 1, VL(w + 1));
    rep(i, h) rep(j, w) sm[i+1][j+1] = s[i][j] + sm[i+1][j] + sm[i][j+1] - sm[i][j];
    int ans = 0;
    for(auto slm: slimes) {
        int u = slm.u, d = slm.d, l = slm.l, r = slm.r;
        ll rm = slm.a - (sm[d][r] - sm[u][r] - sm[d][l] + sm[u][l]);
        ans += rm > 0;
    }
    cout << ans << '\n';
}
            
            
            
        