Submission #523300

#TimeUsernameProblemLanguageResultExecution timeMemory
523300Azamat_KhRed-blue table (IZhO19_stones)Cpython 3
100 / 100
874 ms12720 KiB
t = int(input()) while t: n, m = map(int, input().split()) # (n,m) <-> (m,n) # by "n>=m" we will solve (n,m) and (m,n) swapped = False if n<m: n, m = m, n swapped = True a = [] for y in range(n): a.append([]) for x in range(m): a[y].append('+') answer = n ''' 0-++ 1-++ 2+-+ 012 (m-1)//2 x n//2+1 o'zgartirishlar chegarasi 1 3 +n + + m ''' x = 0; c = 0 for _ in range((m-1)//2): for y in range(n): a[y][x] = '-' c += 1 if c >= n//2+1: answer += 1 x += 1 c = 0 print(answer) if not swapped: for y in range(n): for x in range(m): print(a[y][x], end='') print() else: # n -> m, m -> n for x in range(m): for y in range(n): if a[y][x] == '+': print('-', end='') else: print('+', end='') print() t -= 1 # o'zgatirish chegarasi - (m-1)//2
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...