#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define int ll
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define REP1(i, n) FOR(i, 1, n+1)
#define RREP(i, n) for (int i = (n)-1; i >= 0; i--)
#define RREP1(i, n) for (int i = (n); i >= 1; i--)
#define pii pair<int, int>
#define f first
#define s second
#define pb push_back
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) (int)((x).size())
#ifdef TOAD
#define IOS()
#else
#define IOS() ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#endif
const ll maxn = 505;
const ll mod = 1e9+7;
const ll inf = 1ll<<60;
int K;
char arr[maxn][maxn];
signed main(){
IOS();
cin>>K;
if (K <= 19){
K--;
REP(i, 6) REP(j, 6) arr[i][j] = '.';
REP1(i, 4) {
arr[5][i] = 'r';
arr[i][5] = 'd';
}
RREP1(i, 4){
for (int j = 5; j >= 2; j--){
if (j == 5) j = 1;
if (K > 0){
arr[i][j] = 'X';
if (j > 1 && i < 4) arr[i][j] = 'd';
K--;
}
if (j == 1) j = 5;
}
}
if (arr[1][1] == '.'){
arr[1][1] = 'd';
}
if (K >= 1){
arr[1][2] = 'X';
arr[1][3] = 'r';
arr[1][4] = (K==1?'r':'d');
}
cout<<5<<' '<<5<<endl;
REP1(i, 5){
REP1(j, 5){
cout<<arr[i][j];
}
cout<<endl;
}
}
else{
K--;
cout<<61<<' '<<61<<endl;
REP1(i, 62){
REP1(j, 62){
arr[i][j] = '.';
}
}
int cur = 59;
REP1(i, 61){
if (i == 1){
if (K&1) arr[i][1] = 'X';
else arr[i][1] = 'd';
arr[i][61] = 'd';
}
else if (i == 61){
REP1(j, 61){
arr[i][j] = 'r';
if (j == 61) arr[i][j] = '.';
}
}
else{
if (K&(1ll<<cur)){
arr[i][1] = 'X';
}
else arr[i][1] = 'd';
REP(j, cur){
arr[i][j+2] = 'X';
}
arr[i][61] = 'd';
cur--;
}
}
REP1(i, 61){
REP1(j, 61){
cout<<arr[i][j];
}
cout<<endl;
}
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |