Submission #1132916

#TimeUsernameProblemLanguageResultExecution timeMemory
1132916LCJLYList of Unique Integers (FXCUP4_unique)C++20
100 / 100
1 ms584 KiB
#include "unique.h"
#include <bits/stdc++.h>
//#include "grader.cpp"
using namespace std;
 
//#define int long long 
#define ld long double
#define show(x,y) cout << y << " " << #x << endl;
#define show2(x,y,i,j) cout << y << " " << #x << "  " << j << " " << #i << endl;
#define show3(x,y,i,j,p,q) cout << y << " " << #x << "  " << j << " " << #i << "  " << q << " " << #p << endl;
#define show4(x,y) for(auto it:y) cout << it << " "; cout << #x << endl;
typedef pair<int,int>pii;
typedef pair<int,pii>pi2;
mt19937_64 rng(chrono::system_clock::now().time_since_epoch().count());

//UniqueCount

vector<int> PickUnique(int n) {
	vector<int>v;
	int prefix[n];
	int suffix[n];
	for(int x=0;x<n;x++){
		prefix[x]=UniqueCount(0,x);
		suffix[x]=UniqueCount(x,n-1);
	}
	//show4(prefix,prefix);
	//show4(suffix,suffix);
	
	for(int x=0;x<n;x++){
		bool amos=true;
		if(x>0&&prefix[x]<=prefix[x-1]) amos=false;
		if(x<n-1&&suffix[x]<=suffix[x+1]) amos=false;
		v.push_back(amos);
	}
	//show4(v,v);
	return v;
}
#Verdict Execution timeMemoryGrader output
Fetching results...