#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
#define endl '\n'
#define pi pair<int, int>
int n, m;
void answer(){
cin >> n >> m;
int t;
if(n < m){
t = (n - 1) / 2;
cout << (m + t) << endl;
for(int i = 0; i < n; i++){
for(int j = 0; j < m; j++){
cout << (i < t ? '+' : '-');
}
cout << endl;
}
}else if(n > m || (n == m && n == 3)){
t = (m - 1) / 2;
cout << (n + t) << endl;
for(int i = 0; i < n; i++){
for(int j = 0; j < m; j++){
cout << (j < t ? '-' : '+');
}
cout << endl;
}
}else{
t = (n - 1) / 2;
cout << (4 * t) << endl;
for(int i = 0; i < n; i++){
for(int j = 0; j < m; j++){
if(i < t && j < m - t) cout << '+';
else if(i > n - t - 1 && j > t - 1) cout << '+';
else cout << '-';
}
cout << endl;
}
}
}
int main(){
ios::sync_with_stdio(false);
cin.tie(NULL);
int t;
cin >> t;
for(int i = 0; i < t; i++) answer();
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
376 KB |
Output is correct |
2 |
Incorrect |
5 ms |
376 KB |
in the table A+B is not equal to 0 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
376 KB |
in the table A+B is not equal to 0 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
376 KB |
Output is correct |
2 |
Incorrect |
5 ms |
376 KB |
in the table A+B is not equal to 0 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
31 ms |
1400 KB |
Wrong answer in test 97 21: 107 < 116 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
32 ms |
1400 KB |
in the table A+B is not equal to 0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
376 KB |
Output is correct |
2 |
Incorrect |
5 ms |
376 KB |
in the table A+B is not equal to 0 |