Submission #337826

#TimeUsernameProblemLanguageResultExecution timeMemory
337826mosiashvililukaRed-blue table (IZhO19_stones)C++14
0 / 100
85 ms1568 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+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=n; a>=1; a--){ zx=x*z-(m-a)*x; if(zx%a!=0) xc=1; else xc=0; xc+=zx/a; if(xc<=m-z){ 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 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...