#include <bits/stdc++.h>
using namespace std;
void process(){
int n, m; cin >> n >> m;
int swapped = 0;
if (n < m){
swap(n, m);
swapped = 1;
}
vector <string> s(n);
for (int i = 0; i < n; ++ i)
for (int j = 0; j < m; ++ j)
s[i] = s[i] + '+';
int res = n, x = 0, c = 0;
for (int loops = 0; loops < (m - 1) / 2; ++ loops){
for (int i = 0; i < n; ++ i){
s[i][x] = '-';
c ++;
if (c > n / 2){
c = 0, x ++, res ++;
}
}
}
cout << res << "\n";
if (!swapped){
for (int i = 0; i < n; ++ i)
cout << s[i] << "\n";
return;
}
for (int j = 0; j < m; ++ j){
for (int i = 0; i < n; ++ i)
if (s[i][j] == '+') cout << '-';
else cout << '+';
cout << "\n";
}
}
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
int t; cin >> t; while (t --)
process();
return 0;
}
# | 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... |