fork(3) download
  1. // iostream is too mainstream
  2. #include <cstdio>
  3. // bitch please
  4. #include <iostream>
  5. #include <vector>
  6. #include <set>
  7. #include <map>
  8. #include <string>
  9. #include <queue>
  10. #include <stack>
  11. #include <algorithm>
  12. #include <iomanip>
  13. #define dibs reserve
  14. #define OVER9000 1234567890
  15. #define patkan 9
  16. #define tisic 47
  17. #define soclose 10e-7
  18. #define ALL_THE(CAKE,LIE) for(auto LIE =CAKE.begin(); LIE != CAKE.end(); LIE++)
  19. #define chocolate win
  20. #define ff first
  21. #define ss second
  22. #define abs(x) ((x < 0)?-(x):(x))
  23. // mylittlepony
  24. using namespace std;
  25.  
  26. void count(int i, int j, int k, vector< vector< vector<int> > > &St) {
  27. // cout << i << " " << j << " " << k << endl;
  28. if(St[k][i][j] >= 0) return;
  29. int i2 =i+(int)(k == 2);
  30. St[k][i][j] =0;
  31. int k2 =(k+1)%3; if(k2 < 0) k2 +=3;
  32. if(i > 0) {
  33. count(i2-1,j,k2,St);
  34. if(0 == St[k2][i2-1][j]) St[k][i][j] =1;}
  35. if(i > 0) {
  36. count(i2-1,j+1,k2,St);
  37. if(0 == St[k2][i2-1][j+1]) St[k][i][j] =1;}
  38. if(j > 0) {
  39. count(i2,j-1,k2,St);
  40. if(0 == St[k2][i2][j-1]) St[k][i][j] =1;}}
  41.  
  42. int main() {
  43. cin.sync_with_stdio(0);
  44. vector< vector< vector<int> > > St(3);
  45. St[0].resize(100, vector<int>(100,-1));
  46. St[1].resize(100, vector<int>(100,-1));
  47. St[2].resize(100, vector<int>(100,-1));
  48. for(int i =0; i < 10; i++) for(int j =0; j < 10; j++) for(int k =2; k >= 0; k--)
  49. count(i,j,k,St);
  50.  
  51. for(int i =0; i < 10; i++) for(int j =0; j < 10; j++) {
  52. int x =St[0][i][j]+2*St[1][i][j]+4*St[2][i][j];
  53. cout << x << " ";
  54. if(j == 9) cout << "\n";}
  55. return 0;}
  56.  
  57. // look at my code
  58. // my code is amazing
Success #stdin #stdout 0s 3592KB
stdin
Standard input is empty
stdout
0 3 6 0 3 6 0 3 6 0 
7 6 3 7 6 3 7 6 3 7 
4 7 6 4 7 6 4 7 6 4 
1 3 7 1 3 7 1 3 7 1 
7 6 3 7 6 3 7 6 3 7 
4 7 6 4 7 6 4 7 6 4 
1 3 7 1 3 7 1 3 7 1 
7 6 3 7 6 3 7 6 3 7 
4 7 6 4 7 6 4 7 6 4 
1 3 7 1 3 7 1 3 7 1