Submission #331107

# Submission time Handle Problem Language Result Execution time Memory
331107 2020-11-27T11:25:52 Z Enkhmunkh Red-blue table (IZhO19_stones) C++14
0 / 100
38 ms 1388 KB
#include <bits/stdc++.h>
using namespace std;
void solution () {
    int n, m;
    cin >> n >> m;
    char arr[n][m];
    if (n >= m && n > 2) {
        cout << m + m/2 << "\n";
        for (int i = 0; i < n; i++) {
            for (int j = 0, a = m/2-1; j < m; j++) {
                if (a != 0) {
                    arr[i][j] = '-';
                    a--;
                }else {
                    arr[i][j] = '+';
                }
                cout << arr[i][j];
            }
            cout << "\n";
        }
    }else {
        int a;
        if (n % 2 == 0){
            cout << m+n/2-1 << "\n";
            a = n/2-1;
        } else {
            cout << m+n/2 << "\n";
            a = n/2;
        }
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                if (a != 0) {
                    arr[i][j] = '+';
                }else {
                    arr[i][j] = '-';
                }
                cout << arr[i][j];
            }
            if (a != 0) {
                a--;
            }
            cout << "\n";
        }
    }
}
int main () {
    ios::sync_with_stdio(false);
	cin.tie(NULL);
    int t;
    cin >> t;
    while (t--) solution();
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 364 KB in the table A+B is not equal to 4
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Wrong answer in test 2 1: 1 < 2
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 364 KB in the table A+B is not equal to 4
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 38 ms 1388 KB in the table A+B is not equal to 31
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 34 ms 1388 KB in the table A+B is not equal to 36
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 364 KB in the table A+B is not equal to 4
2 Halted 0 ms 0 KB -