#include <bits/stdc++.h>
using namespace std;
/*
6 6
++++--
------
------
--++++
--++++
7 7
++++---
++++---
++++---
---+---
---++++
---++++
---++++
*/
void solve() {
int n, m;
cin >> n >> m;
if (n == 1) {
cout << "1\n+\n";
return;
}
if (n % 2 == 0) {
int x = 1 - n % 2;
cout << n + (n / 2 - x) << '\n';
for (int i = 0; i < n; i++) {
for (int j = 0; j < m / 2 + m % 2 + x; j++) {
cout << '+';
}
for (int j = m / 2 + m % 2 + x; j < m; j++) {
cout << '-';
}
cout << '\n';
}
return;
}
cout << 2 * n - 2 << '\n';
for (int i = 0; i < n / 2; i++) {
for (int j = 0; j < n / 2 + n % 2; j++) {
cout << '+';
}
for (int j = n / 2 + n % 2; j < n; j++) {
cout << '-';
}
cout << '\n';
}
for (int i = 0; i < n; i++) {
cout << '-';
}
cout << '\n';
for (int i = 0; i < n / 2; i++) {
for (int j = 0; j < n / 2 ; j++) {
cout << '-';
}
for (int j = n / 2; j < n; j++) {
cout << '+';
}
cout << '\n';
}
}
int main() {
int t;
cin >> t;
while (t--) {
solve();
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
204 KB |
Wrong answer |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
368 KB |
Wrong answer |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
204 KB |
Wrong answer |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
63 ms |
1540 KB |
Wrong answer |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
33 ms |
1220 KB |
Wrong answer in test 24 24: 35 < 44 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
204 KB |
Wrong answer |
2 |
Halted |
0 ms |
0 KB |
- |