Участник:StasFomin/Solutions/codechef/CHTPNDMC
Материал из DISCOPAL
< Участник:StasFomin
Версия от 15:18, 29 октября 2021; StasFomin (обсуждение | вклад) (Новая страница: «<code-python> import numpy as np def solver(): N = int(input()) m = np.eye(N, dtype = str) in_string = input() out_string = input() for i in…»)
import numpy as np def solver(): N = int(input()) m = np.eye(N, dtype = str) in_string = input() out_string = input() for i in range(N): counter = 1 j = i while j >= 0: if i == j: m[i][j] = 'Y' else: if in_string[j] == 'Y' and out_string[j + 1] == 'Y' and counter == 1: m[i][j] = 'Y' else: m[i][j] = 'N' counter = 0 j -= 1 counter = 1 for j in range(i + 1, N): if in_string[j] == 'Y' and out_string[j - 1] == 'Y' and counter == 1: m[i][j] = 'Y' else: m[i][j] = 'N' counter = 0 for i in range(N): print(*m[i], sep ='') T = int(input()) for i in range(T): print(f"Case #{i+1}:") solver()