結果
| 問題 |
No.1490 スライムと爆弾
|
| コンテスト | |
| ユーザー |
hitonanode
|
| 提出日時 | 2021-04-23 23:59:23 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 253 ms / 2,000 ms |
| コード長 | 1,320 bytes |
| コンパイル時間 | 2,245 ms |
| コンパイル使用メモリ | 205,264 KB |
| 最終ジャッジ日時 | 2025-01-21 00:30:25 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 28 |
ソースコード
#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';
}
hitonanode