This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
def solve_test_case(N, M):
total_rows = N + 1
max_AB = (total_rows // 2) * M + (total_rows // 2 + total_rows % 2) * (M // 2)
print(max_AB)
# Generate the pattern
for i in range(N):
row = ['+' if (i % 2 == 0 and j % 2 == 0) or (i % 2 == 1 and j % 2 == 1) else '-' for j in range(M)]
print("".join(row))
# Read the number of test cases
T = int(input().strip())
for _ in range(T):
# Read the dimensions of the table
N, M = map(int, input().strip().split())
# Solve the test case
solve_test_case(N, M)
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |