#include <bits/stdc++.h>
//#include "grader.h"
#define respagold ios_base::sync_with_stdio(0), cin.tie(0);
#define int long long
#define ll long long
#define int2 __int128_t
#define FOR( i, x, n, d ) for( int i = x; i <= n; i += d )
#define FORR( i, x, n, d ) for( int i = x; i >= n; i -= d )
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x.size())
#define pb push_back
#define ins insert
#define lb lower_bound
#define ub upper_bound
#define pii pair <int, int>
#define mkp make_pair
using namespace std;
const int N1 = 2e5 + 123;
int a[N1], b[N1], c[N1], n, m, k, z, w, ans, x, y;
char mat[101][101];
bool okn, okm;
mt19937 rng( chrono::steady_clock::now().time_since_epoch().count());
int rand( int l, int r )
{
uniform_int_distribution <int> uid( l, r );
return uid( rng );
}
void mini( int x, int y, int tp )
{
if( tp == 2 )
{
mat[x][y] = 'X';
n = x + 1, m = y + 1;
}
if( tp == 3 )
{
mat[x][y] = mat[x][y + 1] = 'X';
n = x + 1, m = y + 2;
}
if( tp == 4 )
{
mat[x][y] = mat[x][y + 1] = mat[x + 1][y] = 'X';
n = x + 2, m = y + 2;
}
if( tp == 5 )
{
mat[x][y] = mat[x][y + 1] = mat[x + 1][y + 1] = 'X';
mat[x + 1][y] = 'r';
n = x + 2, m = y + 2;
}
}
void change( int tp )
{
if( tp == 1 ) mat[x + 2][y] = 'X', okn = 1;
if( tp == 2 ) mat[x + 2][y + 1] = 'X', okn = 1;
if( tp == 3 ) mat[x + 1][y + 2] = 'X', okm = 1;
if( tp == 4 ) mat[x][y + 2] = 'X', okm = 1;
}
void solve()
{
cin >> k;
FOR( i, 1, 100, 1 )
{
FOR( j, 1, 100, 1 ) mat[i][j] = '.';
}
x = 1;
FOR( i, 0, 23, 1 )
{
if( k / x % 6 != 0 ) a[i] = k / x % 6, z = i;
x *= ( i == 23 ? 0 : 6 );
}
x = 1, y = 1, w = 0;
if( k < 6 ) mini( x, y, k );
while( w < z )
{
mat[x][y] = mat[x + 1][y] = mat[x][y + 1] = mat[x + 1][y + 1] = 'X';
mat[x + 2][y] = mat[x + 2][y + 1] = 'r';
mat[x][y + 2] = mat[x + 1][y + 2] = 'd';
okn = 0, okm = 0;
n = x + 2;
m = y + 2;
if( a[w] == 1 ) change(1);
if( a[w] == 2 ) change(1), change(4);
if( a[w] == 3 ) change(1), change(3);
if( a[w] == 4 ) change(2), change(3);
if( a[w] == 5 ) change(1), change(2), change(4);
w ++, x += 2, y += 2, n += okn, m += okm;
if( w == z ) mini( x, y, a[z] );
}
cout << n << ' ' << m << '\n';
FOR( i, 1, n, 1 )
{
FOR( j, 1, m, 1 )
{
if( i == n && j == m ) cout << '.';
else if( i == n ) cout << 'r';
else if( j == m ) cout << 'd';
else cout << mat[i][j];
}
cout << '\n';
}
}
signed main()
{
// freopen("connect.in", "r", stdin);
// freopen("connect.out", "w", stdout);
respagold
int test = 1;
if( !test ) cin >> test;
while( test -- )
{
solve();
}
}
// solved by KluydQ
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |