Submission #148945

#TimeUsernameProblemLanguageResultExecution timeMemory
148945샌즈뼈 (#200)List of Unique Integers (FXCUP4_unique)C++17
100 / 100
6 ms512 KiB
#include "unique.h" using namespace std; std::vector<int> PickUnique(int N) { vector<int> ans(N,0); int i,j,v1,v2; int base = UniqueCount(0,N-1); int f[211]={}; v1=base; for (i=1;i<N-1;i++) { v2=UniqueCount(i,N-1); if (v1>v2) f[i-1]++; v1=v2; } if (v1==2) f[N-2]++; v1=base; for (i=N-2;i>=1;i--) { v2=UniqueCount(0,i); if (v1>v2) f[i+1]++; v1=v2; } if (v1==2) f[1]++; for (i=1;i<N-1;i++) if (f[i]==2) ans[i]=1; if (f[0]==1) ans[0]=1; if (f[N-1]==1) ans[N-1]=1; return ans; }

Compilation message (stderr)

unique.cpp: In function 'std::vector<int> PickUnique(int)':
unique.cpp:7:11: warning: unused variable 'j' [-Wunused-variable]
     int i,j,v1,v2;
           ^
#Verdict Execution timeMemoryGrader output
Fetching results...