結果

問題 No.1490 スライムと爆弾
ユーザー kwm_tkwm_t
提出日時 2021-04-25 01:34:21
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,790 bytes
コンパイル時間 1,497 ms
コンパイル使用メモリ 169,036 KB
実行使用メモリ 68,028 KB
最終ジャッジ日時 2023-09-17 13:56:46
合計ジャッジ時間 5,225 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,408 KB
testcase_01 AC 2 ms
5,408 KB
testcase_02 AC 3 ms
7,948 KB
testcase_03 AC 3 ms
5,652 KB
testcase_04 WA -
testcase_05 AC 2 ms
5,912 KB
testcase_06 WA -
testcase_07 AC 2 ms
5,664 KB
testcase_08 AC 3 ms
5,808 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,380 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 98 ms
66,096 KB
testcase_29 AC 101 ms
66,024 KB
testcase_30 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
//#include "atcoder/all"
using namespace std;
//using namespace atcoder;
//using mint = modint1000000007;
//const int mod = 1000000007;
//using mint = modint998244353;
//const int mod = 998244353;
//const int INF = 1e9;
//const long long LINF = 1e18;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep2(i,l,r)for(int i=(l);i<(r);++i)
#define rrep(i, n) for (int i = (n-1); i >= 0; --i)
#define rrep2(i,l,r)for(int i=(r-1);i>=(l);--i)
#define all(x) (x).begin(),(x).end()
#define allR(x) (x).rbegin(),(x).rend()
#define endl "\n"
long long imos[2002][2002];
long long sum[2002][2002];
int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int h, w, n, m; cin >> h >> w >> n >> m;
	vector<int>t(n), u(n), l(n), r(n), a(n);
	rep(i, n) {
		cin >> t[i] >> u[i] >> l[i] >> r[i] >> a[i];
	}
	rep(i, m) {
		int x, y, b, c; cin >> x >> y >> b >> c;
		imos[max(1, x - b)][max(1, y - b)] += c;
		imos[min(h, x + b + 1)][min(w, y + b + 1)] += c;
		imos[max(1, x - b)][min(w, y + b + 1)] -= c;
		imos[min(h, x + b + 1)][max(1, y - b)] -= c;
	}
	rep2(i, 1, h + 1) {
		rep2(j, 1, w + 1) {
			imos[i][j + 1] += imos[i][j];
		}
	}
	rep2(i, 1, w + 1) {
		rep2(j, 1, h + 1) {
			imos[j + 1][i] += imos[j][i];
		}
	}
	rep2(i, 1, h + 1) {
		rep2(j, 1, w + 1) {
			sum[i][j] = sum[i - 1][j] + sum[i][j - 1] - sum[i - 1][j - 1] + imos[i][j];
		}
	}
	if (false) {
		rep(i, h + 1) {
			rep(j, w + 1) {
				cout << imos[i][j] << " ";
			}
			cout << endl;
		}
		cout << endl;
		rep(i, h + 1) {
			rep(j, w + 1) {
				cout << sum[i][j] << " ";
			}
			cout << endl;
		}
	}
	int ans = 0;
	rep(i, n) {
		int att = sum[u[i]][r[i]] - sum[u[i]][l[i] - 1] - sum[t[i] - 1][r[i]] + sum[t[i] - 1][l[i] - 1];
		a[i] -= att;
		if (a[i] > 0) ans++;
	}
	cout << ans << endl;
	return 0;
}
0