Submission #1142481

#TimeUsernameProblemLanguageResultExecution timeMemory
1142481PlayVoltzList of Unique Integers (FXCUP4_unique)C++20
Compilation error
0 ms0 KiB
#include "unique.h" #include <bits/stdc++.h> using namespace std; vector<int> PickUnique(int n){ vector<int> ans(n, 1); int p=UniqueCount(0, n-1); for (int i=n-2, pp=p; i>=0 --i){ int temp=UniqueCount(0, i); if (temp>=pp)ans[i+1]=0; pp=temp; } for (int i=1; i<n; ++i){ int temp=UniqueCount(i, n-1); if (temp>=p)ans[i-1]=0; p=temp; } return ans; }

Compilation message (stderr)

unique.cpp: In function 'std::vector<int> PickUnique(int)':
unique.cpp:8:34: error: lvalue required as decrement operand
    8 |         for (int i=n-2, pp=p; i>=0 --i){
      |                                  ^
unique.cpp:8:38: error: expected ';' before 'i'
    8 |         for (int i=n-2, pp=p; i>=0 --i){
      |                                      ^
      |                                      ;