답안 #14099

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
14099 2015-05-01T23:09:13 Z comet 이상한 수열 (OJUZ10_bizarre) C++
100 / 100
15 ms 1472 KB
#include<cstdio>
#include<algorithm>
using namespace std;
int n,sz,m,a[50001],b[50001];
int main(){
	scanf("%d",&n);
	for(int i=0;i<n;i++)scanf("%d",&a[i]),b[i]=a[i];
	sort(a,a+n);
	sz=unique(a,a+n)-a;
	scanf("%d",&m);
	if(m<=n){
		printf("%d",b[m-1]);
		return 0;
	}
	//for(int i=0;i<sz;i++)printf("%d ",a[i]);
	//puts("");
	int l=lower_bound(a,a+sz,sz)-a;
	if(l==sz){
		printf("%d",m-n-1+sz);
		return 0;
	}
	else{
		if(m-n-1+sz>=a[l]){
			printf("%d",a[l]);
			return 0;
		}
		printf("%d",m-n-1+sz);
	}
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 1472 KB Output is correct
2 Correct 0 ms 1472 KB Output is correct
3 Correct 0 ms 1472 KB Output is correct
4 Correct 0 ms 1472 KB Output is correct
5 Correct 0 ms 1472 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 1472 KB Output is correct
2 Correct 0 ms 1472 KB Output is correct
3 Correct 0 ms 1472 KB Output is correct
4 Correct 0 ms 1472 KB Output is correct
5 Correct 0 ms 1472 KB Output is correct
6 Correct 0 ms 1472 KB Output is correct
7 Correct 0 ms 1472 KB Output is correct
8 Correct 0 ms 1472 KB Output is correct
9 Correct 0 ms 1472 KB Output is correct
10 Correct 0 ms 1472 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 14 ms 1472 KB Output is correct
2 Correct 12 ms 1472 KB Output is correct
3 Correct 0 ms 1472 KB Output is correct
4 Correct 13 ms 1472 KB Output is correct
5 Correct 8 ms 1472 KB Output is correct
6 Correct 11 ms 1472 KB Output is correct
7 Correct 0 ms 1472 KB Output is correct
8 Correct 0 ms 1472 KB Output is correct
9 Correct 0 ms 1472 KB Output is correct
10 Correct 0 ms 1472 KB Output is correct
11 Correct 0 ms 1472 KB Output is correct
12 Correct 3 ms 1472 KB Output is correct
13 Correct 15 ms 1472 KB Output is correct
14 Correct 0 ms 1472 KB Output is correct
15 Correct 10 ms 1472 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 1472 KB Output is correct
2 Correct 6 ms 1472 KB Output is correct
3 Correct 14 ms 1472 KB Output is correct
4 Correct 0 ms 1472 KB Output is correct
5 Correct 13 ms 1472 KB Output is correct
6 Correct 0 ms 1472 KB Output is correct
7 Correct 3 ms 1472 KB Output is correct
8 Correct 11 ms 1472 KB Output is correct
9 Correct 0 ms 1472 KB Output is correct
10 Correct 13 ms 1472 KB Output is correct
11 Correct 14 ms 1472 KB Output is correct
12 Correct 0 ms 1472 KB Output is correct
13 Correct 14 ms 1472 KB Output is correct
14 Correct 10 ms 1472 KB Output is correct
15 Correct 4 ms 1472 KB Output is correct