#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];
int f=!(n<m);
if(!f)
swap(n,m);
for(int i=0;i<n;i++)
for(int j=0;j<m;j++){
if(f)
grid[i][j]='+';
else
grid[i][j]='-';
}
int tot=0,j=n;
int cnt=(m-1)/2;
while(cnt--){
for(int i=0;i<n;i++){
if(f)
grid[i][j-n]='-';
else
grid[i][j-n]='+';
tot++;
if(tot==(n/2)+1){
j++;
tot=0;
}
}
}
cout<<j<<endl;
if(!f){
for(int i=0;i<m;i++){
for(int j=0;j<n;j++)
cout<<grid[j][i];
cout<<endl;
}
return;
}
for(int i=0;i<n;i++){
for(int j=0;j<m;j++)
cout<<grid[i][j];
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... |