Submission #1272801

#TimeUsernameProblemLanguageResultExecution timeMemory
1272801m_nowruzowRed-blue table (IZhO19_stones)C++20
0 / 100
16 ms4412 KiB
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <unordered_map>
#include <map>
#include <unordered_set>
#include <stack>
#include <queue>
#include <string>
#include <cmath>
#define FAST ios_base::sync_with_stdio(false);
#define pb push_back
#define QUICK cin.tie(NULL),cout.tie(NULL);
#define all(x) x.begin(),x.end()
#define ll long long
using namespace std;
void solve()
{
    int n, m;
    cin >> n >> m;
    int k = m;
    bool IsEven = false;
    if (m%2==0)
    {
        IsEven = true;
        k--;
    }
    if (n==1 && m==1)
    {
        cout << n << "\n";
        cout << '+';
    }
    else if (m==1)
    {
        cout << n << "\n";
        for (int i = 0; i < n; i++)
        {
            cout << "+" << "\n";
        }
    }
    else if (n==1)
    {
        cout << m << "\n";
        for (int i = 0; i < m; i++)
        {
            cout << "-";
        }
        cout << "\n";
    }
    else
    {
        cout << k / 2+n << "\n";;
        int d = n;
        while (d-->0)
        {
            for (int i = 1; i <= m-k/2; i++)
            {
                cout << "+";
            }
            for (int i = 0; i < k/2; i++)
            {
                cout << "-";
            }
            cout << "\n";
        }
    }
   
}
int main() {
    FAST;
    QUICK;
    int t;
    cin >> t;
    while (t-->0)
    {
        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...