#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll k;
int n;
vector<int> v;
string ans[49], pa[7]={"", "....", "X...", "XX..", "XXX.", "XdXX", "XXXX"};
int main() {
cin>>k;
while (k) {
v.push_back(k%6);
k/=6;
}
n=2*v.size()+1;
for (int i=0; i<n; ++i) {
ans[i]=string(n, i<n-1 ? '.' : 'r');
ans[i][n-1]= i < n-1 ? 'd' : '.';
}
auto p = [&](int i, int x, int y) {
ans[i][i+2]=ans[i+1][i+2]='d';
ans[i+2][i]=ans[i+2][i+1]='r';
for (int j1 : {0, 1}) {
for (auto j2 : {0, 1}) {
ans[i+j1][i+j2]=pa[x][j1*2+j2];
}
}
if (y%3) ans[i+2][i]='X';
if (y%3 == 2) ans[i][i+2]='X';
if (y >= 3) ans[i+1][i+2]='X';
};
for (int i=0; i<(int)v.size(); ++i) {
p(2*i, i+1 < (int)v.size() ? 6 : v[i], i+1 < (int)v.size() ? v[i] : 0);
}
cout<<n<<" "<<n<<"\n";
for (int i=0; i<n; ++i) cout<<ans[i]<<"\n";
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Correct! Your size: 3 |
2 |
Correct |
1 ms |
348 KB |
Correct! Your size: 3 |
3 |
Correct |
0 ms |
436 KB |
Correct! Your size: 3 |
4 |
Correct |
0 ms |
348 KB |
Correct! Your size: 5 |
5 |
Correct |
0 ms |
348 KB |
Correct! Your size: 5 |
6 |
Correct |
1 ms |
348 KB |
Correct! Your size: 5 |
7 |
Correct |
0 ms |
348 KB |
Correct! Your size: 5 |
8 |
Correct |
1 ms |
348 KB |
Correct! Your size: 5 |
9 |
Correct |
0 ms |
348 KB |
Correct! Your size: 5 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Correct! Your size: 47 |
2 |
Correct |
0 ms |
348 KB |
Correct! Your size: 47 |
3 |
Correct |
0 ms |
348 KB |
Correct! Your size: 49 |
4 |
Correct |
0 ms |
368 KB |
Correct! Your size: 47 |
5 |
Correct |
1 ms |
504 KB |
Correct! Your size: 47 |
6 |
Correct |
1 ms |
348 KB |
Correct! Your size: 49 |
7 |
Correct |
1 ms |
348 KB |
Correct! Your size: 49 |
8 |
Correct |
0 ms |
432 KB |
Correct! Your size: 47 |