Submission #759918

# Submission time Handle Problem Language Result Execution time Memory
759918 2023-06-17T04:50:33 Z denniskim List of Unique Integers (FXCUP4_unique) C++17
100 / 100
1 ms 468 KB
#include "unique.h"
#include <bits/stdc++.h>

using namespace std;
typedef int ll;
typedef __int128 lll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pld;
#define MAX 9223372036854775807LL
#define MIN -9223372036854775807LL
#define INF 0x3f3f3f3f3f3f3f3f
#define fi first
#define se second
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cout << fixed; cout.precision(10);
#define sp << " "
#define en << "\n"
#define compress(v) sort(v.begin(), v.end()), v.erase(unique(v.begin(), v.end()), v.end())

ll gap1[210], gap2[210];

vector<ll> PickUnique(ll N)
{
	vector<ll> ans;
	
	for(ll i = 0 ; i < N ; i++)
		ans.push_back(1);
	
	for(ll i = 0 ; i < N ; i++)
		gap1[i] = gap2[i] = 0;
	
	for(ll i = 0 ; i < N ; i++)
	{
		gap1[i] = UniqueCount(0, i);
		gap2[i] = UniqueCount(i, N - 1);
	}
	
	for(ll i = N - 2 ; i >= 0 ; i--)
	{
		ll delta = gap1[i] - gap1[i + 1];
		
		if(delta == 0)
			ans[i + 1] = 0;
		else if(delta == 1)
			ans[i + 1] = 0;
	}
	
	for(ll i = 0 ; i < N - 1 ; i++)
	{
		ll delta = gap2[i + 1] - gap2[i];
		
		if(delta == 0)
			ans[i] = 0;
		else if(delta == 1)
			ans[i] = 0;
	}
	
	return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Correct : C = 4
2 Correct 1 ms 212 KB Correct : C = 10
3 Correct 1 ms 212 KB Correct : C = 50
4 Correct 1 ms 340 KB Correct : C = 100
5 Correct 1 ms 340 KB Correct : C = 100
6 Correct 1 ms 340 KB Correct : C = 154
7 Correct 0 ms 340 KB Correct : C = 200
8 Correct 1 ms 340 KB Correct : C = 300
9 Correct 1 ms 468 KB Correct : C = 356
10 Correct 1 ms 440 KB Correct : C = 400
11 Correct 1 ms 468 KB Correct : C = 400
12 Correct 1 ms 468 KB Correct : C = 400
13 Correct 1 ms 468 KB Correct : C = 400
14 Correct 1 ms 432 KB Correct : C = 400
15 Correct 1 ms 468 KB Correct : C = 400