#include <iostream>
#include <vector>
using namespace std;
namespace Solution {
char field[1013][1013];
void solve() {
int n, m;
cin >> n >> m;
char start = (n > m ? '+' : '-');
for (int i = 0; i < n; i++) fill(field[i], field[i] + m, start);
int ans = 0;
if (start == '+') {
for (int i = 0; i < m / 2 - (m % 2 == 0); i++) {
for (int j = 0; j < n / 2 + 1; j++) {
field[j][i] = '-';
}
}
ans = n + m / 2 - (m % 2 == 0);
} else {
for (int i = 0; i < n / 2 - (n % 2 == 0); i++) {
for (int j = 0; j < m / 2 + 1; j++) {
field[i][j] = '+';
}
}
ans = m + n / 2 - (n % 2 == 0);
}
cout << ans << '\n';
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
cout << field[i][j];
}
cout << '\n';
}
}
}
int main() {
int t;
cin >> t;
while (t--) {
Solution::solve();
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
4 ms |
376 KB |
Output is correct |
4 |
Incorrect |
6 ms |
376 KB |
Wrong answer in test 5 29: 31 < 32 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
44 ms |
1500 KB |
Wrong answer in test 97 21: 107 < 116 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
44 ms |
1512 KB |
Wrong answer in test 24 24: 35 < 44 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
4 ms |
376 KB |
Output is correct |
4 |
Incorrect |
6 ms |
376 KB |
Wrong answer in test 5 29: 31 < 32 |