Submission #1133145

#TimeUsernameProblemLanguageResultExecution timeMemory
1133145michael12Red-blue table (IZhO19_stones)C++20
0 / 100
16 ms1348 KiB
#include <iostream>
#include <vector>
#include <string>

using namespace std;

int main() {
    int T;
    cin >> T;  // Number of test cases
    
    while (T--) {
        int N, M;
        cin >> N >> M;  // Dimensions of the table
        
        // Initialize the table with an empty string
        vector<string> table(N);
        
        // Fill the table using a checkerboard pattern
        for (int i = 0; i < N; ++i) {
            for (int j = 0; j < M; ++j) {
                if ((i + j) % 2 == 0) {
                    table[i] += '+';  // Red stone
                } else {
                    table[i] += '-';  // Blue stone
                }
            }
        }
        
        // Calculate A + B
        int A = N / 2 + (N % 2);  // Rows Aidos likes (more '+' than '-')
        int B = M / 2 + (M % 2);  // Columns Tima likes (more '-' than '+')
        
        cout << A + B << endl;  // Output the maximum A + B
        
        // Output the table
        for (const auto& row : table) {
            cout << row << endl;
        }
    }
    
    return 0;
}
#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...