#include <bits/stdc++.h>
using namespace std;
void Solve() {
int n, m, ans = 0;
cin >> n >> m;
pair<int, int> best = {0, 0};
for (int i = 0; i <= n; ++ i) {
for (int j = 0; j <= m; ++j) {
int curr = j * (i * 2 > n) + i * (j * 2 < m) + (n - i);
if (curr > ans) {
ans = curr;
best = {i, j};
}
}
}
cout << ans << '\n';
for (int i = 0; i < n; ++i) {
for (int j = 0; j < m; ++j) {
if (i < best.first && j < best.second) cout << '-';
else cout << '+';
}
cout << '\n';
}
}
int main() {
ios::sync_with_stdio(false); cin.tie(NULL);
int test;
cin >> test;
while (test--) Solve();
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
332 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
332 KB |
Output is correct |
4 |
Incorrect |
2 ms |
336 KB |
Wrong answer in test 5 29: 31 < 32 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
35 ms |
1252 KB |
Wrong answer in test 97 21: 107 < 116 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
37 ms |
1228 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 |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
332 KB |
Output is correct |
4 |
Incorrect |
2 ms |
336 KB |
Wrong answer in test 5 29: 31 < 32 |