Submission #256527

#TimeUsernameProblemLanguageResultExecution timeMemory
256527KastandaList of Unique Integers (FXCUP4_unique)C++17
100 / 100
1 ms512 KiB
// M #include<bits/stdc++.h> #include "unique.h" using namespace std; int n; int Get(int l, int r) { l --; r --; l = max(l, 0); r = min(r, n - 1); if (r < l) return 0; return UniqueCount(l, r); } vector < int > PickUnique(int _n) { n = _n; vector < int > P(n + 2, 0), S(n + 2, 0); for (int i = 1; i <= n; i ++) P[i] = Get(1, i), S[i] = Get(i, n); vector < int > Rs(n, 0); for (int i = 1; i <= n; i ++) if (P[i] == P[i - 1] + 1 && S[i] == S[i + 1] + 1) Rs[i - 1] = 1; return Rs; }
#Verdict Execution timeMemoryGrader output
Fetching results...