답안 #230542

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
230542 2020-05-10T10:37:11 Z jiahng List of Unique Integers (FXCUP4_unique) C++17
100 / 100
5 ms 512 KB
#include <bits/stdc++.h>
#include "unique.h"
using namespace std;

typedef long long ll;
typedef pair<ll,ll> pi;
typedef vector <int> vi;
typedef vector <pi> vpi;
#define f first
#define s second
#define FOR(i,s,e) for(ll i=s;i<=ll(e);++i)
#define DEC(i,s,e) for(ll i=s;i>=ll(e);--i)
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define lbd(x, y) lower_bound(all(x), y)
#define ubd(x, y) upper_bound(all(x), y)
#define aFOR(i,x) for (auto i: x)
#define mem(x,i) memset(x,i,sizeof x)
#define fast ios_base::sync_with_stdio(false),cin.tie(0)



std::vector<int> PickUnique(int N) {
	vi ans;
	int pre = 0;
	int suff = UniqueCount(0,N-1);
	
	FOR(i,0,N-1){
		int yes = 0;
		int x = UniqueCount(0,i);
		if (i == 0 || pre + 1 == x) yes++;
		
		pre = x;
		
		int y;
		if (i + 1 == N) y = 0;
		else y = UniqueCount(i+1,N-1);
		
		if (i == N-1 || y + 1 == suff){
			yes++;
		}
		
		suff = y;
		
		if (yes == 2) ans.pb(1);
		else ans.pb(0);
	}
	//aFOR(i,ans) cout<<i<<' ';
	
	return ans;
}

# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Correct : C = 4
2 Correct 5 ms 256 KB Correct : C = 10
3 Correct 5 ms 384 KB Correct : C = 50
4 Correct 5 ms 384 KB Correct : C = 100
5 Correct 5 ms 384 KB Correct : C = 100
6 Correct 5 ms 384 KB Correct : C = 154
7 Correct 5 ms 384 KB Correct : C = 200
8 Correct 5 ms 512 KB Correct : C = 300
9 Correct 5 ms 512 KB Correct : C = 356
10 Correct 5 ms 512 KB Correct : C = 400
11 Correct 5 ms 512 KB Correct : C = 400
12 Correct 5 ms 512 KB Correct : C = 400
13 Correct 5 ms 512 KB Correct : C = 400
14 Correct 5 ms 512 KB Correct : C = 400
15 Correct 5 ms 512 KB Correct : C = 400