답안 #14015

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
14015 2015-04-25T00:27:29 Z pjsdream 이상한 수열 (OJUZ10_bizarre) C++14
100 / 100
32 ms 3652 KB
#pragma warning(disable:4996)

#include <stdio.h>
#include <set>
using namespace std;

int n, m;
int a[50000];
set<int> s;

int main()
{
	scanf("%d", &n);
	for (int i=0; i<n; i++) scanf("%d", &a[i]), s.insert(a[i]);
	scanf("%d", &m);

	if (m<=n) {
		printf("%d\n", a[m-1]);
	}
	else {
		m -= n+1;

		int b = s.size();
		int e;

		// B_n+1 = b

		auto it = s.lower_bound(b);
		if (it == s.end()) e = 2000000000;
		else e = *it;

		if (b+m <= e) printf("%d\n", b+m);
		else printf("%d\n", e);
	}

	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 1408 KB Output is correct
2 Correct 0 ms 1408 KB Output is correct
3 Correct 0 ms 1408 KB Output is correct
4 Correct 0 ms 1408 KB Output is correct
5 Correct 0 ms 1408 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 1408 KB Output is correct
2 Correct 0 ms 1408 KB Output is correct
3 Correct 0 ms 1408 KB Output is correct
4 Correct 0 ms 1408 KB Output is correct
5 Correct 0 ms 1408 KB Output is correct
6 Correct 0 ms 1408 KB Output is correct
7 Correct 0 ms 1408 KB Output is correct
8 Correct 0 ms 1408 KB Output is correct
9 Correct 0 ms 1408 KB Output is correct
10 Correct 0 ms 1408 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 23 ms 2860 KB Output is correct
2 Correct 0 ms 1408 KB Output is correct
3 Correct 0 ms 1408 KB Output is correct
4 Correct 4 ms 1804 KB Output is correct
5 Correct 2 ms 1408 KB Output is correct
6 Correct 8 ms 1408 KB Output is correct
7 Correct 0 ms 1804 KB Output is correct
8 Correct 5 ms 1408 KB Output is correct
9 Correct 24 ms 3652 KB Output is correct
10 Correct 6 ms 1408 KB Output is correct
11 Correct 0 ms 1672 KB Output is correct
12 Correct 3 ms 1408 KB Output is correct
13 Correct 17 ms 3388 KB Output is correct
14 Correct 27 ms 3652 KB Output is correct
15 Correct 15 ms 1936 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 32 ms 3652 KB Output is correct
2 Correct 5 ms 1408 KB Output is correct
3 Correct 0 ms 1672 KB Output is correct
4 Correct 5 ms 1804 KB Output is correct
5 Correct 7 ms 1408 KB Output is correct
6 Correct 26 ms 3652 KB Output is correct
7 Correct 9 ms 1408 KB Output is correct
8 Correct 21 ms 1936 KB Output is correct
9 Correct 3 ms 1408 KB Output is correct
10 Correct 30 ms 3388 KB Output is correct
11 Correct 5 ms 1408 KB Output is correct
12 Correct 3 ms 1408 KB Output is correct
13 Correct 9 ms 1408 KB Output is correct
14 Correct 23 ms 2860 KB Output is correct
15 Correct 0 ms 1408 KB Output is correct