This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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";
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |