Submission #1172461

#TimeUsernameProblemLanguageResultExecution timeMemory
1172461AtabayRajabliRed-blue table (IZhO19_stones)C++20
0 / 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 + 1) / 2 ? '+' : '-');
            else mark[i][j] = (j > (m + 1) / 2 ? '+' : '-');
        }
    }
    cout << n + (m - 1) / 2 << '\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...