제출 #444733

#제출 시각아이디문제언어결과실행 시간메모리
444733nickyrioRed-blue table (IZhO19_stones)C++17
27 / 100
37 ms1252 KiB
#include <bits/stdc++.h>

using namespace std;

void Solve() {
    int n, m, ans = 0;
    cin >> n >> m;
    pair<int, int> best = {0, 0};
    for (int i = 0; i <= n; ++ i) {
        for (int j = 0; j <= m; ++j) {
            int curr = j * (i * 2 > n) + i * (j * 2 < m) + (n - i);
            if (curr > ans) {
                ans = curr;
                best = {i, j};
            }
        }
    }
    cout << ans << '\n';
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < m; ++j) {
            if (i < best.first && j < best.second) cout << '-';
            else cout << '+';
        }
        cout << '\n';
    }
}
int main() {
  ios::sync_with_stdio(false); cin.tie(NULL);
    int test;
    cin >> test;
    while (test--) 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...