Submission #69075543


Source Code Expand

n, q = map(int, input().split())

s = [list(input()) for _ in range(n)]

def is_ok(i, j):
    return s[i][j] == "." and s[i+1][j] == "." and s[i][j+1] == "." and s[i+1][j+1] == "."

t = [[0 for _ in range(n)] for _ in range(n)]

for i in range(1, n):
    for j in range(1, n):
        t[i][j] = t[i][j-1] + t[i-1][j] - t[i-1][j-1]

        if is_ok(i - 1, j - 1):
            t[i][j] += 1

for _ in range(q):
    u, d, l, r = map(lambda x: int(x)-1, input().split())
    print(t[d][r] + t[u][l] - t[d][l] - t[u][r])

Submission Info

Submission Time
Task A - 2x2 Erasing
User So_hey
Language Python (PyPy 3.10-v7.3.12)
Score 400
Code Size 535 Byte
Status AC
Exec Time 435 ms
Memory 95928 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 55 ms 76444 KiB
00_sample_01.txt AC 55 ms 76520 KiB
01_handmade_00.txt AC 370 ms 82816 KiB
01_handmade_01.txt AC 397 ms 95236 KiB
01_handmade_02.txt AC 56 ms 76572 KiB
01_handmade_03.txt AC 421 ms 95324 KiB
01_handmade_04.txt AC 388 ms 95284 KiB
02_random_00.txt AC 425 ms 89316 KiB
02_random_01.txt AC 401 ms 84836 KiB
02_random_02.txt AC 435 ms 93880 KiB
02_random_03.txt AC 383 ms 84668 KiB
02_random_04.txt AC 373 ms 83536 KiB
02_random_05.txt AC 434 ms 95372 KiB
02_random_06.txt AC 432 ms 95176 KiB
02_random_07.txt AC 433 ms 95172 KiB
02_random_08.txt AC 422 ms 95340 KiB
02_random_09.txt AC 431 ms 95644 KiB
02_random_10.txt AC 394 ms 95236 KiB
02_random_11.txt AC 392 ms 95628 KiB
02_random_12.txt AC 393 ms 95928 KiB
02_random_13.txt AC 394 ms 95388 KiB
02_random_14.txt AC 397 ms 95296 KiB
02_random_15.txt AC 391 ms 95412 KiB
02_random_16.txt AC 402 ms 95824 KiB
02_random_17.txt AC 394 ms 95420 KiB
02_random_18.txt AC 398 ms 95620 KiB
02_random_19.txt AC 391 ms 95244 KiB
02_random_20.txt AC 415 ms 95276 KiB