Submission #1318478

#TimeUsernameProblemLanguageResultExecution timeMemory
1318478Jawad_Akbar_JJCostinland (info1cup19_costinland)C++20
0 / 100
0 ms332 KiB
#include <iostream>
#include <map>

using namespace std;
#define int long long


char a[55][55];

signed main(){
	int n = 49;

	for (int i=1;i<=n;i++){
		for (int j=1;j<=n;j++){
			if (i < 3)
				a[i][j] = '.';
			else if (i == j)
				a[i][j] = 'X';
			else if (i-1 == j and i % 2 == 0)
				a[i][j] = 'X';
			else if (j - 1 == i and j % 2 == 0)
				a[i][j] = 'X';
			else
				a[i][j] = '.';
		}
	}

	for (int i=1;i<=n;i++){
		for (int j=1;j<=n;j++){
			if (a[i][j] == '.' and i > 1 and a[i-1][j] == 'X')
				a[i][j] = 'r';
			if (i == n)
				a[i][j] = 'r';
			if (a[i][j] == '.' and j > 1 and a[i][j-1] == 'X')
				a[i][j] = 'd';
			if (j == n)
				a[i][j] = 'd';
		}
	}

	int N;
	cin>>N;

	string s;
	while (N){
		s = char(N % 6 + '0') + s;
		N /= 6;
	}
	
	for (int i=49, fl = 0, j = s.size() - 1;j >= 0;i -= 2, j--){
		if (s[j] == '0')
			continue;
		if (s[j] == '1'){
			a[1][i] = 'X';
		}
		else if (s[j] == '2'){
			a[1][i] = a[1][i-1] = 'X';
			a[2][i-1] = 'r';
			a[2][i] = 'd';
		}
		else if (s[j] == '3'){
			a[1][i-1] = 'X';
		}
		else if (s[j] == '4'){
			a[1][i-1] = a[2][i-1] = 'X';
			a[2][i] = 'd';
		}
		else if (s[j] == '5'){
			a[1][i] = a[1][i-1] = 'X';
			a[2][i-1] = 'X';
			a[2][i] = 'd'; 
		}

		if (fl == 0){
			if (a[1][i] == 'X')
				a[1][i] = 'd';
			else if (a[1][i-1] == 'X')
				a[1][i-1] = 'd';
			fl = 1;
		}
	}

	a[1][1] = 'r';
	for (int i=1;i<=n;i++){
		for (int j=1;j<=n;j++)
			cout<<a[i][j];
		cout<<'\n';
	}
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...