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<iostream>
using namespace std;
int n, i, j;
long long k, val;
char a[55][55], dir[55][55];
long long d[55][55];
int main(){
cin>> k;
val = 1;
while(val * 6 <= k){
n++;
val *= 6;
}
n = n * 2 + 3;
for(i = 1; i <= n; i++){
for(j = 1; j <= n; j++){
a[i][j] = '.';
}
}
for(i = 1; i < n; i++){
a[n][i] = 'r';
a[i][n] = 'd';
}
for(i = 1; i < n - 3; i += 2){
a[i][i] = a[i + 1][i] = a[i][i + 1] = a[i + 1][i + 1] = 'X';
a[i][i + 2] = a[i + 1][i + 2] = 'd';
a[i + 2][i] = a[i + 2][i + 1] = 'r';
if(k % 6 == 1){
a[i + 2][i] = 'X';
}
if(k % 6 == 2){
a[i + 2][i] = a[i][i + 2] = 'X';
}
if(k % 6 == 3){
a[i + 2][i + 1] = 'X';
}
if(k % 6 == 4){
a[i + 2][i] = a[i + 2][i + 1] = 'X';
}
if(k % 6 == 5){
a[i + 2][i] = a[i + 2][i + 1] = a[i][i + 2] = 'X';
}
k /= 6;
}
if(k == 2){
a[i][i] = 'X';
}
if(k == 3){
a[i][i] = 'X';
a[i + 1][i] = 'X';
}
if(k == 4){
a[i][i] = a[i + 1][i] = a[i][i + 1] = 'X';
}
if(k == 5){
a[i][i] = a[i + 1][i + 1] = a[i + 1][i] = 'X';
a[i][i + 1] = 'd';
}
cout<< n <<" "<< n <<"\n";
for(i = 1; i <= n; i++){
for(j = 1; j <= n; j++){
cout<< a[i][j];
}
cout<<"\n";
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |