Submission #148935

#TimeUsernameProblemLanguageResultExecution timeMemory
148935Fenwick_team (#200)List of Unique Integers (FXCUP4_unique)C++17
100 / 100
6 ms512 KiB
#include <bits/stdc++.h> #include "unique.h" using namespace std; #define flash ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0) #define debug(x) cerr << " - " << #x << ": " << x << endl; #define debugs(x, y) cerr << " - " << #x << ": " << x << " " << #y << ": " << y << endl; #define all(x) (x).begin(),(x).end() #define sz(x) (ll)x.size() #define ll long long #define INF 1000000000 #define pb push_back #define ve vector<ll> #define dos pair<ll,ll> #define vedos vector<dos> struct greateri { template<class T> bool operator()(T const &a, T const &b) const { return a > b; } }; vector<int> PickUnique(int N) { int s = UniqueCount(0,N-1); vector<int>ans; ans.resize(N); for (int i = 0; i < N; ++i) { ans[i]=0; } int temp=s; ans[N-1]++; ans[0]++; for (int i = 0; i < N-1; ++i) { int k = UniqueCount(i+1,N-1); if(k==(temp-1)) { ans[i]++; } temp=k; } temp=s; for (int i = N-1; i > 0; --i) { int k = UniqueCount(0,i-1); if(k==(temp-1)) { ans[i]++; } temp=k; } for (int i = 0; i < N; ++i) { ans[i]--; ans[i]=max(0,ans[i]); } return ans; } //code the AC sol ! // BS/queue/map
#Verdict Execution timeMemoryGrader output
Fetching results...