#include <bits/stdc++.h>
using namespace std;
int main(){
int t;
cin >> t;
while(t--){
int n, m;
cin >> n >> m;
int opt = 0, can = -1;
for (int i = 0; i <= n; i++){
int total = (n-i)*m + i*(m - (m/2+1)), need = n/2 + 1;
int new_can = min(total/need, m);
if (new_can+i > opt+can) opt = i, can = new_can;
}
cout << can + opt << endl;
for (int i = 0; i < n; i++){
for (int j = 0; j < m; j++){
if (i >= opt) cout << '-';
else{
if (j < min(can, m - (m/2+1))) cout << '-';
else cout << '+';
}
}
cout << endl;
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Incorrect |
1 ms |
212 KB |
in the table A+B is not equal to 5 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
7 ms |
212 KB |
in the table A+B is not equal to 5 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Incorrect |
1 ms |
212 KB |
in the table A+B is not equal to 5 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
65 ms |
1200 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 |
33 ms |
1296 KB |
in the table A+B is not equal to 44 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Incorrect |
1 ms |
212 KB |
in the table A+B is not equal to 5 |
3 |
Halted |
0 ms |
0 KB |
- |