Submission #148373

#TimeUsernameProblemLanguageResultExecution timeMemory
148373CHT를 사랑하는 모임 (#200)List of Unique Integers (FXCUP4_unique)C++17
100 / 100
6 ms560 KiB
#include "unique.h"
#include <bits/stdc++.h>
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef long double db;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<db,db> pdb;
typedef tuple<int,int,int,int> TP;
typedef vector<vector<ll>> mat;
const int N=1e5+5;
const ll mod=1e9+7;
int n,p1[N],p2[N];
vector<int> ans;
int query(int s,int e)
{
	return UniqueCount(s-1,e-1);
}
vector<int> PickUnique(int n_)
{
	n=n_;
	for(int i=1;i<=n;i++) p1[i]=query(1,i);
	for(int i=1;i<=n;i++) p2[i]=query(i,n);
	for(int i=1;i<=n;i++){
		if(i==1){
			if(p2[i]==p2[i+1]+1) ans.push_back(1);
			else ans.push_back(0);
		}
		else if(i==n){
			if(p1[i]==p1[i-1]+1) ans.push_back(1);
			else ans.push_back(0);
		}
		else{
			if(p1[i]==p1[i-1]+1&&p2[i]==p2[i+1]+1) ans.push_back(1);
			else ans.push_back(0);
		}
	}
	return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...