#include "bits/stdc++.h"
#define mxN 1003
using namespace std;
char gr[mxN][mxN];
char nw[mxN][mxN];
int main(){
int T;
cin >> T;
while (T --){
int N, M;
cin >> N >> M;
for (int i = 1; i <= N; i ++)
for (int j = 1; j <= M; j ++)
gr[i][j] = "-+"[N >= M];
char d = '-';
if (M > N){
for (int i = 1; i <= N; i ++)
for (int j = 1; j <= M; j ++)
nw[j][i] = gr[i][j];
for (int i = 1; i <= M; i ++)
for (int j = 1; j <= N; j ++)
gr[i][j] = nw[i][j];
swap(N, M);
d = '+';
}
int v = (M + 1) / 2 - 1;
int cas1 = N + (M + 1) / 2 - 1;
int cas2 = N - 2 + 2 * v;
if (N & 1) cas2 ++;
for (int i = 1; i <= N / 2 + 1; i ++)
for (int j = 1; j <= v; j ++)
gr[i][j] = d;
if (cas2 > cas1){
for (int i = N - (N / 2 + 1) + 1; i <= N; i ++)
for (int j = v + 1; j <= 2 * v; j ++)
gr[i][j] = d;
}
cout << max(cas1, cas2) << endl;
if ('+' == d){
for (int i = 1; i <= N; i ++)
for (int j = 1; j <= M; j ++)
nw[j][i] = gr[i][j];
for (int i = 1; i <= M; i ++)
for (int j = 1; j <= N; j ++)
gr[i][j] = nw[i][j];
swap(N, M);
}
for (int i = 1; i <= N; i ++){
for (int j = 1; j <= M; j ++)
cout << gr[i][j];
cout << endl;
}
}
}
# | 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... |