結果

問題 No.1490 スライムと爆弾
ユーザー 👑 ygussanyygussany
提出日時 2021-04-23 22:32:46
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 152 ms / 2,000 ms
コード長 1,155 bytes
コンパイル時間 155 ms
コンパイル使用メモリ 30,436 KB
実行使用メモリ 35,164 KB
最終ジャッジ日時 2023-09-17 12:38:49
合計ジャッジ時間 3,122 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 9 ms
33,580 KB
testcase_01 AC 9 ms
33,212 KB
testcase_02 AC 9 ms
33,312 KB
testcase_03 AC 9 ms
33,508 KB
testcase_04 AC 10 ms
33,740 KB
testcase_05 AC 9 ms
33,464 KB
testcase_06 AC 9 ms
33,860 KB
testcase_07 AC 10 ms
34,412 KB
testcase_08 AC 9 ms
33,264 KB
testcase_09 AC 9 ms
34,316 KB
testcase_10 AC 9 ms
34,900 KB
testcase_11 AC 9 ms
33,592 KB
testcase_12 AC 9 ms
33,764 KB
testcase_13 AC 64 ms
33,900 KB
testcase_14 AC 74 ms
35,100 KB
testcase_15 AC 49 ms
34,804 KB
testcase_16 AC 53 ms
34,424 KB
testcase_17 AC 40 ms
33,980 KB
testcase_18 AC 73 ms
34,996 KB
testcase_19 AC 72 ms
34,996 KB
testcase_20 AC 56 ms
34,584 KB
testcase_21 AC 41 ms
33,836 KB
testcase_22 AC 63 ms
34,848 KB
testcase_23 AC 9 ms
33,248 KB
testcase_24 AC 10 ms
33,268 KB
testcase_25 AC 104 ms
35,164 KB
testcase_26 AC 105 ms
35,108 KB
testcase_27 AC 105 ms
34,992 KB
testcase_28 AC 95 ms
34,092 KB
testcase_29 AC 98 ms
34,864 KB
testcase_30 AC 152 ms
34,960 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>

int main()
{
	int i, j, t, u, l, r, H, W, N, M, T[100001], U[100001], L[100001], R[100001], A[100001], X, Y, B, C;
	long long bomb[2002][2002] = {}, tmp;
	scanf("%d %d %d %d", &H, &W, &N, &M);
	for (i = 1; i <= N; i++) scanf("%d %d %d %d %d", &(T[i]), &(U[i]), &(L[i]), &(R[i]), &(A[i]));
	for (i = 1; i <= M; i++) {
		scanf("%d %d %d %d", &X, &Y, &B, &C);
		t = X - B;
		if (t <= 0) t = 1;
		u = X + B;
		if (u > H) u = H;
		l = Y - B;
		if (l <= 0) l = 1;
		r = Y + B;
		if (r > W) r = W;
		bomb[t][l] += C;
		bomb[u+1][l] -= C;
		bomb[t][r+1] -= C;
		bomb[u+1][r+1] += C;
	}
	for (i = 1; i <= H; i++) {
		for (j = 1, tmp = 0; j <= W; j++) {
			tmp += bomb[i][j];
			bomb[i][j] = tmp;
		}
	}
	for (j = 1; j <= W; j++) {
		for (i = 1, tmp = 0; i <= H; i++) {
			tmp += bomb[i][j];
			bomb[i][j] = tmp;
		}
	}
	for (i = 1; i <= H; i++) for (j = 1; j <= W; j++) bomb[i][j] += bomb[i-1][j] + bomb[i][j-1] - bomb[i-1][j-1];
	
	int ans = 0;
	for (i = 1; i <= N; i++) {
		tmp = bomb[U[i]][R[i]] - bomb[U[i]][L[i]-1] - bomb[T[i]-1][R[i]] + bomb[T[i]-1][L[i]-1];
		if (tmp < A[i]) ans++;
	}
	printf("%d\n", ans);
	fflush(stdout);
	return 0;
}
0