#include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin>>t;
while(t--){
int n,m;
cin>>n>>m;
bool s = 0;
if(n < m){
swap(n, m);
s = 1;
}
char grid[n][m];
for(int i = 0; i < n; i++){
for(int j = 0; j < m; j++){
grid[i][j]='+';
}
}
for(int i = 0; i < n/2+1; i++){
for(int j = 0; j < (m-1)/2; j++){
grid[i][j]='-';
}
}
cout<<n+(m-1)/2<<'\n';
if(s){
for(int j = 0; j < m; j++){
for(int i = 0; i < n; i++){
cout<<(grid[i][j]=='+'?'-':'+');
}
cout<<'\n';
}
}else{
for(int i = 0; i < n; i++){
for(int j = 0; j < m; j++){
cout<<grid[i][j];
}
cout<<'\n';
}
}
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
296 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
296 KB |
Output is correct |
3 |
Correct |
2 ms |
212 KB |
Output is correct |
4 |
Incorrect |
4 ms |
340 KB |
Wrong answer in test 5 29: 31 < 32 |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
25 ms |
1252 KB |
Wrong answer in test 97 21: 107 < 116 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
22 ms |
1276 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 |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
296 KB |
Output is correct |
3 |
Correct |
2 ms |
212 KB |
Output is correct |
4 |
Incorrect |
4 ms |
340 KB |
Wrong answer in test 5 29: 31 < 32 |
5 |
Halted |
0 ms |
0 KB |
- |