Submission #1132891

#TimeUsernameProblemLanguageResultExecution timeMemory
1132891rotatedList of Unique Integers (FXCUP4_unique)C++20
Compilation error
0 ms0 KiB
#include "unique.h" #include <bits/stdc++.h> using namespace std; #define int long long int* PickUnique(int N) { int lcount[N]; int rcount[N]; int ans[N]; fill(ans,ans+N,1); for (int i = 0; i < N; i++) { lcount[i] = UniqueCount(0, i); rcount[i] = UniqueCount(i, n - 1); } for (int i = 1; i < N; i++) { if (UniqueCount(0,i) > UniqueCount(0,i-1)) ans[i] = 0; } for (int i = 0; i < N-1; i++) { if (UniqueCount(0,i) > UniqueCount(0,i+1)) ans[i] = 0; } return ans; }

Compilation message (stderr)

unique.cpp: In function 'long long int* PickUnique(long long int)':
unique.cpp:12:36: error: 'n' was not declared in this scope
   12 |         rcount[i] = UniqueCount(i, n - 1);
      |                                    ^
unique.cpp:20:12: warning: address of local variable 'ans' returned [-Wreturn-local-addr]
   20 |     return ans;
      |            ^~~
unique.cpp:8:9: note: declared here
    8 |     int ans[N];
      |         ^~~