Submission #230551

#TimeUsernameProblemLanguageResultExecution timeMemory
230551syyList of Unique Integers (FXCUP4_unique)C++17
100 / 100
5 ms512 KiB
#include "unique.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; #define FOR(i, a, b) for(int i = (int)a; i <= (int)b; i++) #define DEC(i, a, b) for(int i = (int)a; i >= (int)b; i--) typedef pair<int, int> pi; #define f first #define s second #define pb push_back #define all(v) v.begin(), v.end() #define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0) int pre[205], suf[205]; vector<int> PickUnique(int n) { FOR(i, 0, n-1) { pre[i] = UniqueCount(0, i); suf[i] = UniqueCount(i, n-1); } vector<int> res(n, 0); if (suf[0] > suf[1]) res[0] = 1; if (pre[n-2] < pre[n-1]) res[n-1] = 1; FOR(i, 1, n-2) { if (pre[i-1] < pre[i] and suf[i] > suf[i+1]) res[i] = 1; } return res; }
#Verdict Execution timeMemoryGrader output
Fetching results...