fork 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 <cmath>
  13. #include <iomanip>
  14. #define dibs reserve
  15. #define OVER9000 1234567890
  16. #define patkan 9
  17. #define tisic 47
  18. #define soclose 1e-9
  19. #define pi 3.1415926535898
  20. #define ALL_THE(CAKE,LIE) for(auto LIE =CAKE.begin(); LIE != CAKE.end(); LIE++)
  21. #define chocolate win
  22. #define ff first
  23. #define ss second
  24. #define abs(x) ((x < 0)?-(x):(x))
  25. #define uint unsigned int
  26. // mylittlepony
  27. using namespace std;
  28.  
  29. long long pow(long long a, long long e, long long m) {
  30. if(e <= 0) return 1;
  31. int x =pow(a,e/2,m);
  32. x =(x*x)%m;
  33. if(e%2 != 0) x =(x*a)%m;
  34. return x;}
  35.  
  36. int main() {
  37. cin.sync_with_stdio(0);
  38. int N,K,M;
  39. cin >> N >> K >> M;
  40. int mod =(1<<M)-1;
  41.  
  42. vector<int> A[N/2+1];
  43. A[0].push_back(0);
  44. for(int i =0; i < N/2; i++) {
  45. A[i+1].dibs(A[i].size()*26);
  46. ALL_THE(A[i],it) for(int j =1; j <= 26; j++)
  47. A[i+1].push_back((((*it)*33)^j)&mod);
  48. }
  49.  
  50. int n =N-N/2;
  51. int inv =(int)pow(33LL,(1LL<<(M-1))-1LL,1LL<<M);
  52.  
  53. vector<int> B[n+1];
  54. B[0].push_back(K);
  55. for(int i =0; i < n; i++) {
  56. B[i+1].dibs(B[i].size()*26);
  57. ALL_THE(B[i],it) for(int j =1; j <= 26; j++)
  58. B[i+1].push_back((((*it)^j)*inv)&mod);
  59. }
  60.  
  61. vector<int> sA(1<<M,0);
  62. ALL_THE(A[N/2],it) sA[*it]++;
  63.  
  64. long long ans =0;
  65. ALL_THE(B[n],it) ans +=sA[*it];
  66. cout << ans << "\n";
  67. return 0;}
  68.  
  69. // look at my code
  70. // my code is amazing
  71.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
COCI 2013/14 #6 HASH
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:20:31: warning: ‘auto’ changes meaning in C++11; please remove it [-Wc++0x-compat]
 #define ALL_THE(CAKE,LIE) for(auto LIE =CAKE.begin(); LIE != CAKE.end(); LIE++)
                               ^
prog.cpp:46:9: note: in expansion of macro ‘ALL_THE’
         ALL_THE(A[i],it) for(int j =1; j <= 26; j++)
         ^
prog.cpp:46:22: error: ‘it’ does not name a type
         ALL_THE(A[i],it) for(int j =1; j <= 26; j++)
                      ^
prog.cpp:20:36: note: in definition of macro ‘ALL_THE’
 #define ALL_THE(CAKE,LIE) for(auto LIE =CAKE.begin(); LIE != CAKE.end(); LIE++)
                                    ^
prog.cpp:46:22: error: expected ‘;’ before ‘it’
         ALL_THE(A[i],it) for(int j =1; j <= 26; j++)
                      ^
prog.cpp:20:55: note: in definition of macro ‘ALL_THE’
 #define ALL_THE(CAKE,LIE) for(auto LIE =CAKE.begin(); LIE != CAKE.end(); LIE++)
                                                       ^
prog.cpp:46:22: error: ‘it’ was not declared in this scope
         ALL_THE(A[i],it) for(int j =1; j <= 26; j++)
                      ^
prog.cpp:20:55: note: in definition of macro ‘ALL_THE’
 #define ALL_THE(CAKE,LIE) for(auto LIE =CAKE.begin(); LIE != CAKE.end(); LIE++)
                                                       ^
prog.cpp:20:31: warning: ‘auto’ changes meaning in C++11; please remove it [-Wc++0x-compat]
 #define ALL_THE(CAKE,LIE) for(auto LIE =CAKE.begin(); LIE != CAKE.end(); LIE++)
                               ^
prog.cpp:57:3: note: in expansion of macro ‘ALL_THE’
   ALL_THE(B[i],it) for(int j =1; j <= 26; j++)
   ^
prog.cpp:57:16: error: ‘it’ does not name a type
   ALL_THE(B[i],it) for(int j =1; j <= 26; j++)
                ^
prog.cpp:20:36: note: in definition of macro ‘ALL_THE’
 #define ALL_THE(CAKE,LIE) for(auto LIE =CAKE.begin(); LIE != CAKE.end(); LIE++)
                                    ^
prog.cpp:57:16: error: expected ‘;’ before ‘it’
   ALL_THE(B[i],it) for(int j =1; j <= 26; j++)
                ^
prog.cpp:20:55: note: in definition of macro ‘ALL_THE’
 #define ALL_THE(CAKE,LIE) for(auto LIE =CAKE.begin(); LIE != CAKE.end(); LIE++)
                                                       ^
prog.cpp:57:16: error: ‘it’ was not declared in this scope
   ALL_THE(B[i],it) for(int j =1; j <= 26; j++)
                ^
prog.cpp:20:55: note: in definition of macro ‘ALL_THE’
 #define ALL_THE(CAKE,LIE) for(auto LIE =CAKE.begin(); LIE != CAKE.end(); LIE++)
                                                       ^
prog.cpp:20:31: warning: ‘auto’ changes meaning in C++11; please remove it [-Wc++0x-compat]
 #define ALL_THE(CAKE,LIE) for(auto LIE =CAKE.begin(); LIE != CAKE.end(); LIE++)
                               ^
prog.cpp:62:5: note: in expansion of macro ‘ALL_THE’
     ALL_THE(A[N/2],it) sA[*it]++;
     ^
prog.cpp:62:20: error: ‘it’ does not name a type
     ALL_THE(A[N/2],it) sA[*it]++;
                    ^
prog.cpp:20:36: note: in definition of macro ‘ALL_THE’
 #define ALL_THE(CAKE,LIE) for(auto LIE =CAKE.begin(); LIE != CAKE.end(); LIE++)
                                    ^
prog.cpp:62:20: error: expected ‘;’ before ‘it’
     ALL_THE(A[N/2],it) sA[*it]++;
                    ^
prog.cpp:20:55: note: in definition of macro ‘ALL_THE’
 #define ALL_THE(CAKE,LIE) for(auto LIE =CAKE.begin(); LIE != CAKE.end(); LIE++)
                                                       ^
prog.cpp:62:20: error: ‘it’ was not declared in this scope
     ALL_THE(A[N/2],it) sA[*it]++;
                    ^
prog.cpp:20:55: note: in definition of macro ‘ALL_THE’
 #define ALL_THE(CAKE,LIE) for(auto LIE =CAKE.begin(); LIE != CAKE.end(); LIE++)
                                                       ^
prog.cpp:20:31: warning: ‘auto’ changes meaning in C++11; please remove it [-Wc++0x-compat]
 #define ALL_THE(CAKE,LIE) for(auto LIE =CAKE.begin(); LIE != CAKE.end(); LIE++)
                               ^
prog.cpp:65:5: note: in expansion of macro ‘ALL_THE’
     ALL_THE(B[n],it) ans +=sA[*it];
     ^
prog.cpp:65:18: error: ‘it’ does not name a type
     ALL_THE(B[n],it) ans +=sA[*it];
                  ^
prog.cpp:20:36: note: in definition of macro ‘ALL_THE’
 #define ALL_THE(CAKE,LIE) for(auto LIE =CAKE.begin(); LIE != CAKE.end(); LIE++)
                                    ^
prog.cpp:65:18: error: expected ‘;’ before ‘it’
     ALL_THE(B[n],it) ans +=sA[*it];
                  ^
prog.cpp:20:55: note: in definition of macro ‘ALL_THE’
 #define ALL_THE(CAKE,LIE) for(auto LIE =CAKE.begin(); LIE != CAKE.end(); LIE++)
                                                       ^
prog.cpp:65:18: error: ‘it’ was not declared in this scope
     ALL_THE(B[n],it) ans +=sA[*it];
                  ^
prog.cpp:20:55: note: in definition of macro ‘ALL_THE’
 #define ALL_THE(CAKE,LIE) for(auto LIE =CAKE.begin(); LIE != CAKE.end(); LIE++)
                                                       ^
stdout
Standard output is empty