結果

問題 No.1490 スライムと爆弾
ユーザー KudeKude
提出日時 2021-04-23 22:49:29
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,734 bytes
コンパイル時間 5,090 ms
コンパイル使用メモリ 263,956 KB
実行使用メモリ 68,028 KB
最終ジャッジ日時 2023-09-17 12:51:20
合計ジャッジ時間 7,875 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 1 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,376 KB
testcase_13 AC 76 ms
31,344 KB
testcase_14 WA -
testcase_15 AC 70 ms
33,980 KB
testcase_16 AC 55 ms
21,848 KB
testcase_17 AC 57 ms
39,260 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 2 ms
4,376 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 161 ms
65,912 KB
testcase_29 AC 163 ms
65,860 KB
testcase_30 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#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';
}
0