Submission #331610

# Submission time Handle Problem Language Result Execution time Memory
331610 2020-11-29T07:00:41 Z Enkhmunkh Red-blue table (IZhO19_stones) C++14
0 / 100
47 ms 1388 KB
#include <bits/stdc++.h>
using namespace std;
int n, m;
void sol() {
    cin >> n >> m;
    char arr[n][m];
    int tooll[m] = {0};
    int hed = 0;
    if (n % 2 == 0) hed = n/2-1;
    else hed = n/2;
    int mm = m/2+1;
    int niit = m;
    for (int i = 0; i < n; i++) {
        bool k = false;
        if (i % 2 == 0) {
            for (int j = 0, mmm = mm; j < m; j++) {
                if (mmm > 0 && tooll[j] < hed) {
                    arr[i][j] = '+';
                    tooll[j]++;
                    mmm--;
                }else {
                    if (mmm == 0 && k == false) {
                        k = true;
                    }
                    arr[i][j] = '-';
                }
            }
        }else {
            for (int j = m-1, mmm = mm; j >= 0; j--) {
                if (mmm > 0 && tooll[j] < hed) {
                    arr[i][j] = '+';
                    mmm--;
                    tooll[j]++;
                }else {
                    if (mmm == 0 && k == false) {
                        k = true;
                    }
                    arr[i][j] = '-';
                }
            }
        }
        if (k) niit++;
    }
    cout << niit << "\n";
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            cout << arr[i][j];
        }
        cout << "\n";
    }
    cout << "\n";
}
int main () {
    int t;
    cin >> t;
    while (t--) sol();
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Incorrect 1 ms 384 KB Wrong answer in test 2 1: 1 < 2
# 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 Correct 1 ms 364 KB Output is correct
2 Incorrect 1 ms 384 KB Wrong answer in test 2 1: 1 < 2
# Verdict Execution time Memory Grader output
1 Incorrect 47 ms 1388 KB Wrong answer in test 97 21: 111 < 116
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 43 ms 1388 KB Wrong answer in test 24 24: 43 < 44
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Incorrect 1 ms 384 KB Wrong answer in test 2 1: 1 < 2