#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int Size=1e3+10;
char ans[Size][Size];
void solve(){
ll n,m;
cin>>n>>m;
if(n>m){
for(ll i=0;i<m;i++){
for(ll j=0;j<n;j++){
i%2==0 ? ans[j][i]='+' : ans[j][i]='-';
}
}
if(m%2==0){
for(ll i=0;i<n;i++){
ans[i][m-1]='+';
}
}
}else{
for(ll i=0;i<n;i++){
for(ll j=0;j<m;j++){
i%2==0 ? ans[i][j]='-' : ans[i][j]='+';
}
}
if(n%2==0){
for(ll i=0;i<m;i++){
ans[n-1][i]='-';
}
}
}
cout<<max(n,m)+(min(n,m)-1)/2<<endl;
for(ll i=0;i<n;i++){
for(ll j=0;j<m;j++){
cout<<ans[i][j];
}
cout<<endl;
}
}
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
ll t=1;
cin>>t;
while(t--){
solve();
}
return 0;
}
# |
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 |
6 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 |
6 ms |
332 KB |
Output is correct |
4 |
Incorrect |
10 ms |
416 KB |
Wrong answer in test 5 29: 31 < 32 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
49 ms |
1316 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 |
1344 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 |
6 ms |
332 KB |
Output is correct |
4 |
Incorrect |
10 ms |
416 KB |
Wrong answer in test 5 29: 31 < 32 |