제출 #1172482

#제출 시각아이디문제언어결과실행 시간메모리
1172482AtabayRajabliRed-blue table (IZhO19_stones)C++20
27 / 100
14 ms1352 KiB
#include <bits/stdc++.h>
#define int long long
#define all(v) v.begin(), v.end()
using namespace std;

const int sz = 1e3 + 1, inf = 1e18;
int n, m;
char mark[sz][sz];

void solve()
{
    cin >> n >> m;
    bool ok = 0;
    if(n < m) swap(n, m), ok = 1;
    for(int i = 1; i <= n; i++)
    {
        for(int j = 1; j <= m; j++)
        {
            if(!ok) mark[i][j] = (j <= (m / 2 + 1) ? '+' : '-');
            else mark[i][j] = (j > (m / 2 + 1) ? '+' : '-');
        }
    }

    cout << n + (m - (m / 2 + 1)) << '\n';    
    if(ok) swap(n, m);
    for(int i = 1; i <= n; i++)
    {
        for(int j = 1; j <= m; j++)
        {
            if(ok) cout << mark[j][i];
            else cout << mark[i][j];
        }
        cout << '\n';
    }
}

signed main()
{                                                                  
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    
    int t;
    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...