Submission #976361

#TimeUsernameProblemLanguageResultExecution timeMemory
976361biankcmp (balkan11_cmp)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "cmp.h" const int MAX_N = 4095; vector<int> offset; void remember(int n) { offset[0] = 0; for (int i = 1; i < 6; i++) { offset[i] = offset[i - 1] + MAX_N >> (2 * i) + 1; } for (int i = 0; i < 6; i++) { bit_set(offset[i] + n >> (2 * i)); } } int compare(int b) { int l = -1, r = 6; while (l + 1 < r) { int m = (l + r) / 2; if (bit_get(offset[m] + 1 + b >> (2 * m))) { r = m; } else { l = m; } } if (l == -1) return 0; int digit = (b >> (2 * l)) & 3; if (digit == 0) return -1; if (digit == 3) return 1; if (digit == 1) { if (bit_get(offset[l] + 4 * (b >> (2 * r))) return 1; else return -1; } if (digit == 2) { if (bit_get(offset[l] + 4 * (b >> (2 * r)) + 3) return -1; else return 1; } assert(false); }

Compilation message (stderr)

cmp.cpp:6:1: error: 'vector' does not name a type
    6 | vector<int> offset;
      | ^~~~~~
cmp.cpp: In function 'void remember(int)':
cmp.cpp:9:5: error: 'offset' was not declared in this scope; did you mean 'off_t'?
    9 |     offset[0] = 0;
      |     ^~~~~~
      |     off_t
cmp.cpp: In function 'int compare(int)':
cmp.cpp:22:21: error: 'offset' was not declared in this scope; did you mean 'off_t'?
   22 |         if (bit_get(offset[m] + 1 + b >> (2 * m))) {
      |                     ^~~~~~
      |                     off_t
cmp.cpp:33:13: warning: init-statement in selection statements only available with '-std=c++17' or '-std=gnu++17'
   33 |         if (bit_get(offset[l] + 4 * (b >> (2 * r))) return 1;
      |             ^~~~~~~
cmp.cpp:33:21: error: 'offset' was not declared in this scope; did you mean 'off_t'?
   33 |         if (bit_get(offset[l] + 4 * (b >> (2 * r))) return 1;
      |                     ^~~~~~
      |                     off_t
cmp.cpp:34:9: error: expected primary-expression before 'else'
   34 |         else return -1;
      |         ^~~~
cmp.cpp:33:62: error: expected ')' before 'else'
   33 |         if (bit_get(offset[l] + 4 * (b >> (2 * r))) return 1;
      |            ~                                                 ^
      |                                                              )
   34 |         else return -1;
      |         ~~~~                                                  
cmp.cpp:37:13: warning: init-statement in selection statements only available with '-std=c++17' or '-std=gnu++17'
   37 |         if (bit_get(offset[l] + 4 * (b >> (2 * r)) + 3) return -1;
      |             ^~~~~~~
cmp.cpp:37:21: error: 'offset' was not declared in this scope; did you mean 'off_t'?
   37 |         if (bit_get(offset[l] + 4 * (b >> (2 * r)) + 3) return -1;
      |                     ^~~~~~
      |                     off_t
cmp.cpp:38:9: error: expected primary-expression before 'else'
   38 |         else return 1;
      |         ^~~~
cmp.cpp:37:67: error: expected ')' before 'else'
   37 |         if (bit_get(offset[l] + 4 * (b >> (2 * r)) + 3) return -1;
      |            ~                                                      ^
      |                                                                   )
   38 |         else return 1;
      |         ~~~~