Submission #518797

#TimeUsernameProblemLanguageResultExecution timeMemory
518797lucriCostinland (info1cup19_costinland)C++17
100 / 100
1 ms336 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...