답안 #247088

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
247088 2020-07-11T05:08:42 Z shenxy List of Unique Integers (FXCUP4_unique) C++17
100 / 100
5 ms 768 KB
#include "unique.h"
#include <algorithm>
#include <vector>
#include <set>
using namespace std;
vector<int> PickUnique(int N) {
	bool preun[N], postun[N];
	fill_n(preun, N, false);
	fill_n(postun, N, false);
	int pre = 0;
	for (int i = 0; i < N; ++i) {
		int k = UniqueCount(0, i);
		if (k > pre) preun[i] = true;
		pre = k;
	}
	pre = 0;
	for (int i = N - 1; i >= 0; --i) {
		int k = UniqueCount(i, N - 1);
		if (k > pre) postun[i] = true;
		pre = k;
	}
	vector<int> ans;
	for (int i = 0; i < N; ++i) {
		if (preun[i] && postun[i]) ans.push_back(1);
		else ans.push_back(0);
	}
	return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Correct : C = 4
2 Correct 4 ms 256 KB Correct : C = 10
3 Correct 4 ms 384 KB Correct : C = 50
4 Correct 4 ms 384 KB Correct : C = 100
5 Correct 4 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 4 ms 384 KB Correct : C = 300
9 Correct 5 ms 768 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 4 ms 512 KB Correct : C = 400
14 Correct 5 ms 512 KB Correct : C = 400
15 Correct 5 ms 512 KB Correct : C = 400