結果

問題 No.1490 スライムと爆弾
ユーザー uzzyuzzy
提出日時 2021-04-23 22:53:08
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 178 ms / 2,000 ms
コード長 1,551 bytes
コンパイル時間 2,388 ms
コンパイル使用メモリ 184,316 KB
実行使用メモリ 36,744 KB
最終ジャッジ日時 2023-09-17 12:53:24
合計ジャッジ時間 5,684 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 10 ms
34,792 KB
testcase_01 AC 10 ms
36,076 KB
testcase_02 AC 10 ms
34,672 KB
testcase_03 AC 10 ms
35,708 KB
testcase_04 AC 10 ms
36,604 KB
testcase_05 AC 10 ms
34,716 KB
testcase_06 AC 10 ms
35,408 KB
testcase_07 AC 10 ms
34,788 KB
testcase_08 AC 10 ms
35,432 KB
testcase_09 AC 11 ms
34,672 KB
testcase_10 AC 10 ms
35,396 KB
testcase_11 AC 11 ms
36,060 KB
testcase_12 AC 10 ms
36,060 KB
testcase_13 AC 71 ms
35,936 KB
testcase_14 AC 89 ms
36,744 KB
testcase_15 AC 62 ms
35,900 KB
testcase_16 AC 56 ms
36,124 KB
testcase_17 AC 51 ms
36,488 KB
testcase_18 AC 85 ms
36,544 KB
testcase_19 AC 86 ms
36,104 KB
testcase_20 AC 68 ms
36,092 KB
testcase_21 AC 53 ms
35,436 KB
testcase_22 AC 67 ms
36,448 KB
testcase_23 AC 10 ms
34,824 KB
testcase_24 AC 10 ms
35,972 KB
testcase_25 AC 137 ms
36,712 KB
testcase_26 AC 138 ms
36,656 KB
testcase_27 AC 138 ms
36,744 KB
testcase_28 AC 127 ms
34,676 KB
testcase_29 AC 130 ms
35,164 KB
testcase_30 AC 178 ms
36,648 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC optimize ("O2")
#pragma GCC target ("avx2")
#include<bits/stdc++.h>
//#include<atcoder/all>
//using namespace atcoder;

using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please


int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);


	int H, W, N, M;
	cin >> H >> W >> N >> M;

	int T[100000], U[100000], L[100000], R[100000], A[100000];
	rep(i, N) {
		cin >> T[i] >> U[i] >> L[i] >> R[i] >> A[i];
	}

	ll HW[2002][2002] = {};
	rep(i, M) {
		int x, y, b, c;
		cin >> x >> y >> b >> c;

		int x0 = max(1, x - b);
		int x1 = min(H + 1, x + 1 + b);
		int y0 = max(1, y - b);
		int y1 = min(W + 1, y + 1 + b);
		HW[x0][y0] += c;
		HW[x0][y1] -= c;
		HW[x1][y0] -= c;
		HW[x1][y1] += c;
	}
	rep1(i, H + 1) rep1(j, W) {
		HW[i][j + 1] += HW[i][j];
	}
	rep1(j, W + 1) rep1(i, H) {
		HW[i + 1][j] += HW[i][j];
	}
	rep1(i, H + 1) rep1(j, W) {
		HW[i][j + 1] += HW[i][j];
	}
	rep1(j, W + 1) rep1(i, H) {
		HW[i + 1][j] += HW[i][j];
	}

	int kotae = N;
	rep(i, N) {
		ll kari = 0;
		kari += HW[U[i]][R[i]];
		kari -= HW[U[i]][L[i] - 1];
		kari -= HW[T[i] - 1][R[i]];
		kari += HW[T[i] - 1][L[i] - 1];
		if (kari >= A[i]) kotae--;
	}
	co(kotae);


	Would you please return 0;
}
0