# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
149501 | 2019-09-01T06:37:14 Z | GojekKawe(#3581, VinsenN, XxX, dexter) | List of Unique Integers (FXCUP4_unique) | C++17 | 0 ms | 0 KB |
#include<bits/stdc++.h> #include <stdio.h> #include <stdlib.h> static int N, arr[222], unq[222][222], chk[222]; static void my_assert(int TF, const char* message){ if(!TF){ puts(message); exit(0); } } static int call_cnt = 0; int UniqueCount(int R, int C){ call_cnt++; my_assert(call_cnt <= 40000, "Wrong : Too Much Calls"); my_assert(R >= 0 && C < N && R <= C, "Wrong : Invalid R, C"); return unq[R][C]; } std::vector<int> PickUnique (int N){ int U[N]; for(int i=0;i<N;i++){ U[i]=0; } if(UniqueCount(0,N-1)==UniqueCount(0,N-2)+1){ U[N-1]=1; }; if(UniqueCount(0,N-1)==UniqueCount(1,N-1)+1){ U[0]=1; }; for(int i=N-2; i>0;i--){ if(UniqueCount(0,i)==UniqueCount(0,i-1)+1){ if(UniqueCount(i,N-1)==UniqueCount(i+1,N-1)+1){ U[i]=1; } } }; std::vector<int> vect(U, U + sizeof(U)/sizeof(U[0])); return vect; } /*int main(){ int N; cin>>N; int a[N]; for(int i=0;i<N;i++){ cin>>a[N]; } PickUnique(N); }*/