Submission #69078841


Source Code Expand

#include<bits/stdc++.h>
using namespace std;
//#define int long long

int n, q;
bool a[505][505];
int f[505][505];

signed main() {

	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);

	cin >> n >> q;
	for (int i = 1; i <= n; i++)
		for (int k = 1; k <= n; k++) {
			char f;
			cin >> f;
			a[i][k] = (f == '.');
		}
	for (int i = 1; i < n; i++)
		for (int k = 1; k < n; k++) {
			if (a[i][k] && a[i + 1][k] && a[i][k + 1] && a[i + 1][k + 1])
				f[i][k] = 1;
			f[i][k] += f[i][k - 1];
		}
	while (q--) {
		int u, d, l, r, ans = 0;
		cin >> u >> d >> l >> r;
		for (int i = u; i < d; i++)
			ans += f[i][r - 1] - f[i][l - 1];
		cout << ans << endl;
	}

	return 0;
}

Submission Info

Submission Time
Task A - 2x2 Erasing
User KDL_ANIPLEX
Language C++ 20 (gcc 12.2)
Score 400
Code Size 710 Byte
Status AC
Exec Time 380 ms
Memory 4880 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 400 / 400
Status
AC × 2
AC × 28
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt
All 00_sample_00.txt, 00_sample_01.txt, 01_handmade_00.txt, 01_handmade_01.txt, 01_handmade_02.txt, 01_handmade_03.txt, 01_handmade_04.txt, 02_random_00.txt, 02_random_01.txt, 02_random_02.txt, 02_random_03.txt, 02_random_04.txt, 02_random_05.txt, 02_random_06.txt, 02_random_07.txt, 02_random_08.txt, 02_random_09.txt, 02_random_10.txt, 02_random_11.txt, 02_random_12.txt, 02_random_13.txt, 02_random_14.txt, 02_random_15.txt, 02_random_16.txt, 02_random_17.txt, 02_random_18.txt, 02_random_19.txt, 02_random_20.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 1 ms 3512 KiB
00_sample_01.txt AC 1 ms 3476 KiB
01_handmade_00.txt AC 261 ms 3376 KiB
01_handmade_01.txt AC 379 ms 4724 KiB
01_handmade_02.txt AC 1 ms 3568 KiB
01_handmade_03.txt AC 334 ms 4692 KiB
01_handmade_04.txt AC 377 ms 4744 KiB
02_random_00.txt AC 319 ms 4384 KiB
02_random_01.txt AC 295 ms 3844 KiB
02_random_02.txt AC 331 ms 4648 KiB
02_random_03.txt AC 284 ms 3680 KiB
02_random_04.txt AC 282 ms 3556 KiB
02_random_05.txt AC 336 ms 4816 KiB
02_random_06.txt AC 336 ms 4692 KiB
02_random_07.txt AC 336 ms 4880 KiB
02_random_08.txt AC 336 ms 4688 KiB
02_random_09.txt AC 341 ms 4672 KiB
02_random_10.txt AC 378 ms 4688 KiB
02_random_11.txt AC 377 ms 4692 KiB
02_random_12.txt AC 379 ms 4796 KiB
02_random_13.txt AC 378 ms 4684 KiB
02_random_14.txt AC 378 ms 4672 KiB
02_random_15.txt AC 378 ms 4724 KiB
02_random_16.txt AC 380 ms 4728 KiB
02_random_17.txt AC 379 ms 4680 KiB
02_random_18.txt AC 378 ms 4668 KiB
02_random_19.txt AC 377 ms 4744 KiB
02_random_20.txt AC 301 ms 4696 KiB