// #include <bits/stdc++.h>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <map>
#include <unordered_map>
#include <vector>
#include <iomanip>
#include <string>
#include <queue>
#include <set>
#include <deque>
using namespace std;
#define int long long
#define endl "\n"
#define fi first
#define se second
const int M=1e9+7;
const int inf = 1e15;
const int LOG=17;
const int N=2e5+5;
int n , m , c , w , k , t=1 , q=1 , x , y , z , l , r;
int dp[120][120][2];
void solve(){
cin >> k;
if (k<=19){
int f=5;
string s;
for (int i=0;i<f;i++)s+='.';
vector<string>a(f,s);
for (int i=0;i<f-1;i++){
a[f-1][i]='r';
a[i][f-1]='d';
}
for (int i=1;i<4;i++){
a[2][i]='r';
}
a[0][0]='X';
k-=2;
if (k>=1){
a[0][1]='X';
k--;
}
if (k>=1){
a[0][2]='X';
k--;
}
if (k>=1){
a[0][3]='X';
k--;
}
if (k>=1){
a[1][0]='X';
k--;
}
if (k>=2){
a[1][1]='X';
k-=2;
}
if (k>=3){
a[1][2]='X';
k-=3;
}
if (k>=4){
a[1][3]='X';
k-=4;
}
if (k>=1){
a[2][0]='X';
k--;
}
if (k>=1){
a[3][0]='X';
k--;
}
if (k>=1){
a[3][1]='X';
k--;
}
if (k>=1){
a[3][2]='X';
k--;
}
if (k>=1){
a[3][3]='X';
k--;
}
cout << f << " " << f << endl;
for (string i:a){
cout << i << endl;
}
}
else{
int f=117;
string s;
for (int i=0;i<f;i++)s+='.';
vector<string>a(f,s);
for (int i=0;i<f-1;i++){
a[f-1][i]='r';
a[i][f-1]='d';
}
dp[0][0][0]=dp[0][0][1]=1;
a[0][0]='X';
k-=2;
for (int i=0;i<f-1;i++){
for (int j=0;j<f-1;j++){
if (i==0 and j==0)continue;
int u=0;
if (i){
u+=dp[i-1][j][0];
dp[i][j][0]=dp[i-1][j][0];
}
if (j){
u+=dp[i][j-1][1];
dp[i][j][1]=dp[i][j-1][1];
}
if (k>=u){
k-=u;
a[i][j]='X';
dp[i][j][0]=dp[i][j][1]=u;
}
}
}
cout << f << " " << f << endl;
for (string i:a){
cout << i << endl;
}
}
}
signed main()
{
// #ifndef ONLINE_JUDGE
// freopen("input.txt","r" ,stdin);
// freopen("output.txt","w",stdout);
// #endif
ios::sync_with_stdio(0);//DO NOT USE IN INTERACTIVE
cin.tie(0), cout.tie(0);//DO NOT USE IN INTERACTIVE
cout << fixed << setprecision(9);
srand(time(0));
// int t=1;
// cin >> t;
for (int _=1;_<=t;_++){
solve();
q++;
}
}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |