답안 #14688

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
14688 2015-06-03T12:14:17 Z atomzeno 이상한 수열 (OJUZ10_bizarre) C++
100 / 100
14 ms 2644 KB
#include<stdio.h>
#include<algorithm>
#define N 100002
long long int n,m,a[N],nn=1,b[N],mm;
int main(){
	int i,j;
	scanf("%lld",&n);
	for(i=1;i<=n;i++){scanf("%lld",&a[i]);}
	scanf("%lld",&m);
	if(m<=n){
		printf("%lld",a[m]);
	}
	else{
		m=m-n;
		
		std::sort(a+1,a+n+1);
		b[1]=a[1];
		for(i=2;i<=n;i++){
			if(a[i-1]!=a[i]){
				nn++;
				b[nn]=a[i];
			}
		}
		b[nn+1]=21000000000;
		int g;
		b[0]=-21000000000;
		for(i=1;i<=nn+1;i++){
			if(b[i-1]<nn&&nn<=b[i]){
				g=i;
				break;
			}
		}
		nn+=(m-1);
		if(nn>=b[g]){
			printf("%lld",b[g]);
		}
		else{
			printf("%lld",nn);
		}
	}
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2644 KB Output is correct
2 Correct 0 ms 2644 KB Output is correct
3 Correct 0 ms 2644 KB Output is correct
4 Correct 0 ms 2644 KB Output is correct
5 Correct 0 ms 2644 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2644 KB Output is correct
2 Correct 0 ms 2644 KB Output is correct
3 Correct 0 ms 2644 KB Output is correct
4 Correct 0 ms 2644 KB Output is correct
5 Correct 0 ms 2644 KB Output is correct
6 Correct 0 ms 2644 KB Output is correct
7 Correct 0 ms 2644 KB Output is correct
8 Correct 0 ms 2644 KB Output is correct
9 Correct 0 ms 2644 KB Output is correct
10 Correct 0 ms 2644 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2644 KB Output is correct
2 Correct 7 ms 2644 KB Output is correct
3 Correct 0 ms 2644 KB Output is correct
4 Correct 13 ms 2644 KB Output is correct
5 Correct 0 ms 2644 KB Output is correct
6 Correct 7 ms 2644 KB Output is correct
7 Correct 3 ms 2644 KB Output is correct
8 Correct 0 ms 2644 KB Output is correct
9 Correct 8 ms 2644 KB Output is correct
10 Correct 8 ms 2644 KB Output is correct
11 Correct 10 ms 2644 KB Output is correct
12 Correct 5 ms 2644 KB Output is correct
13 Correct 0 ms 2644 KB Output is correct
14 Correct 0 ms 2644 KB Output is correct
15 Correct 0 ms 2644 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 14 ms 2644 KB Output is correct
2 Correct 0 ms 2644 KB Output is correct
3 Correct 10 ms 2644 KB Output is correct
4 Correct 0 ms 2644 KB Output is correct
5 Correct 5 ms 2644 KB Output is correct
6 Correct 0 ms 2644 KB Output is correct
7 Correct 13 ms 2644 KB Output is correct
8 Correct 14 ms 2644 KB Output is correct
9 Correct 0 ms 2644 KB Output is correct
10 Correct 10 ms 2644 KB Output is correct
11 Correct 7 ms 2644 KB Output is correct
12 Correct 7 ms 2644 KB Output is correct
13 Correct 14 ms 2644 KB Output is correct
14 Correct 0 ms 2644 KB Output is correct
15 Correct 0 ms 2644 KB Output is correct