Submission #1132630

#TimeUsernameProblemLanguageResultExecution timeMemory
1132630PwoList of Unique Integers (FXCUP4_unique)C++20
Compilation error
0 ms0 KiB
#include "unique.h" using namespace std; vector<int> PickUnique(int n) { vector<int>(n, 1) ans; int prev = 0; for (int i = 1; i <= n; i++) { int res = UniqueCount(1, i); if (res <= prev) ans[i] = 0; prev = res; } prev = 0; for (int i = n; i >= 1; i--) { int res = UniqueCount(i, n); if (res <= prev) ans[i] = 0; prev = res; } return ans; }

Compilation message (stderr)

unique.cpp: In function 'std::vector<int> PickUnique(int)':
unique.cpp:5:26: error: expected ';' before 'ans'
    5 |         vector<int>(n, 1) ans;
      |                          ^~~~
      |                          ;
unique.cpp:9:34: error: 'ans' was not declared in this scope; did you mean 'abs'?
    9 |                 if (res <= prev) ans[i] = 0;
      |                                  ^~~
      |                                  abs
unique.cpp:15:34: error: 'ans' was not declared in this scope; did you mean 'abs'?
   15 |                 if (res <= prev) ans[i] = 0;
      |                                  ^~~
      |                                  abs
unique.cpp:18:16: error: 'ans' was not declared in this scope; did you mean 'abs'?
   18 |         return ans;
      |                ^~~
      |                abs