Submission #148935

# Submission time Handle Problem Language Result Execution time Memory
148935 2019-09-01T05:25:28 Z Fenwick_team(#3609, amiratou, AyaBenSaad, Nucleist) List of Unique Integers (FXCUP4_unique) C++17
100 / 100
6 ms 512 KB
#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 time Memory Grader output
1 Correct 5 ms 384 KB Correct : C = 3
2 Correct 5 ms 384 KB Correct : C = 9
3 Correct 5 ms 384 KB Correct : C = 49
4 Correct 6 ms 384 KB Correct : C = 99
5 Correct 5 ms 436 KB Correct : C = 99
6 Correct 5 ms 384 KB Correct : C = 153
7 Correct 5 ms 384 KB Correct : C = 199
8 Correct 5 ms 512 KB Correct : C = 299
9 Correct 5 ms 512 KB Correct : C = 355
10 Correct 5 ms 512 KB Correct : C = 399
11 Correct 5 ms 512 KB Correct : C = 399
12 Correct 6 ms 440 KB Correct : C = 399
13 Correct 5 ms 512 KB Correct : C = 399
14 Correct 6 ms 512 KB Correct : C = 399
15 Correct 5 ms 512 KB Correct : C = 399