#include <bits/stdc++.h>
using namespace std;
int main() {
int T = 1;
cin >> T;
while(T--) {
int n, m, best_i = 0, best_j = 0;
cin >> n >> m;
for(int i = 0; i <= n; ++i) {
for(int j = 0; j <= m; ++j) {
int plus = i * (m / 2 + 1);
int minus = j * (n / 2 + 1);
if(plus + minus <= n * m) {
if(!i || !j || m / 2 + 1 < m - j + 1 || n - (m / 2 + 1) >= n / 2 + 1) {
if(i + j > best_i + best_j) {
best_i = i; best_j = j;
}
}
}
}
}
cout << best_i + best_j << '\n';
for(int i = 1; i <= n; ++i) {
for(int j = 1; j <= m; ++j) {
if(i <= best_i && j <= m / 2 + 1) {
cout << '+';
} else {
cout << '-';
}
}
cout << '\n';
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Incorrect |
0 ms |
256 KB |
Wrong answer in test 3 4: 4 < 5 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
384 KB |
Wrong answer in test 3 45: 45 < 46 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Incorrect |
0 ms |
256 KB |
Wrong answer in test 3 4: 4 < 5 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
44 ms |
1400 KB |
in the table A+B is not equal to 116 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
45 ms |
1376 KB |
Wrong answer in test 24 24: 35 < 44 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Incorrect |
0 ms |
256 KB |
Wrong answer in test 3 4: 4 < 5 |