#include<bits/stdc++.h>
#define fi first
#define se second
#define len(x) (int)(x).size()
#define pb push_back
#define p2(x) (x)*(x)
#define all(x) (x).begin() , (x).end()
#define mkp make_pair
//#pragma GCC optimize("unroll-loops")
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("-O3")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
typedef long double ld;
typedef long long ll;
void solve(){
int n , m;
cin >> n >> m;
/// red okay???
/// lulz
if(n-(n+2)/2 < m-(m+2)/2){
int need;
need = (m + 2) / 2;
int ans = n + m - need;
cout << ans << '\n';
for(int i = 0 ; i < n; ++i){
for(int j = 0 ; j < need; ++j)
cout << "+";
for(int j = need; j < m ; ++j)
cout << "-";
cout << '\n';
}
}else{
int need;
need = (n + 2) / 2;
int ans = n + m - need;
vector < vector < char > > a(n , vector < char > (m , '+'));
for(int j = 0 ; j < m; ++j){
for(int i = 0 ; i < need ; ++i)
a[i][j] = '-';
}
cout << ans << '\n';
for(auto i : a){
for(auto j : i){
cout << j;
}
cout << '\n';
}
}
}
int main(){
ios_base::sync_with_stdio(0) , cin.tie(0) , cout.tie(0);
int t;
cin >> t;
while(t--){
solve();
}
}
/*
*/
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
364 KB |
Wrong answer in test 1 3: 2 < 3 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
Wrong answer in test 3 45: 25 < 46 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
364 KB |
Wrong answer in test 1 3: 2 < 3 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
34 ms |
1388 KB |
Wrong answer in test 97 21: 69 < 116 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
36 ms |
1388 KB |
Wrong answer in test 24 24: 35 < 44 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
364 KB |
Wrong answer in test 1 3: 2 < 3 |
2 |
Halted |
0 ms |
0 KB |
- |