-
Notifications
You must be signed in to change notification settings - Fork 0
/
Cudoviste.py
30 lines (29 loc) · 900 Bytes
/
Cudoviste.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# Cudoviste
# Solution by Hasan Kalzi 23-10-2020
# Link to problem in Kattis: https://open.kattis.com/problems/cudoviste
from sys import stdin, stdout
rows, columns = map(int, stdin.readline().split())
input_list = []
for i in range(rows):
input_list.append(stdin.readline().strip())
all_cases = [0] * 5
for i in range(columns - 1):
for j in range(rows - 1):
a = input_list[j][i]
b = input_list[j + 1][i]
c = input_list[j][i + 1]
d = input_list[j + 1][i + 1]
if a == '#' or b == '#' or c == '#' or d == '#':
continue
car_squashed = 0
if a == "X":
car_squashed += 1
if b == "X":
car_squashed += 1
if c == "X":
car_squashed += 1
if d == "X":
car_squashed += 1
all_cases[car_squashed] += 1
for case in all_cases:
stdout.write(str(case)+'\n')