This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
#define ll long long
#define ff first
#define ss second
#define ln "\n"
const ll INF = 2e18;
const ll MOD = 1e9+7;
using namespace std;
void solve(){
ll x, y; cin >> x >> y;
if (x>y){
ll fr = y-y/2;
cout << x+y-fr << ln;
// ll fc = x-x/2;
for (ll rc=0; rc<x; rc++){
for (ll i=0; i<fr; i++){
cout << '+';
}
for (ll i=fr; i<y; i++){
cout << '-';
}
cout << ln;
}
}else{
ll fc = x-x/2;
cout << y+x-fc << ln;
for (ll rc=0; rc<fc; rc++){
for (ll i=0; i<y; i++){
cout << '-';
}
cout << ln;
}
for (ll rc=fc; rc<x; rc++){
for (ll i=0; i<y; i++){
cout << '+';
}
cout << ln;
}
}
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
ll t=1;
cin >> t;
while (t--) solve();
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |