結果

問題 No.1490 スライムと爆弾
ユーザー んんんんんん
提出日時 2023-01-02 13:23:34
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,342 bytes
コンパイル時間 2,257 ms
コンパイル使用メモリ 208,380 KB
実行使用メモリ 40,276 KB
最終ジャッジ日時 2024-05-05 06:17:04
合計ジャッジ時間 5,748 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
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 AC 1 ms
5,376 KB
testcase_24 AC 2 ms
5,376 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 159 ms
34,688 KB
testcase_29 AC 159 ms
34,816 KB
testcase_30 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
    int H, W, N, M;
    cin >> H >> W >> N >> M;
    vector<vector<int>> fi(H+1, vector<int>(W+1));
    vector<vector<int>> query;
    for (int i = 0; i < N; i++) {
        int T, U, L, R, A;
        cin >> T >> U >> L >> R >> A;
        T--; L--;

        vector<int> a = {T, U, L, R, A};
        query.emplace_back(a);
    }

    for (int i = 0; i < M; i++) {
        int X, Y, B, C;
        cin >> X >> Y >> B >> C;
        int T = max(0, X-B-1), U = min(H, X+B);
        int L = max(0, Y-B-1), R = min(W, Y+B);
        fi[T][L] += C;
        fi[T][R] -= C;
        fi[U][L] -= C;
        fi[U][R] += C;
    }

    for (int i = 0; i <= H; i++) {
        for (int j = 1; j <= W; j++) {
            fi[i][j] += fi[i][j-1];
        }
    }
    for (int j = 0; j <= W; j++) {
        for (int i = 1; i <= H; i++) {
            fi[i][j] += fi[i-1][j];
        }
    }
    
    vector<vector<int>> rui(H+1, vector<int>(W+1));
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            rui[i+1][j+1] = rui[i+1][j] + rui[i][j+1] - rui[i][j] + fi[i][j];
        }
    }

    int ans = 0;
    for (auto q : query) {
        int a = rui[q[0]][q[2]] + rui[q[1]][q[3]] - rui[q[0]][q[3]] - rui[q[1]][q[2]];
        ans += q[4] - a > 0;
    }
    cout << ans << endl;
}
0