#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
char s[1002][1002];
int main()
{
int t;
cin >> t;
while (t--)
{
int n, m;
cin >> n >> m;
if (min(n, m) > 2)
{
int ans = n + m - 2;
if (n % 2 == 0)ans--;
if (m % 2 == 0)ans--;
cout << ans << '\n';
int a = n, b = m;
if (a % 2)a--;
else a -= 2;
if (b % 2)b--;
else b -= 2;
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++)
{
if (i < a / 2 && j < b / 2)
cout << '-';
else if (i >= a / 2 && i < a && j >= b / 2 && j < b)
cout << '-';
else if (i >= a)
cout << '-';
else if (j >= b)
cout << '+';
else cout << '+';
}
cout << '\n';
}
}
else
{
cout << max(m, n) << '\n';
char d;
if (m > n)
d = '-';
else d = '+';
for (int i = 0; i < n; i++)
{
for (int j = 0; j < m; j++)
cout << d;
cout << '\n';
}
}
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Incorrect |
1 ms |
364 KB |
Wrong answer in test 4 4: 4 < 5 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
364 KB |
Wrong answer in test 4 3: 4 < 5 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Incorrect |
1 ms |
364 KB |
Wrong answer in test 4 4: 4 < 5 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
45 ms |
1388 KB |
Output is correct |
2 |
Correct |
39 ms |
1260 KB |
Output is correct |
3 |
Correct |
37 ms |
1132 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
46 ms |
1388 KB |
Wrong answer in test 4 4: 4 < 5 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Incorrect |
1 ms |
364 KB |
Wrong answer in test 4 4: 4 < 5 |