Submission #170736

# Submission time Handle Problem Language Result Execution time Memory
170736 2019-12-26T08:49:40 Z DanGolov Red-blue table (IZhO19_stones) C++17
27 / 100
44 ms 1556 KB
#include <iostream>
#include <vector>

using namespace std;

namespace Solution {

    char field[1013][1013];

    void solve() {
        int n, m;
        cin >> n >> m;
        int ans = max(n + m / 2 - (m % 2 == 0), m + n / 2 - (n % 2 == 0));
        if (ans == n + m / 2 - (m % 2 == 0)) {
            for (int i = 0; i < n; i++) fill(field[i], field[i] + m, '+');
            for (int i = 0; i < m / 2 - (m % 2 == 0); i++) {
                for (int j = 0; j < n / 2 + 1; j++) {
                    field[j][i] = '-';
                }
            }
        } else {
            for (int i = 0; i < n; i++) fill(field[i], field[i] + m, '-');
            for (int i = 0; i < n / 2 - (n % 2 == 0); i++) {
                for (int j = 0; j < m / 2 + 1; j++) {
                    field[i][j] = '+';
                }
            }
        }
        cout << ans << '\n';
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                cout << field[i][j];
            }
            cout << '\n';
        }
    }

}


int main() {
    int t;
    cin >> t;
    while (t--) {
        Solution::solve();
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 380 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 380 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 380 KB Output is correct
3 Correct 4 ms 380 KB Output is correct
4 Incorrect 6 ms 376 KB Wrong answer in test 5 29: 31 < 32
# Verdict Execution time Memory Grader output
1 Incorrect 44 ms 1460 KB Wrong answer in test 97 21: 107 < 116
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 43 ms 1556 KB Wrong answer in test 24 24: 35 < 44
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 380 KB Output is correct
3 Correct 4 ms 380 KB Output is correct
4 Incorrect 6 ms 376 KB Wrong answer in test 5 29: 31 < 32