제출 #874331

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

using namespace std;

typedef long long ll;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int t;
    cin >> t;
    while (t--) {
        int n, m;
        cin >> n >> m;
        if (n + (m % 2 ? m / 2 : m / 2 - 1) >= m + (n % 2 ? n / 2 : n / 2 - 1)) {
            cout << n + (m % 2 ? m / 2 : m / 2 - 1) << "\n";
            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 % 2 ? n / 2 : n / 2 - 1) << "\n";
            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 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...