Submission #1247362

#TimeUsernameProblemLanguageResultExecution timeMemory
1247362MateiKing80비교 (balkan11_cmp)C++20
Compilation error
0 ms0 KiB
#include "cmp.h" #include <bits/stdc++.h> int gib(int x, int bit) { if (x & (1 << bit)) return 1; return 0; } const int bulan = 4096; void remember(int a) { a += bulan; while (a) { bit_set(a); a = (a - 1) / 4; } } int compare(int b) { b += bulan; vector<int> nrs; while (b) { nrs.push_back(b); b = (b - 1) / 4; } int pos = -1; for (int pas = 16; pas; pas >>= 1) if (pos + pas < (int)nrs.size() && !bit_get(nrs[pos + pas])) pos += pas; if (pos == -1) return 0; vector<int> v(4); int x = ((b - 1) / 4) * 4 + 1; v[b - x] ++; int nrp = 1; if (b == x) return -1; if (b == x + 1) return get_bit(x) ? 1 : -1; if (b == x + 2) return get_bit(x + 3) ? -1 : 1; if (b == x + 3) return 1; }

Compilation message (stderr)

cmp.cpp: In function 'int compare(int)':
cmp.cpp:22:9: error: 'vector' was not declared in this scope
   22 |         vector<int> nrs;
      |         ^~~~~~
cmp.cpp:22:9: note: suggested alternatives:
In file included from /usr/include/c++/11/vector:67,
                 from /usr/include/c++/11/functional:62,
                 from /usr/include/c++/11/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/11/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from cmp.cpp:2:
/usr/include/c++/11/bits/stl_vector.h:389:11: note:   'std::vector'
  389 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
In file included from /usr/include/c++/11/functional:62,
                 from /usr/include/c++/11/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/11/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from cmp.cpp:2:
/usr/include/c++/11/vector:86:13: note:   'std::pmr::vector'
   86 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
cmp.cpp:22:16: error: expected primary-expression before 'int'
   22 |         vector<int> nrs;
      |                ^~~
cmp.cpp:24:17: error: 'nrs' was not declared in this scope
   24 |                 nrs.push_back(b);
      |                 ^~~
cmp.cpp:29:38: error: 'nrs' was not declared in this scope
   29 |                 if (pos + pas < (int)nrs.size() && !bit_get(nrs[pos + pas]))
      |                                      ^~~
cmp.cpp:33:16: error: expected primary-expression before 'int'
   33 |         vector<int> v(4);
      |                ^~~
cmp.cpp:35:9: error: 'v' was not declared in this scope
   35 |         v[b - x] ++;
      |         ^
cmp.cpp:40:24: error: 'get_bit' was not declared in this scope
   40 |                 return get_bit(x) ? 1 : -1;
      |                        ^~~~~~~
cmp.cpp:42:24: error: 'get_bit' was not declared in this scope
   42 |                 return get_bit(x + 3) ? -1 : 1;
      |                        ^~~~~~~