Submission #489612

#TimeUsernameProblemLanguageResultExecution timeMemory
489612cadmiumskyCostinland (info1cup19_costinland)C++14
20 / 100
0 ms332 KiB
#include <iostream> #include <vector> using namespace std; 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; } int 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'; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...