제출 #1171666

#제출 시각아이디문제언어결과실행 시간메모리
1171666m0vlanRed-blue table (IZhO19_stones)C++20
27 / 100
13 ms1352 KiB
/**
*  author: Movlan
**/
#include <bits/stdc++.h>
//#include <bits/extc++.h>

//using namespace __gnu_pbds;
using namespace std;
#define ll long long
#define vl __int128
#define int long long
#define sp " "
#define sn "\n"
#define pb push_back
#define ld long double
#define pf push_front
#define rb pop_back
#define rf pop_front
typedef pair<int,int> pii;
typedef pair<ll,ll>pll;
#define vi vector<int>;
#define vpii vector<pair<int,int>>
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define bs(x,y) binary_search(all(x),y)
#define fi first
#define se second
#define len(x) (int)(x.size())
#define precise(x) cout << fixed << setprecision(x)
#define uniq(v) v.erase(unique(all(v)), v.end())
#define input(x) freopen(x,"r",stdin)
#define output(x) freopen(x,"w",stdout)
#define IO ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }
ll mod_exp(ll a, ll b, ll m) {
    ll res = 1;
    while (b) {
        if (b & 1) res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res;
}
ll mod_inv(ll a, ll m){return mod_exp(a, m - 2, m);}
const int INF =1e9+7;
const ll LINF =1e18;
const int MOD = 1e9 + 7;
const int MOD1 = 998244353;
const double EPS = 1e-9;
const int MAXN=1e3+7;
const int MAX=1e6+1;

void solve() {
    int n;
    cin>>n;
    int m;
    cin>>m;
    if(n>m){
        cout<<n+(m-(m/2+1))<<sn;
        for(int i=0;i<n;i++){
            for(int j=0;j<m/2+1;j++){
                cout<<'+';
            }
            for(int j=m/2+1;j<m;j++){
                cout<<'-';
            }
            cout<<sn;
        }
    }
    else{
        cout<<m+(n-(n/2+1))<<sn;
        for(int i=0;i<n/2+1;i++){
            for(int j=0;j<m;j++){
                cout<<'-';
            }
            cout<<sn;
        }
        for(int i=n/2+1;i<n;i++){
            for(int j=0;j<m;j++){
                cout<<'+';
            }
            cout<<sn;
        }
    }

}



signed main() {
    IO;
    //input("billboard.in");
    //output("billboard.out");
    int t = 1;
    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...