#include<bits/stdc++.h>
#define int long long
#define pb push_back
#define mp make_pair
using namespace std;
const int mod = 1e9 + 7;
const int inf = 1e12*2;
const int N = 2e5 + 5;
int32_t main(){
cin.tie(0); cout.tie(0);
ios_base::sync_with_stdio(false);
int t;
cin>>t;
while(t--){
int n, m;
cin>>n>>m;
if(n%2 == 1 && m%2 == 1){
if(n == 1){
cout<<m<<endl;
for(int i = 0; i < m; i++){
cout<<"-";
}
cout<<endl;
}
else if(m == 1){
cout<<n<<endl;
for(int i = 0; i < n; i++){
cout<<"+"<<endl;
}
}
else{
cout<<n + m - 2<<endl;
vector<vector<char> > a(n, vector<char>(m, '-'));
for(int i = 0; i < n/2; i++){
for(int j = 0; j < m/2; j++){
a[i][j] = '+';
a[n - i - 1][m - j - 1] = '+';
}
}
for(int i = 0; i < n; i++){
a[i][m/2] = '+';
}
for(int i = 0; i < n; i++){
for(int j = 0; j < m; j++){
cout<<a[i][j];
}
cout<<endl;
}
}
}
else{
cout<<m<<endl;
for(int i = 0; i < n; i++){
for(int j = 0; j < m; j++){
cout<<"-"<<endl;
}
cout<<endl;
}
}
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
452 KB |
Output is correct |
2 |
Incorrect |
1 ms |
348 KB |
Wrong answer in test 2 1: 1 < 2 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
16 ms |
344 KB |
Wrong answer in test 2 1: 1 < 2 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
452 KB |
Output is correct |
2 |
Incorrect |
1 ms |
348 KB |
Wrong answer in test 2 1: 1 < 2 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
43 ms |
1460 KB |
Output is correct |
2 |
Correct |
20 ms |
1880 KB |
Output is correct |
3 |
Correct |
20 ms |
1972 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
539 ms |
2132 KB |
Wrong answer |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
452 KB |
Output is correct |
2 |
Incorrect |
1 ms |
348 KB |
Wrong answer in test 2 1: 1 < 2 |
3 |
Halted |
0 ms |
0 KB |
- |