Submission #1095667

#TimeUsernameProblemLanguageResultExecution timeMemory
1095667idiotcomputercmp (balkan11_cmp)C++11
Compilation error
0 ms0 KiB
#include "cmp.h" #include <bits/stdc++.h> using namespace std; #define pb push_back #define sz(x) (int) (x).size() int ch[6] = {1, 5, 22, 87, 344, 1369}; int pow[6] = {1,4,16,64,256,1024}; void remember(int value){ int s = 0; for (int i = 0; i < 6; i++){ s += pow[i] * (value%4); bit_set(s+ch[i]); value = value/4; } } int compare(int value){ vector<int> res(6); vector<int> cbit(6); int s = 0; for (int i = 0; i < 6; i++){ s += pow[i] * (value%4); res[i] = s; cbit[i] = value%4; value = value/4; } int n = sz(res); int l = -1; int r = n; while (r-l>1){ x = (l+r)/2; if (bit_get(res[x]+ch[x])) l = x; else r = x; } l++; if (l == n) return 0; if (cbit[l] == 0) return -1; if (cbit[l] == 3) return 1; if (cbit[l] == 1){ x = 0; if (l > 0) x = res[l-1]; if (bit_get(x+ch[l])) return 1; return -1; } x = 0; if (l > 0) x = res[l-1]; x += pow[l]*3; if (bit_get(x+ch[l])) return -1; return 1; }

Compilation message (stderr)

cmp.cpp:8:10: error: 'int pow [6]' redeclared as different kind of entity
    8 | int pow[6] = {1,4,16,64,256,1024};
      |          ^
In file included from /usr/include/features.h:461,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/os_defines.h:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/c++config.h:518,
                 from /usr/include/c++/10/cassert:43,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:33,
                 from cmp.cpp:2:
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:140:1: note: previous declaration 'double pow(double, double)'
  140 | __MATHCALL_VEC (pow,, (_Mdouble_ __x, _Mdouble_ __y));
      | ^~~~~~~~~~~~~~
cmp.cpp: In function 'void remember(int)':
cmp.cpp:12:11: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   12 |   s += pow[i] * (value%4);
      |           ^
cmp.cpp: In function 'int compare(int)':
cmp.cpp:23:11: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   23 |   s += pow[i] * (value%4);
      |           ^
cmp.cpp:33:3: error: 'x' was not declared in this scope
   33 |   x = (l+r)/2;
      |   ^
cmp.cpp:42:3: error: 'x' was not declared in this scope
   42 |   x = 0;
      |   ^
cmp.cpp:47:2: error: 'x' was not declared in this scope
   47 |  x = 0;
      |  ^
cmp.cpp:49:10: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   49 |  x += pow[l]*3;
      |          ^