Submission #892290

#TimeUsernameProblemLanguageResultExecution timeMemory
892290dilshod9890Red-blue table (IZhO19_stones)Cpython 3
0 / 100
142 ms3968 KiB
def solve_test_case(N, M):
    total_rows = N + 1
    max_AB = (total_rows // 2) * (M // 2) + (total_rows // 2 + total_rows % 2) * ((M + 1) // 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 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...