Submission #489614

#TimeUsernameProblemLanguageResultExecution timeMemory
489614cadmiumskyCostinland (info1cup19_costinland)C++14
100 / 100
1 ms336 KiB
#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)

costinland.cpp: In function 'void start(long long int, long long int)':
costinland.cpp:32:22: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
   32 |         mat[x+1][y+1]='X';
      |         ~~~~~~~~~~~~~^~~~
costinland.cpp:6:6: note: at offset 0 to object 'mat' with size 250000 declared here
    6 | char mat[500][500]; // 49 lmao
      |      ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...