#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define endl '\n'
#define ld long double
#define pb push_back
#define pf push_front
#define mod 998244353
#define se second
#define fi first
#define all(ls) (ls).begin(),(ls).end()
#define int long long
using namespace std;
using namespace __gnu_pbds;
template<typename type>using ordered_set=tree<type,null_type,less<type>,rb_tree_tag,tree_order_statistics_node_update>;
template<typename type>using ordered_multiset=tree<type,null_type,less_equal<type>,rb_tree_tag,tree_order_statistics_node_update>;
void solve(){
int n,m;
cin>>n>>m;
char grid[n][m];
if(n>=m){
int cnt=((m-1)/2);
int cur=n,tot=0;
while(cnt--){
for(int i=0;i<n;i++){
grid[i][cur-n]='-';
if(tot==(n/2)){
cur++;
tot=0;
}
else
tot++;
}
}
cout<<cur<<endl;
for(int i=0;i<n;i++){
for(int j=0;j<m;j++)
if(grid[i][j]!='-')
cout<<'+';
else
cout<<'-';
cout<<endl;
}
cout<<endl;
}
else{
int cnt=((n-1)/2);
int cur=m,tot=0;
while(cnt--){
for(int i=0;i<m;i++){
grid[i][cur-m]='+';
if(tot==(m/2)){
cur++;
tot=0;
}
else
tot++;
}
}
cout<<cur<<endl;
for(int i=0;i<n;i++){
for(int j=0;j<m;j++)
if(grid[j][i]!='+')
cout<<'-';
else
cout<<'+';
cout<<endl;
}
cout<<endl;
}
}
signed main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int t=1;
cin>>t;
for(int i=1;i<=t;i++){
// cout<<"Scenario #"<<i<<":"<<" ";
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... |