# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
489614 | cadmiumsky | Costinland (info1cup19_costinland) | C++14 | 1 ms | 336 KiB |
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>
#include <vector>
using namespace std;
#define int long long // ma-ta si cu tac-tu(tactu?)
char mat[500][500]; // 49 lmao
vector<int> base;
void start(int x, int y) {
int coef=base[0];
if(base.size()==1) {
switch(coef) {
case 1:
mat[x][y]='.';
break;
case 2:
mat[x][y]='X';
break;
case 3:
mat[x][y]='X';
mat[x][y+1]='X';
break;
case 4:
mat[x][y]='X';
mat[x][y+1]='X';
mat[x+1][y]='X';
break;
case 5:
mat[x][y]='X';
mat[x+1][y]='X';
mat[x][y+1]='d';
mat[x+1][y+1]='X';
break;
}
}
else {
//cout << coef << '\n';
base.erase(base.begin());
mat[x][y]=mat[x+1][y+1]=mat[x+1][y]=mat[x][y+1]='X';
x+=2;
y+=2;
mat[x-1][y]=mat[x-2][y]='d';
mat[x][y-1]=mat[x][y-2]='r';
switch(coef) { // escape characters
case 1:
mat[x][y-2]='X';
break;
case 2:
mat[x][y-2]='X';
mat[x-2][y]='X';
break;
case 3:
mat[x][y-1]='X';
break;
case 4:
mat[x-2][y]='X';
mat[x-1][y]='X';
break;
case 5:
mat[x][y-1]='X';
mat[x-2][y]='X';
mat[x][y-2]='X';
break;
default:
break;
}
start(x,y);
}
return;
}
signed main() {
int k,n;
cin >> k;
for(int i=0; i<60; i++) {
for(int j=0; j<60; j++)
mat[i][j]='.';
}
if(k<=19) {
cout << "5 5\n";
n=5;
}
else {
cout << "49 49\n";
n=49;
}
for(int i=0; i<n; i++)
mat[i][n-1]='d',mat[n-1][i]='r';
mat[n-1][n-1]='.';
while(k) {
base.push_back(k%6);
k/=6;
}
start(0,0);
for(int i=0; i<n; i++) {
for(int j=0; j<n; j++)
cout << mat[i][j];
cout << '\n';
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |