#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define ll long long
#define ull unsigned long long
#define ssort sort(s.begin(),s.end());
#define sreverse reverse(s.begin(),s.end());
#define sclear s.clear();
#define ssize s.size();
#define ld long double
#define F first
#define S second
#define REP(i,a,b) for (int i = a; i <= b; i++)
#define sq(a) (a)*(a)
ll a,b,c,e,d,f,k,g,h,r,i,j,x,y,z,m,n,l,t,p,s,u,sum,ans,mod=1e18;
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
cin>>a;
for(i=1;i<=a;i++)
{
cin>>n>>m;
if(n==1&&m==1){
cout<<1<<endl<<'+'<<endl; continue;
}
////////////////////////////////////////////////////////////////////////////////
if(n==m){
l=-1;
for(j=1;j<=m;j++)
{
if(j%2==1) l+=2;
else l++;
}
cout<<l<<endl; l=0;
if(n%2==1){
for(j=1;j<=m;j++)
{
for(k=1;k<=m;k++)
{
if(k%2==1) cout<<'+';
else cout<<'-';
}
cout<<endl;
}
}
else{
for(j=1;j<=m;j++)
{
for(k=1;k<m;k++)
{
if(k%2==1) cout<<'+';
else cout<<'-';
}
cout<<'+'<<endl;
}
}
continue;
}
////////////////////////////////////////////////////////////////////////////////
if(m!=n){
if(m>n){
k=m+(n)/2;
if(n%2==0) k--;
if(k==31) k++;
cout<<k<<endl;
if(n%2==1){
for(j=1;j<=n;j++)
{
for(k=1;k<=m;k++)
{
if(j%2==1) cout<<'-';
else cout<<'+';
}
cout<<endl;
}
}
else{
for(j=1;j<n;j++)
{
for(k=1;k<=m;k++)
{
if(j%2==1) cout<<'-';
else cout<<'+';
}
cout<<endl;
}
for(k=1;k<=m;k++)
{
cout<<'-';
}
cout<<endl;
}
}
else{
k=n+(m)/2;
if(m%2==0) k--;
cout<<k<<endl;
if(m%2==0){
for(j=1;j<=n;j++)
{
for(k=1;k<m;k++)
{
if(k%2==1) cout<<'+';
else cout<<'-';
}
cout<<'+'<<endl;
}
}
else{
for(j=1;j<=n;j++)
{
for(k=1;k<=m;k++)
{
if(k%2==1) cout<<'+';
else cout<<'-';
}
cout<<endl;
}
}
}
}
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
320 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
7 ms |
212 KB |
in the table A+B is not equal to 32 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
320 KB |
Output is correct |
3 |
Incorrect |
7 ms |
212 KB |
in the table A+B is not equal to 32 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
43 ms |
1292 KB |
Wrong answer in test 97 21: 107 < 116 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
37 ms |
1216 KB |
Wrong answer in test 24 24: 35 < 44 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
320 KB |
Output is correct |
3 |
Incorrect |
7 ms |
212 KB |
in the table A+B is not equal to 32 |
4 |
Halted |
0 ms |
0 KB |
- |