제출 #173757

#제출 시각아이디문제언어결과실행 시간메모리
173757emil_physmathRed-blue table (IZhO19_stones)C++17
0 / 100
9 ms1400 KiB
#include <iostream>
#include <vector>
#include <string>
using namespace std;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int t;
    cin >> t;
    while (t--)
    {
        int n, m;
        cin >> n >> m;
        vector<string> a(n, string(m, '+'));
        for (int i = 0; i < n; ++i)
            for (int j = 0; j < m; ++j)
                a[i][j] = ((i + j) % 2 ? '+' : '-');
        for (int i = 0; i < n; ++i)
            for (int j = m - 1 - (m + 1) % 2; j < m; ++j)
                a[i][j] = '+';
        for (int j = 0; j < m; ++j)
            for (int i = n - 1 - (n + 1) % 2; i < n; ++i)
                a[i][j] = '-';
        int ans = n + m - 2 - (n + 1) % 2 - (m + 1) % 2;
        cout << ans << '\n';
        for (int i = 0; i < n; ++i)
            cout << a[i] << '\n';
        // cout << flush;
    }
}
#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...