結果

問題 No.1490 スライムと爆弾
ユーザー ぷらぷら
提出日時 2021-05-11 15:49:54
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,357 bytes
コンパイル時間 2,411 ms
コンパイル使用メモリ 209,176 KB
実行使用メモリ 36,544 KB
最終ジャッジ日時 2023-10-21 19:39:44
合計ジャッジ時間 9,144 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 2 ms
4,348 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 2 ms
4,348 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 WA -
testcase_24 AC 2 ms
4,348 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 246 ms
34,696 KB
testcase_29 AC 246 ms
34,696 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<int>T(N),U(N),L(N),R(N),A(N);
    for(int i = 0; i < N; i++) {
        cin >> T[i] >> U[i] >> L[i] >> R[i] >> A[i];
        T[i]--; 
        U[i]--;
        L[i]--;
        R[i]--;
    }
    vector<vector<long long>>sum(H+1,vector<long long>(W+1));
    for(int i = 0; i < M; i++) {
        int X,Y,B,C;
        cin >> X >> Y >> B >> C;
        X--;
        Y--;
        sum[max(0,X-B)][max(0,Y-B)] += C;
        sum[max(0,X-B)][min(W,Y+B+1)] -= C;
        sum[min(H,X+B+1)][max(0,Y-B)] -= C;
        sum[min(H,X+B+1)][min(W,Y+B+1)] += C;
    }
    for(int i = 0; i <= H; i++) {
        for(int j = 0; j < W; j++) {
            sum[i][j+1] += sum[i][j];
        }
    }
    for(int i = 0; i <= W; i++) {
        for(int j = 0; j < H; j++) {
            sum[j+1][i] += sum[j][i];
        }
    }
    for(int i = 0; i <= H; i++) {
        for(int j = 0; j < W; j++) {
            sum[i][j+1] += sum[i][j];
        }
    }
    for(int i = 0; i <= W; i++) {
        for(int j = 0; j < H; j++) {
            sum[j+1][i] += sum[j][i];
        }
    }
    int ans = 0;
    for(int i = 0; i < N; i++) {
        if(A[i] > sum[U[i]][R[i]]+sum[T[i]][L[i]]-sum[U[i]][L[i]]-sum[T[i]][R[i]]) {
            ans++;
        }
    }
    cout << ans << endl;
}
0