#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+1)/2; 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 |
300 KB |
Output is correct |
2 |
Incorrect |
1 ms |
212 KB |
in the table A+B is not equal to 5 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
296 KB |
in the table A+B is not equal to 5 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
300 KB |
Output is correct |
2 |
Incorrect |
1 ms |
212 KB |
in the table A+B is not equal to 5 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
30 ms |
1208 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 |
1292 KB |
in the table A+B is not equal to 35 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
300 KB |
Output is correct |
2 |
Incorrect |
1 ms |
212 KB |
in the table A+B is not equal to 5 |
3 |
Halted |
0 ms |
0 KB |
- |