Submission #148361

#TimeUsernameProblemLanguageResultExecution timeMemory
148361Ian and 2-bit memory (#200)List of Unique Integers (FXCUP4_unique)C++17
Compilation error
0 ms0 KiB
#include "unique.h" std::vector<int> PickUnique(int N) { vector<int> ans = vector<int>(N, 1); int prv = 0; for (int i = 0; i < N; i++) { int ver = UniqueCount(0, i); if (ver != prv) { ans[i] = 0; } prv = ver; } prv = 0; for (int i = N - 1; i >= 0; i--) { int ver = UniqueCount(0, i); if (ver != prv) { ans[i] = 0; } prv = ver; } return ans; }

Compilation message (stderr)

unique.cpp: In function 'std::vector<int> PickUnique(int)':
unique.cpp:4:2: error: 'vector' was not declared in this scope
  vector<int> ans = vector<int>(N, 1);
  ^~~~~~
unique.cpp:4:2: note: suggested alternative:
In file included from /usr/include/c++/7/vector:64:0,
                 from unique.h:1,
                 from unique.cpp:1:
/usr/include/c++/7/bits/stl_vector.h:216:11: note:   'std::vector'
     class vector : protected _Vector_base<_Tp, _Alloc>
           ^~~~~~
unique.cpp:4:9: error: expected primary-expression before 'int'
  vector<int> ans = vector<int>(N, 1);
         ^~~
unique.cpp:10:4: error: 'ans' was not declared in this scope
    ans[i] = 0;
    ^~~
unique.cpp:19:4: error: 'ans' was not declared in this scope
    ans[i] = 0;
    ^~~
unique.cpp:24:9: error: 'ans' was not declared in this scope
  return ans;
         ^~~