Submission #1304836


Source Code Expand

pos_black_mapping = {}
pos_num_mapping = {}
H, W, N = map(int, raw_input().split())
for i in range(N):
    a, b = map(int, raw_input().split())
    a, b = a-1, b-1
    pos_black_mapping[a, b] = 1
    for dy in range(-2, 3):
        for dx in range(-2, 3):
            na, nb = a+dx, b+dy
            if (0 <= na < H-2) and (0 <= nb < W-2):
                pos_num_mapping[na, nb] = 1

ans = [0 for _ in range(10)]
for a, b in pos_num_mapping.keys():
    cnt = 0
    for dy in range(3):
        for dx in range(3):
            na, nb = a+dx, b+dy
            if (na, nb) in pos_black_mapping:
                cnt += 1
    ans[cnt] += 1
ans[0] = (W-2)*(H-2) - sum(ans[1:])
for v in ans:
    print v

Submission Info

Submission Time
Task D - Snuke's Coloring
User namakemono
Language Python (2.7.6)
Score 0
Code Size 720 Byte
Status TLE
Exec Time 3177 ms
Memory 439572 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 400
Status AC
AC × 9
TLE × 10
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, sample_01.txt, sample_02.txt, sample_03.txt
Case Name Status Exec Time Memory
01.txt AC 2404 ms 38452 KB
02.txt TLE 3164 ms 197400 KB
03.txt AC 677 ms 16312 KB
04.txt AC 10 ms 2696 KB
05.txt TLE 3160 ms 98076 KB
06.txt TLE 3160 ms 98076 KB
07.txt TLE 3175 ms 432788 KB
08.txt TLE 3176 ms 439572 KB
09.txt TLE 3177 ms 439572 KB
10.txt AC 11 ms 2696 KB
11.txt TLE 3164 ms 191768 KB
12.txt TLE 3176 ms 434196 KB
13.txt AC 19 ms 2816 KB
14.txt TLE 3168 ms 338088 KB
15.txt TLE 3164 ms 191384 KB
empty.txt AC 10 ms 2696 KB
sample_01.txt AC 11 ms 2696 KB
sample_02.txt AC 11 ms 2696 KB
sample_03.txt AC 10 ms 2696 KB