Submission #668398

# Submission time Handle Problem Language Result Execution time Memory
668398 2022-12-03T19:44:18 Z YENGOYAN Red-blue table (IZhO19_stones) C++17
21 / 100
48 ms 1236 KB
#include <iostream>
#include <vector>

using namespace std;

void solve() {
    int n, m; cin >> n >> m;
    if (min(m, n) <= 3) {
        if (n + (m + 1) / 2 - 1 > m + (n + 1) / 2 - 1) {
            cout << n + (m + 1) / 2 - 1 << endl;
            for (int i = 1; i <= n; i++) {
                for (int j = 1; j <= m; j++) {
                    if (j <= m / 2 + 1) cout << '+';
                    else cout << '-';
                }
                cout << "\n";
            }
        }
        else {
            cout << m + (n + 1) / 2 - 1 << endl;
            for (int i = 1; i <= n; i++) {
                for (int j = 1; j <= m; j++) {
                    if (i <= n / 2 + 1) cout << '-';
                    else cout << '+';
                }
                cout << "\n";
            }
        }
        return;
    }
    cout << n + m - 2 - (1 - (m % 2)) << endl;
    for (int i = 0; i < m; i++) cout << '-';
    cout << endl;
    for (int i = 1; i < n; i++) {
        if (i % 2) {
            for (int j = 1; j <= m / 2 + 1; j++) cout << '+';
            for (int j = m / 2 + 2; j <= m; j++) cout << '-';
        }
        else {
            for (int j = m / 2 + 2; j <= m; j++) cout << '-';
            for (int j = 1; j <= m / 2 + 1; j++) cout << '+';
        }
        cout << endl;
    }
    /*
        ----------------------------
        +++++++++++++++-------------
        -------------+++++++++++++++
        +++++++++++++++-------------
        -------------+++++++++++++++
 
    
    
    */
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(NULL), cout.tie(NULL);
    int t; cin >> t; while (t--)
        solve();
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB in the table A+B is not equal to 5
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB in the table A+B is not equal to 5
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 48 ms 1228 KB Output is correct
2 Correct 19 ms 1204 KB Output is correct
3 Correct 19 ms 1108 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 38 ms 1236 KB in the table A+B is not equal to 45
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB in the table A+B is not equal to 5
3 Halted 0 ms 0 KB -