結果

問題 No.1490 スライムと爆弾
ユーザー Ricky_ponRicky_pon
提出日時 2021-04-23 23:14:55
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 2,493 bytes
コンパイル時間 1,949 ms
コンパイル使用メモリ 199,596 KB
実行使用メモリ 37,164 KB
最終ジャッジ日時 2023-09-17 13:06:21
合計ジャッジ時間 5,256 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
5,684 KB
testcase_03 AC 2 ms
5,656 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 2 ms
5,612 KB
testcase_08 AC 2 ms
5,568 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 1 ms
4,380 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 140 ms
35,068 KB
testcase_29 AC 141 ms
35,088 KB
testcase_30 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

#define For(i, a, b) for (int i = (int)(a); i < (int)(b); ++i)
#define rFor(i, a, b) for (int i = (int)(a)-1; i >= (int)(b); --i)
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
#define fi first
#define se second

using namespace std;

typedef long long lint;
typedef unsigned long long ulint;
typedef pair<int, int> pii;
typedef pair<lint, lint> pll;

template <class T>
bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <class T>
bool chmin(T &a, const T &b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

template <class T>
T div_floor(T a, T b) {
    if (b < 0) a *= -1, b *= -1;
    return a >= 0 ? a / b : (a + 1) / b - 1;
}
template <class T>
T div_ceil(T a, T b) {
    if (b < 0) a *= -1, b *= -1;
    return a > 0 ? (a - 1) / b + 1 : a / b;
}

template <typename T>
struct coord_comp {
    vector<T> v;
    bool sorted = false;

    coord_comp() {}

    int size() { return v.size(); }

    void add(T x) { v.push_back(x); }

    void build() {
        sort(v.begin(), v.end());
        v.erase(unique(v.begin(), v.end()), v.end());
        sorted = true;
    }

    int get_idx(T x) {
        assert(sorted);
        return lower_bound(v.begin(), v.end(), x) - v.begin();
    }

    T &operator[](int i) { return v[i]; }
};

constexpr lint mod = 1000000007;
constexpr lint INF = mod * mod;
constexpr int MAX = 100010;

int h, w, n, m;
lint grid[2010][2010];
int t[MAX], u[MAX], l[MAX], r[MAX], a[MAX];

int main() {
    scanf("%d%d%d%d", &h, &w, &n, &m);
    rep(i, n) {
        scanf("%d%d%d%d%d", &t[i], &u[i], &l[i], &r[i], &a[i]);
        --t[i];
        --l[i];
    }
    rep(i, m) {
        int x, y, b, c;
        scanf("%d%d%d%d", &x, &y, &b, &c);
        grid[max(0, x - b)][max(0, y - b)] += c;
        grid[max(0, x - b)][min(w, y + b + 1)] -= c;
        grid[min(h, x + b + 1)][max(0, y - b)] -= c;
        grid[min(h, x + b + 1)][min(w, y + b + 1)] += c;
    }
    rep(i, h + 1) rep(j, w + 1) grid[i][j + 1] += grid[i][j];
    rep(j, w + 1) rep(i, h + 1) grid[i + 1][j] += grid[i][j];
    rep(i, h + 1) rep(j, w + 1) grid[i][j + 1] += grid[i][j];
    rep(j, w + 1) rep(i, h + 1) grid[i + 1][j] += grid[i][j];

    int ans = n;
    rep(i, n) {
        int num = grid[u[i]][r[i]] - grid[u[i]][l[i]] - grid[t[i]][r[i]] +
                  grid[t[i]][l[i]];
        ans -= (a[i] <= num);
    }
    printf("%d\n", ans);
}
0