Submission #363354

#TimeUsernameProblemLanguageResultExecution timeMemory
363354mosiashvililukaCostinland (info1cup19_costinland)C++14
63.59 / 100
2 ms1228 KiB
#include<bits/stdc++.h>
using namespace std;
long long a,b,c,d,e,i,j,ii,jj,zx,xc,X,p[1009],pi,t,tes;
char ch[1009][1009];
int main(){
	ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
	cin>>X;
	for(i=0; i<=1000; i++){
		for(j=0; j<=1000; j++){
			ch[i][j]='r';
		}
	}
	while(X>1){
		if(X%2==0){
			pi++;
			p[pi]=2;
			X/=2;
		}else{
			pi++;
			p[pi]=1;
			X=(X+1)/2;
		}
	}
	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]<<" ";
	}
	return 0;*/
	for(t=1; t<=pi; t++){
		if(p[t]==1){
			for(i=1; i<t; i++){
				j=t+1-i;
				ch[i][j]='X';
			}
			ch[t][1]='d';
		}else{
			for(i=1; i<=t; i++){
				j=t+1-i;
				ch[i][j]='X';
			}
		}
	}
	a=pi+1;b=pi+1;
	for(i=1; i<=a; i++) ch[i][b]='d';
	ch[a][b]='.';
	cout<<a<<" "<<b<<endl;
	for(i=1; i<=a; i++){
		for(j=1; j<=b; j++){
			cout<<ch[i][j];
		}
		if(i!=a) cout<<endl;
	}
	return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...