結果
| 問題 |
No.1490 スライムと爆弾
|
| コンテスト | |
| ユーザー |
Kude
|
| 提出日時 | 2021-04-23 22:45:56 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,711 bytes |
| コンパイル時間 | 4,332 ms |
| コンパイル使用メモリ | 253,636 KB |
| 最終ジャッジ日時 | 2025-01-21 00:15:16 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 8 WA * 20 |
ソースコード
#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 t, u, l, r, a;
};
vector<Slime> slimes(n);
for(auto& slm: slimes) cin >> slm.t >> slm.u >> slm.l >> slm.r >> slm.a, slm.t--, 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 rm = slm.a - (sm[slm.u][slm.r] - sm[slm.t][slm.r] - sm[slm.u][slm.l] + sm[slm.t][slm.l]);
ans += rm > 0;
}
cout << ans << '\n';
}
Kude