# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
523862 | Baytoro | Costinland (info1cup19_costinland) | C++17 | 1 ms | 324 KiB |
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 <bits/stdc++.h>
using namespace std;
#define Baytoro_MayrambekovOrz void solve()
#define ios ios::sync_with_stdio(false); cin.tie(NULL);
#define pb push_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define fr first
#define sc second
#define int long long
#define endl '\n'
#define yes cout<<"YES\n";
#define no cout<<"NO\n";
void fopn(string name){
freopen((name+".in").c_str(),"r",stdin);
freopen((name+".out").c_str(),"w",stdout);
}
int binpow(int a,int n){
if(n==0)
return 1;
if(n%2==1)
return binpow(a, n-1)*a;
else{
int b=binpow(a, n/2);
return b*b;
}
}
char ar[55][55];
int dp[55][55];
int a,b,c,n,m,i,j,k,x,y,cnt=0,sum=0,res=0;
Baytoro_MayrambekovOrz{
ar[1][1]='X';
dp[1][1]=1;
for(i=1;i<=48;i++){
for(j=1;j<=48;j++){
if(j>=i){
if(j-i<=2){
ar[i][j]='X';
dp[i+1][j]+=dp[i][j];
dp[i][j+1]+=dp[i][j];
}
else{
ar[i][j]='.';
dp[i][j+1]+=dp[i][j];
}
}
else{
if(i-j==1){
ar[i][j]='X';
dp[i+1][j]+=dp[i][j];
dp[i][j+1]+=dp[i][j];
}
else{
ar[i][j]='.';
dp[i+1][j]+=dp[i][j];
}
}
}
}
cin>>n;
int k=46;
while(dp[k][k]>n)
k--;
cout<<k+1<<' '<<k+1<<endl;
n-=dp[k][k];
ar[k][k]='.';
for(i=k-1;i>=1;i--){
if(dp[i][k]>n)
ar[i][min(i+2,k)]='d';
else
n-=dp[i][k];
if(dp[k][i]>n)
ar[i+1][i]='r';
else
n-=dp[k][i];
}
for(i=1;i<=k;i++){
for(j=1;j<=k;j++){
cout<<ar[i][j];
}
cout<<"d\n";
}
for(i=1;i<=k;i++)
cout<<"r";
cout<<'.';
//cout<<dp[k][k];
}
main(){
// ios;
int T=1;
//cin>>T;
while(T--){
solve();
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |