#include<bits/stdc++.h>
using namespace std;
long long a,b,c,d,e,i,j,ii,jj,zx,xc,K,X[109],Y[109],p[109],pi;
char ch[109][109];
int main(){
ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
for(i=0; i<=100; i++){
for(j=0; j<=100; j++){
ch[i][j]='q';
}
}
cin>>K;
K-=2;
while(K>=6){
pi++;
p[pi]=K%6;
K/=6;
}
pi++;
p[pi]=K-1;
for(i=1; i<=pi/2; i++) swap(p[i],p[pi-i+1]);
/*cout<<pi<<endl;
for(i=1; i<=pi; i++) cout<<p[i]<<" ";
cout<<endl;*/
ch[1][1]='X';
if(p[1]==1){
X[2]=1;Y[2]=1;
ch[2][2]='r';
ch[2][3]='d';
}
if(p[1]==2){
X[2]=1;Y[2]=1;Y[3]=1;
ch[2][2]='r';
ch[2][3]='d';
}
if(p[1]==3){
X[2]=1;Y[2]=1;
ch[2][2]='X';
ch[2][3]='d';
ch[3][2]='r';
}
if(p[1]==4){
X[2]=1;Y[2]=1;
X[3]=1;
ch[2][2]='X';
ch[2][3]='d';
ch[3][2]='r';
}
if(p[1]==0){
X[2]=1;
ch[2][2]='d';
ch[3][2]='r';
}
ch[3][3]='X';
c=3;d=3;
for(i=2; i<=pi; i++){
ch[c][d]='X';
ch[c+1][d]=ch[c][d+1]='X';
ch[c+1][d+1]='X';
ch[c+2][d]=ch[c+2][d+1]='r';
ch[c][d+2]=ch[c+1][d+2]='d';
ch[c+2][d+2]='X';
if(p[i]==1){
X[c+2]=1;
}
if(p[i]==2){
X[c+2]=1;
Y[d+2]=1;
}
if(p[i]==3){
X[c+1]=1;
}
if(p[i]==4){
X[c+1]=1;
X[c+2]=1;
}
if(p[i]==5){
X[c+1]=1;
X[c+2]=1;Y[c+2]=1;
}
c+=2;d+=2;
}
ch[c][d]='d';
c++;d++;
ch[c][d]='.';
for(i=2; i<c; i++){
if(X[i]==1){
ch[i][1]='X';
}else{
ch[i][1]='d';
}
}
for(j=2; j<d; j++){
if(Y[i]==1){
ch[1][j]='X';
}else{
ch[1][j]='r';
}
}
for(i=1; i<=c; i++){
for(j=1; j<=d; j++){
if(ch[i][j]=='q') ch[i][j]='.';
}
}
for(i=1; i<=c; i++){
ch[i][d]='d';
}
for(j=1; j<=d; j++){
ch[c][j]='r';
}
ch[c][d]='.';
cout<<c<<" "<<d<<endl;
for(i=1; i<=c; i++){
for(j=1; j<=d; j++){
cout<<ch[i][j];
}
cout<<endl;
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Correct! Your size: 4 |
2 |
Incorrect |
1 ms |
204 KB |
The matrix does not generate the required number of Costins |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
The matrix does not generate the required number of Costins |
2 |
Halted |
0 ms |
0 KB |
- |