답안 #148373

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
148373 2019-09-01T04:12:07 Z CHT를 사랑하는 모임(#3587, moonrabbit2, Retro3014, gs18115) List of Unique Integers (FXCUP4_unique) C++17
100 / 100
6 ms 560 KB
#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;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Correct : C = 4
2 Correct 5 ms 384 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 256 KB Correct : C = 100
6 Correct 6 ms 432 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 6 ms 512 KB Correct : C = 400
11 Correct 6 ms 512 KB Correct : C = 400
12 Correct 6 ms 560 KB Correct : C = 400
13 Correct 5 ms 512 KB Correct : C = 400
14 Correct 6 ms 512 KB Correct : C = 400
15 Correct 6 ms 512 KB Correct : C = 400