Submission #337833

#TimeUsernameProblemLanguageResultExecution timeMemory
337833mosiashvililukaRed-blue table (IZhO19_stones)C++14
17 / 100
82 ms1672 KiB
#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+1; 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; if(c<0) continue; //zx=x*z-(m-a)*x; if(zx%a!=0) xc=1; else xc=0; xc+=zx/a; //cout<<x<<" "<<a<<" "<<xc<<endl; if(xc<=n-n/2-1){ 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; //cout<<pas1<<" "<<pas2<<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>a+1) j=1; } for(ii=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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...