//gm --- akezhon
#include <bits/stdc++.h>
// #pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define pb push_back
#define pf push_front
#define F first
#define S second
#define all(v) v.begin(),v.end()
#define pii pair<int,int>
#define tm (tl+tr)/2
#define TL v+v, tl, tm
#define TR v+v+1, tm+1, tr
#define DA l <= tl && tr <= r
#define NE r < tl || tr < l
#define double long double
#define int long long
using namespace std;
const int N=2e5+7;
const int mod=998244353;
const int inf=2e18;
void AlemAmenov(){
int k;
cin >> k;
int sz=49;
if(k<=19)sz=5;
char c[51][51];
for(int i=1; i <= sz; i++){
for(int j=1; j <= sz; j++){
c[i][j]='.';
}
c[i][sz]='d';
c[sz][i]='r';
}
c[sz][sz]='.';
vector<pii>v;
int cur=1, mult=1;
while(k){
while(mult*6 <= k)mult*=6, cur++;
while(k < mult)mult/=6, cur--;
v.pb({cur, k/mult});
k%=mult;
}
reverse(all(v));
for(int i=1; i < v.back().F*2-1; i+=2){
c[i][i]=c[i+1][i]=c[i][i+1]=c[i+1][i+1]='X';
c[i+2][i]=c[i+2][i+1]='r';
c[i][i+2]=c[i+1][i+2]='d';
}
for(int i=0; i < v.size()-1; i++){
int x = v[i].F*2-1;
if(v[i].S==1)c[x][x+2]='X';
if(v[i].S==2)c[x][x+2]=c[x+2][x]='X';
if(v[i].S==3)c[x+1][x+2]='X';
if(v[i].S==4)c[x][x+2]=c[x+1][x+2]='X';
if(v[i].S==5)c[x][x+2]=c[x+1][x+2]=c[x+2][x]='X';
}
int x = v.back().F*2-1;
if(v.back().S==2)c[x][x]='X';
if(v.back().S==3)c[x][x]=c[x][x+1]='X';
if(v.back().S==4)c[x][x]=c[x][x+1]=c[x+1][x]='X';
if(v.back().S==5)c[x][x]=c[x][x+1]=c[x+1][x+1]='X';
cout << sz << ' ' << sz << '\n';
for(int i=1; i <= sz; i++){
for(int j=1; j <= sz; j++){
cout << c[i][j];
}
cout << '\n';
}
}
signed main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
int RealName=1;
// cin >> RealName;
// srand(time(0));
while(RealName--)
AlemAmenov();
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |