This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <iostream>
using namespace std;
long long m[60][60],k;
char r[60][60];
int main()
{
cin>>k;
r[1][1]='X';
m[1][1]=1;
for(long long i=1;i<=48;++i)
for(long long j=1;j<=48;++j)
{
if(i<=j)
{
if(j-i<=2)
{
r[i][j]='X';
m[i+1][j]+=m[i][j];
m[i][j+1]+=m[i][j];
}
else
{
r[i][j]='.';
m[i][j+1]+=m[i][j];
}
}
else
{
if(i-j==1)
{
r[i][j]='X';
m[i][j+1]+=m[i][j];
m[i+1][j]+=m[i][j];
}
else
{
r[i][j]='.';
m[i+1][j]+=m[i][j];
}
}
}
long long n=46;
while(m[n][n]>k)
--n;
cout<<n+1<<' '<<n+1<<'\n';
k-=m[n][n];
r[n][n]='.';
for(long long i=n-1;i>=1;--i)
{
if(m[i][n]>k)
r[i][min(i+2,n)]='d';
else
k-=m[i][n];
if(m[n][i]>k)
r[i+1][i]='r';
else
k-=m[n][i];
}
for(long long i=1;i<=n;++i)
{
for(long long j=1;j<=n;++j)
cout<<r[i][j];
cout<<'d'<<'\n';
}
for(long long i=1;i<=n;++i)
cout<<'r';
cout<<'.';
//cout<<k;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |