Submission #878283


Source Code Expand

def solve():
    w, h, n = [int(i) for i in input().split()]
    dic = dict()
    for i in range(n):
        a, b = map(lambda x: int(x) - 1, input().split())
        for j in range(3):
            for k in range(3):
                aj = a + j - 1
                bk = b + k - 1
                if 0 < aj and aj < w - 1 and 0 < bk and bk < h - 1:
                    if (aj, bk) in dic:
                        dic[(aj, bk)] += 1
                    else:
                        dic[(aj, bk)] = 1
    ans = [0 for i in range(10)]
    for v in dic.values():
        ans[v] += 1
    for i in range(10):
        if i == 0:
            print((w - 2) * (h - 2) - sum(ans))
        else:
            print(ans[i])


if __name__=="__main__":
    solve()

Submission Info

Submission Time
Task D - Snuke's Coloring
User yumechi
Language PyPy3 (2.4.0)
Score 400
Code Size 774 Byte
Status AC
Exec Time 2634 ms
Memory 128928 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 400 / 400
Status AC
AC × 16
Set Name Test Cases
Sample
All 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, empty.txt
Case Name Status Exec Time Memory
01.txt AC 1921 ms 80472 KB
02.txt AC 2317 ms 91812 KB
03.txt AC 839 ms 61656 KB
04.txt AC 351 ms 42992 KB
05.txt AC 1622 ms 83032 KB
06.txt AC 1500 ms 79832 KB
07.txt AC 2537 ms 128416 KB
08.txt AC 2634 ms 128416 KB
09.txt AC 2549 ms 128288 KB
10.txt AC 349 ms 42992 KB
11.txt AC 2372 ms 90152 KB
12.txt AC 2539 ms 128416 KB
13.txt AC 389 ms 43760 KB
14.txt AC 2522 ms 128928 KB
15.txt AC 2401 ms 93220 KB
empty.txt AC 351 ms 42992 KB
sample_01.txt AC 349 ms 42992 KB
sample_02.txt AC 351 ms 42992 KB
sample_03.txt AC 348 ms 42992 KB