Submission #14098

# Submission time Handle Problem Language Result Execution time Memory
14098 2015-05-01T23:08:02 Z comet 이상한 수열 (OJUZ10_bizarre) C++
62 / 100
14 ms 1276 KB
#include<cstdio>
#include<algorithm>
using namespace std;
int n,sz,m,a[50001];
int main(){
	scanf("%d",&n);
	for(int i=0;i<n;i++)scanf("%d",&a[i]);
	sort(a,a+n);
	sz=unique(a,a+n)-a;
	scanf("%d",&m);
	if(m<=n){
		printf("%d",a[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);
	}
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1276 KB Output is correct
2 Incorrect 0 ms 1276 KB Output isn't correct
3 Incorrect 0 ms 1276 KB Output isn't correct
4 Incorrect 0 ms 1276 KB Output isn't correct
5 Incorrect 0 ms 1276 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1276 KB Output is correct
2 Correct 0 ms 1276 KB Output is correct
3 Correct 0 ms 1276 KB Output is correct
4 Correct 0 ms 1276 KB Output is correct
5 Correct 0 ms 1276 KB Output is correct
6 Correct 0 ms 1276 KB Output is correct
7 Correct 0 ms 1276 KB Output is correct
8 Correct 0 ms 1276 KB Output is correct
9 Correct 0 ms 1276 KB Output is correct
10 Correct 0 ms 1276 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 9 ms 1276 KB Output is correct
2 Correct 3 ms 1276 KB Output is correct
3 Incorrect 6 ms 1276 KB Output isn't correct
4 Correct 5 ms 1276 KB Output is correct
5 Incorrect 13 ms 1276 KB Output isn't correct
6 Correct 1 ms 1276 KB Output is correct
7 Correct 0 ms 1276 KB Output is correct
8 Correct 5 ms 1276 KB Output is correct
9 Incorrect 12 ms 1276 KB Output isn't correct
10 Incorrect 11 ms 1276 KB Output isn't correct
11 Incorrect 13 ms 1276 KB Output isn't correct
12 Correct 6 ms 1276 KB Output is correct
13 Incorrect 3 ms 1276 KB Output isn't correct
14 Correct 7 ms 1276 KB Output is correct
15 Correct 6 ms 1276 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 10 ms 1276 KB Output is correct
2 Correct 0 ms 1276 KB Output is correct
3 Correct 0 ms 1276 KB Output is correct
4 Correct 8 ms 1276 KB Output is correct
5 Correct 0 ms 1276 KB Output is correct
6 Correct 13 ms 1276 KB Output is correct
7 Correct 0 ms 1276 KB Output is correct
8 Correct 0 ms 1276 KB Output is correct
9 Correct 3 ms 1276 KB Output is correct
10 Correct 14 ms 1276 KB Output is correct
11 Correct 10 ms 1276 KB Output is correct
12 Correct 3 ms 1276 KB Output is correct
13 Correct 12 ms 1276 KB Output is correct
14 Correct 14 ms 1276 KB Output is correct
15 Correct 14 ms 1276 KB Output is correct