#include "bits/stdc++.h"
using namespace std;
// #define endl '\n'
// #define double long double
// #define int long long
// int MOD = 1000 * 1000 * 1000 + 7;
// int MOD = 998244353;
void solve() {
int x, y;
cin >> x >> y;
if (x == y) {
cout << x << endl;
string s(y, '-');
for (int i=0; i<x; i++) {
cout << s << endl;
}
return;
}
int A = (x - 1) / 2 + y;
int B = (y - 1) / 2 + x;
int grid[x][y];
if (A > B) {
// pick all y columns
memset(grid, 0, sizeof grid);
int L = (x-1) / 2;
for (int i=0; i<L; i++) {
for (int j=0; j<y; j++) {
grid[i][j] = 1;
}
}
}
else {
// pick all x rows
memset(grid, 1, sizeof grid);
int L = (y - 1) / 2;
for (int i=0; i<x; i++) {
for (int j=0; j<L; j++) {
grid[i][j] = 0;
}
}
}
cout << max(A, B) << endl;
for (int i=0; i<x; i++) {
for (int j=0; j<y; j++) {
cout << (grid[i][j] ? '+' : '-');
}
cout << endl;
}
}
signed main() {
int t;
cin >> t;
while (t--) solve();
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
384 KB |
Wrong answer in test 3 3: 3 < 4 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
13 ms |
384 KB |
Wrong answer in test 3 3: 3 < 4 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
384 KB |
Wrong answer in test 3 3: 3 < 4 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
76 ms |
1400 KB |
Wrong answer in test 97 21: 107 < 116 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
26 ms |
1272 KB |
Wrong answer in test 24 24: 24 < 44 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
384 KB |
Wrong answer in test 3 3: 3 < 4 |
2 |
Halted |
0 ms |
0 KB |
- |