Submission #247089

# Submission time Handle Problem Language Result Execution time Memory
247089 2020-07-11T05:09:41 Z errorgorn 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 rep(x,s,e) for (auto x=s-(s>e);x!=e-(s>e);(s<e?x++:x--))

std::vector<int> PickUnique(int n) {
	vector<int> res;
	
	rep(x,0,n){
		res.push_back(1);
	}
	
	int p=1,c;
	rep(x,1,n){
		c=UniqueCount(0,x);
		
		if (p>=c) res[x]=0;
		p=c;
	}
	
	p=1;
	rep(x,n-1,0){
		c=UniqueCount(x,n-1);
		
		if (p>=c) res[x]=0;
		p=c;
	}
	
	//rep(x,0,n) cout<<res[x]<<" ";cout<<endl;
	
	return res;
}
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB Correct : C = 2
2 Correct 4 ms 384 KB Correct : C = 8
3 Correct 4 ms 384 KB Correct : C = 48
4 Correct 5 ms 384 KB Correct : C = 98
5 Correct 4 ms 384 KB Correct : C = 98
6 Correct 5 ms 384 KB Correct : C = 152
7 Correct 4 ms 384 KB Correct : C = 198
8 Correct 6 ms 384 KB Correct : C = 298
9 Correct 5 ms 512 KB Correct : C = 354
10 Correct 5 ms 512 KB Correct : C = 398
11 Correct 5 ms 512 KB Correct : C = 398
12 Correct 5 ms 512 KB Correct : C = 398
13 Correct 5 ms 512 KB Correct : C = 398
14 Correct 5 ms 512 KB Correct : C = 398
15 Correct 5 ms 512 KB Correct : C = 398