Submission #624337

#TimeUsernameProblemLanguageResultExecution timeMemory
624337dqhungdlRed-blue table (IZhO19_stones)C++17
27 / 100
23 ms1344 KiB
#include <bits/stdc++.h>
using namespace std;

#ifdef DEBUG
#include "debug.hpp"
#define debug(x...) cerr << "[" << #x << "] = [", _print(x)
#else
#define debug(x...)
#endif

int T, m, n;

void solve() {
    cin >> m >> n;
    if (m > n) {
        cout << m + (n - 1) / 2 << '\n';
        for (int i = 1; i <= m; i++) {
            for (int j = 1; j <= (n - 1) / 2; j++)
                cout << '-';
            for (int j = (n - 1) / 2 + 1; j <= n; j++)
                cout << '+';
            cout << '\n';
        }
    } else {
        cout << n + (m - 1) / 2 << '\n';
        for (int i = 1; i <= (m - 1) / 2; i++) {
            for (int j = 1; j <= n; j++)
                cout << '+';
            cout << '\n';
        }
        for (int i = (m - 1) / 2 + 1; i <= m; i++) {
            for (int j = 1; j <= n; j++)
                cout << '-';
            cout << '\n';
        }
    }
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
#ifdef DEBUG
    freopen("../_input", "r", stdin);
#endif
    cin >> T;
    while (T--)
        solve();
}
#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...