Last time I will write today's story. I could only solve A and B. I can't beat sleep
** Thoughts ** Just $ (n-1) * (m-1) $
n, m = map(int,input().split())
print((n-1)*(m-1))
** Thoughts ** I did it recently so I was able to write it smoothly. Examine vertically and horizontally.
h, w = map(int,input().split())
a = [list(input()) for _ in range(h)]
yoko = []
for i in range(h):
seta = set(a[i])
if '#' in seta:
yoko.append(a[i])
h = len(yoko)
w = len(yoko[0])
for i in range(w):
tate = []
for j in range(h):
tate.append(yoko[j][i])
settate = set(tate)
if '#'not in settate:
for j in range(h):
yoko[j][i] = ''
ans = ''
for i in range(h):
c = ''.join(yoko[i])
ans += c
if i != h-1:
ans += '\n'
print(ans)
ABC089-C I didn't know how to calculate the combination
ABC075-C It seems that it can be solved by dropping the edges and dfs, but it cannot be implemented.
If this is a production, the rate will drop, so I will review it so that I can solve it. Recently, I'm working hard because sometimes I can't write even if I try to solve it with dfs. See you again, good night
Recommended Posts