#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
int t,n,m;
ios_base::sync_with_stdio(false);
cin.tie(0);
cin>>t;
for(int q=0;q<t;q++)
{
cin>>n>>m;
int res1=n>>1,res2=m>>1;
if(!(n&1))res1--;
if(!(m&1))res2--;
if(n+res2>=m+res1)//build more rows
{
cout<<n+res2<<"\n";
string row="";
for(int i=0;i<m-res2;i++)row+="+";
for(int i=m-res2;i<m;i++)row+="-";
for(int i=0;i<n;i++)cout<<row<<"\n";
}
else //build more columns
{
cout<<m+res1<<"\n";
string row1="",row2="";
for(int i=0;i<m;i++){row1+="-";row2+="+";}
for(int i=0;i<n-res1;i++)cout<<row1<<"\n";
for(int i=n-res1;i<n;i++)cout<<row2<<"\n";
}
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Incorrect |
1 ms |
348 KB |
Wrong answer in test 5 29: 31 < 32 |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
1372 KB |
Wrong answer in test 97 21: 107 < 116 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
1372 KB |
Wrong answer in test 24 24: 35 < 44 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Incorrect |
1 ms |
348 KB |
Wrong answer in test 5 29: 31 < 32 |
5 |
Halted |
0 ms |
0 KB |
- |