/*Bismillahir Rahmanir Raheem*/
#include <bits/stdc++.h>
using namespace std;
#define kuka ios::sync_with_stdio(false);cin.tie(0), cout.tie(0);
#define pb push_back
#define sz(x) x.size()
#define all(x) x.begin(), x.end()
#define FOR(n) for(int i = 0; i < n; i++)
#define ff(x, y) for( int y = 0; y < x; y++)
#define fff(x, y) for( int y = x; y <= 0; y--)
#define F first
#define S second
#define int long long
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const ll INF = LLONG_MAX;
const int inf = INT_MAX;
const double PI = acos(-1);
const int N = 3e5 + 5;
const int MOD = 1e9 ;
void oyan(){
int n, m;
cin>>n>>m;
cout<<max(n, m) + (min(n, m) + 1) / 2 - 1<<"\n";
if(n >= m){
for(int i = 1; i <= n; i++){
for(int j = 1; j <= m; j++){
if(j <= (min(n, m) + 1) / 2 - 1){
cout<<'-';
}else{
cout<<'+';
}
}
cout<<"\n";
}
}else{
for(int i = 1; i <= n; i++){
for(int j = 1; j <= m; j++){
if(i <= (min(n, m) + 1) / 2 - 1){
cout<<'+';
}else{
cout<<'-';
}
}
cout<<"\n";
}
}
}
main(){
kuka;
//freopen("test.txt", "r", stdin);
//freopen("distance.in", "r", stdin);
//freopen("distance.out", "w", stdout);
int oylan = 1;
cin>>oylan;
while(oylan--){
oyan();
}
}
/*
NOTES
a/b module == (a*b^(module - 2)) % (module);
*/
Compilation message
stones.cpp:58:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
58 | main(){
| ^~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
508 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
508 KB |
Output is correct |
3 |
Correct |
1 ms |
336 KB |
Output is correct |
4 |
Incorrect |
3 ms |
336 KB |
Wrong answer in test 5 29: 31 < 32 |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
22 ms |
1272 KB |
Wrong answer in test 97 21: 107 < 116 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
24 ms |
1352 KB |
Wrong answer in test 24 24: 35 < 44 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
508 KB |
Output is correct |
3 |
Correct |
1 ms |
336 KB |
Output is correct |
4 |
Incorrect |
3 ms |
336 KB |
Wrong answer in test 5 29: 31 < 32 |
5 |
Halted |
0 ms |
0 KB |
- |