Submission #230705

#TimeUsernameProblemLanguageResultExecution timeMemory
230705jzhList of Unique Integers (FXCUP4_unique)C++17
100 / 100
5 ms512 KiB
#include "unique.h" #include<bits/stdc++.h> using namespace std; int UniqueCount(int x, int y); std::vector<int> PickUnique(int N) { int i,a[N],b[N],x1,y1,x2,y2; for (i=0;i<N;i++){ a[i] = UniqueCount(0,i); b[i] = UniqueCount(i,N-1); } vector<int>ans; for (i=0;i<N;i++){ if (i>0) x1 = a[i-1]; else x1 = 0; x2 = a[i]; if (i<N-1) y1 = b[i+1]; else y1 = 0; y2 = b[i]; if (x1+1 == x2 && y1+1 == y2){ ans.push_back(1); } else { ans.push_back(0); } } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...