#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int maxn=1e3+5;
int tt;
int n,m,num,num1;
char c[maxn][maxn];
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
cin >> tt;
while(tt--){
cin >> n >> m;
num = (n - 1) / 2;
num1 = (m - 1) / 2;
if(m + num > n + num1){
cout << m + num <<'\n';
for(int i = 1;i <= num;i++)
for(int j = 1;j <= m;j++) c[i][j]='+';
for(int i = num+1;i <= n;i++)
for(int j = 1;j <= m;j++) c[i][j]='-';
}
else {
cout<<n+num1<<'\n';
for(int i = 1;i <= num1;i++)
for(int j = 1;j <= n;j++) c[j][i]='-';
for(int i = num1+1;i <= m;i++)
for(int j = 1;j <= n;j++) c[j][i]='+';
}
for(int i = 1;i <= n;i++){
for(int j = 1;j <= m;j++) cout<<c[i][j];
cout<<'\n';
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Correct |
1 ms |
364 KB |
Output is correct |
4 |
Incorrect |
3 ms |
492 KB |
Wrong answer in test 5 29: 31 < 32 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
35 ms |
1516 KB |
Wrong answer in test 97 21: 107 < 116 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
33 ms |
1516 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 |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Correct |
1 ms |
364 KB |
Output is correct |
4 |
Incorrect |
3 ms |
492 KB |
Wrong answer in test 5 29: 31 < 32 |