結果

問題 No.1490 スライムと爆弾
ユーザー 👑 hitonanodehitonanode
提出日時 2021-04-23 23:59:23
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 241 ms / 2,000 ms
コード長 1,320 bytes
コンパイル時間 2,118 ms
コンパイル使用メモリ 211,352 KB
実行使用メモリ 35,824 KB
最終ジャッジ日時 2023-09-17 13:15:25
合計ジャッジ時間 5,692 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 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,384 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 77 ms
17,160 KB
testcase_14 AC 95 ms
22,108 KB
testcase_15 AC 72 ms
18,560 KB
testcase_16 AC 57 ms
12,740 KB
testcase_17 AC 62 ms
21,184 KB
testcase_18 AC 94 ms
22,028 KB
testcase_19 AC 106 ms
20,172 KB
testcase_20 AC 84 ms
17,232 KB
testcase_21 AC 65 ms
16,436 KB
testcase_22 AC 67 ms
14,332 KB
testcase_23 AC 2 ms
4,380 KB
testcase_24 AC 2 ms
4,376 KB
testcase_25 AC 198 ms
35,692 KB
testcase_26 AC 196 ms
35,744 KB
testcase_27 AC 199 ms
35,824 KB
testcase_28 AC 186 ms
34,484 KB
testcase_29 AC 191 ms
34,392 KB
testcase_30 AC 241 ms
35,764 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using lint = long long;
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define REP(i, n) FOR(i,0,n)

int main() {
    cin.tie(nullptr), ios::sync_with_stdio(false);
    short H, W;
    int N, M;
    cin >> H >> W >> N >> M;
    vector<tuple<short, short, short, short, int>> tulra;
    while (N--) {
        short t, u, l, r;
        int a;
        cin >> t >> u >> l >> r >> a;
        t--;
        l--;
        tulra.emplace_back(t, u, l, r, a);
    }
    vector cum(H + 2, vector<lint>(W + 2));
    while (M--) {
        short x, y, b;
        int c;
        cin >> x >> y >> b >> c;
        short t = max(1, x - b) - 1;
        short u = min<short>(H, x + b);
        short l = max(1, y - b) - 1;
        short r = min<short>(W, y + b);
        cum[t + 1][l + 1] += c;
        cum[t + 1][r + 1] -= c;
        cum[u + 1][l + 1] -= c;
        cum[u + 1][r + 1] += c;
    }
    REP(_, 2) {
        REP(i, cum.size()) REP(j, cum[i].size() - 1) cum[i][j + 1] += cum[i][j];
        REP(j, cum[0].size()) REP(i, cum.size() - 1) cum[i + 1][j] += cum[i][j];
    }
    int ret = 0;
    for (auto [t, u, l, r, a] : tulra) {
        long long s = cum[t][l] - cum[t][r] - cum[u][l] + cum[u][r];
        if (s < a) ret++;
    }
    cout << ret << '\n';
}
0