Submission #68677281


Source Code Expand

n, q = map(int, input().split())
ss = [input() for _ in range(n)]
s = [[ss[i][j] == "." for j in range(n)] for i in range(n)]
a = [[0] * n for _ in range(n)]
for i in range(n - 1):
    for j in range(n - 1):
        a[i + 1][j + 1] = s[i][j] and s[i + 1][j] and s[i][j + 1] and s[i + 1][j + 1]
for i in range(n - 1):
    for j in range(n):
        a[i + 1][j] += a[i][j]
for i in range(n):
    for j in range(n - 1):
        a[i][j + 1] += a[i][j]
for _ in range(q):
    u, d, l, r = map(int, input().split())
    u, d, l, r = u - 1, d - 1, l - 1, r - 1
    print(a[d][r] - a[d][l] - a[u][r] + a[u][l])

Submission Info

Submission Time
Task A - 2x2 Erasing
User sounansya
Language Python (PyPy 3.10-v7.3.12)
Score 400
Code Size 618 Byte
Status AC
Exec Time 464 ms
Memory 96008 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 58 ms 76468 KiB
00_sample_01.txt AC 58 ms 76392 KiB
01_handmade_00.txt AC 369 ms 82796 KiB
01_handmade_01.txt AC 402 ms 94096 KiB
01_handmade_02.txt AC 57 ms 76416 KiB
01_handmade_03.txt AC 452 ms 95220 KiB
01_handmade_04.txt AC 401 ms 94040 KiB
02_random_00.txt AC 432 ms 87660 KiB
02_random_01.txt AC 400 ms 84704 KiB
02_random_02.txt AC 448 ms 92860 KiB
02_random_03.txt AC 389 ms 84796 KiB
02_random_04.txt AC 383 ms 83412 KiB
02_random_05.txt AC 464 ms 95224 KiB
02_random_06.txt AC 463 ms 94860 KiB
02_random_07.txt AC 459 ms 95568 KiB
02_random_08.txt AC 458 ms 95704 KiB
02_random_09.txt AC 460 ms 95532 KiB
02_random_10.txt AC 407 ms 95756 KiB
02_random_11.txt AC 409 ms 94984 KiB
02_random_12.txt AC 408 ms 95208 KiB
02_random_13.txt AC 409 ms 95452 KiB
02_random_14.txt AC 407 ms 95800 KiB
02_random_15.txt AC 409 ms 95596 KiB
02_random_16.txt AC 406 ms 95764 KiB
02_random_17.txt AC 407 ms 96008 KiB
02_random_18.txt AC 410 ms 95676 KiB
02_random_19.txt AC 412 ms 95568 KiB
02_random_20.txt AC 457 ms 95324 KiB