#include<bits/stdc++.h>
using namespace std;
int a,b,c,d,e,i,j,ii,jj,pas,pas1,pas2,z,x,tes,t,n,m,zx,xc;
char ch[1009][1009];
int main(){
ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
cin>>tes;
for(t=1; t<=tes; t++){
cin>>n>>m;
z=m/2+m%2;
if(n>=m){
pas=n;
pas1=n;
pas2=0;
}else{
pas=m;
pas1=0;
pas2=m;
}
for(x=0; x<=n; x++){
for(a=m; a>=1; a--){
c=z-(m-a);zx=c*x;
//zx=x*z-(m-a)*x;
if(zx%a!=0) xc=1; else xc=0;
xc+=zx/a;
if(xc<=n-n/2-n%2){
if(pas<a+x){
pas=a+x;
pas1=x;
pas2=a;
}
}
}
}
for(i=1; i<=n; i++){
for(j=1; j<=m; j++) ch[i][j]='-';
}
cout<<pas<<endl;
j=1;
a=pas2;
for(i=1; i<=pas1; i++){
for(ii=1; ii<=z-(m-a); ii++){
ch[i][j]='+';
j++;
if(j>m-a) j=1;
}
for(ii=m-a+1; ii<=m; ii++) ch[i][ii]='+';
}
for(i=1; i<=n; i++){
for(j=1; j<=m; j++){
cout<<ch[i][j];
}
cout<<endl;
}
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Incorrect |
1 ms |
364 KB |
in the table A+B is not equal to 2 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
11 ms |
364 KB |
in the table A+B is not equal to 2 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Incorrect |
1 ms |
364 KB |
in the table A+B is not equal to 2 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
90 ms |
1664 KB |
in the table A+B is not equal to 116 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
63 ms |
1516 KB |
in the table A+B is not equal to 48 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Incorrect |
1 ms |
364 KB |
in the table A+B is not equal to 2 |