Submission #1294857

#TimeUsernameProblemLanguageResultExecution timeMemory
1294857kawhietRed-blue table (IZhO19_stones)C++20
0 / 100
9 ms4412 KiB
#include <bits/stdc++.h>
using namespace std;

void solve() {
    int n, m;
    cin >> n >> m;
    int x = m + (n - 1) / 2;
    int y = n + (m - 1) / 2;
    if (x > y) {
        cout << x << '\n';
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                cout << (i % 2 == 0 ? '-' : '+');
            }
            cout << '\n';
        }
    } else {
        cout << y << '\n';
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                cout << (j % 2 == 0 ? '+' : '-');
            }
            cout << '\n';
        }
    }
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int t;
    cin >> t;
    while (t--) {
        solve();
    }
    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...