#include <bits/stdc++.h>
using namespace std;
char a[1000][1000];
void solve() {
int n, m, flag = 0;
cin >> n >> m;
if (n < m) {
swap(n, m);
flag = 1;
}
for (int i = 0; i < n; i++)
for (int j = 0; j < m; j++)
a[i][j] = '+';
int J = 0, cnt = n / 2 + 1;
for (int j = 0; j < (m - 1) / 2; j++) {
for (int i = 0; i < n; i++) {
a[i][J] = '-';
cnt--;
if (cnt == 0) {
J++;
cnt = n / 2 + 1;
}
}
}
cout << n + J << '\n';
if (flag) swap(n, m);
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
if (flag) cout << char('+'+'-'-a[j][i]);
else cout << a[i][j];
}
cout << '\n';
}
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int t;
cin >> t;
while (t--)
solve();
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Correct |
1 ms |
364 KB |
Output is correct |
4 |
Correct |
2 ms |
492 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
36 ms |
1516 KB |
Output is correct |
2 |
Correct |
33 ms |
2156 KB |
Output is correct |
3 |
Correct |
33 ms |
2108 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
34 ms |
1516 KB |
Output is correct |
2 |
Correct |
29 ms |
1900 KB |
Output is correct |
3 |
Correct |
26 ms |
1644 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Correct |
1 ms |
364 KB |
Output is correct |
4 |
Correct |
2 ms |
492 KB |
Output is correct |
5 |
Correct |
36 ms |
1516 KB |
Output is correct |
6 |
Correct |
33 ms |
2156 KB |
Output is correct |
7 |
Correct |
33 ms |
2108 KB |
Output is correct |
8 |
Correct |
34 ms |
1516 KB |
Output is correct |
9 |
Correct |
29 ms |
1900 KB |
Output is correct |
10 |
Correct |
26 ms |
1644 KB |
Output is correct |
11 |
Correct |
11 ms |
620 KB |
Output is correct |
12 |
Correct |
27 ms |
1900 KB |
Output is correct |
13 |
Correct |
29 ms |
2028 KB |
Output is correct |
14 |
Correct |
22 ms |
1772 KB |
Output is correct |
15 |
Correct |
35 ms |
2284 KB |
Output is correct |
16 |
Correct |
25 ms |
2048 KB |
Output is correct |
17 |
Correct |
12 ms |
1388 KB |
Output is correct |