Submission #882963

# Submission time Handle Problem Language Result Execution time Memory
882963 2023-12-04T09:27:07 Z AI_2512 Red-blue table (IZhO19_stones) C++17
0 / 100
26 ms 1368 KB
#include <bits/stdc++.h>

using namespace std;

int main() {
    long long t;
    cin >> t;
    for (int i = 0; i<t; i++){
        int n,m;
        cin >> n >> m;
        if (n ==1){
            cout << m << "\n";
            for (int k = 0; k<m;k++){
                cout << "-";
            }
            cout << "\n";
        }
        else if(m == 1){
            cout << n << "\n";
            for (int k = 0; k < n;k++){
                cout << "+" << "\n";
            }
        }else{
            long long res = 0;
            if (n >= m){
                vector<vector<char>> matrix(n, vector<char>(m, '+'));
                res = n+m/2;
                for (int k = 1; k < m; k+=2){
                    for (int j = 0; j<n ; j++){
                        matrix[j][k] = '-';
                    }
                }
                cout << res << "\n";
                for (auto vec :matrix){
                    for (auto el:vec){
                        cout << el;
                    }
                    cout << "\n";
                }
            }
            if (n < m){
                vector<vector<char>> matrix(n, vector<char>(m, '+'));
                res = m+n/2;
                for (int k = 1; k < n; k+=2){
                    for (int j = 0; j<m ; j++){
                        matrix[j][k] = '-';
                    }
                }
                cout << res << "\n";
                for (auto vec :matrix){
                    for (auto el:vec){
                        cout << el;
                    }
                    cout << "\n";
                }
            }
            
        }
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Runtime error 1 ms 348 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 348 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Runtime error 1 ms 348 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 344 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 26 ms 1368 KB in the table A+B is not equal to 36
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Runtime error 1 ms 348 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -