Submission #15735

# Submission time Handle Problem Language Result Execution time Memory
15735 2015-07-18T19:36:43 Z cki86201 이상한 수열 (OJUZ10_bizarre) C++
100 / 100
12 ms 3232 KB
#include<stdio.h>

int p[50050], cnt;
bool chk[2000020];

int main(){
	int n, m;
	scanf("%d",&n);
	for(int i=0;i<n;i++)scanf("%d",p+i);
	scanf("%d",&m);
	if(m<=n)return printf("%d",p[m-1]) & 0;
	for(int i=0;i<n;i++){
		if(!chk[p[i]+1000000])chk[p[i]+1000000] = 1, cnt++;
	}
	int i;
	for(i=cnt+1000000;i<=2000000 && i<cnt+1000000+m-n-1;i++){
		if(chk[i])break;
	}
	if(i == 2000001)printf("%d",m-n+cnt-1);
	else printf("%d",i-1000000);
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 3232 KB Output is correct
2 Correct 0 ms 3232 KB Output is correct
3 Correct 0 ms 3232 KB Output is correct
4 Correct 0 ms 3232 KB Output is correct
5 Correct 0 ms 3232 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 3232 KB Output is correct
2 Correct 0 ms 3232 KB Output is correct
3 Correct 0 ms 3232 KB Output is correct
4 Correct 0 ms 3232 KB Output is correct
5 Correct 0 ms 3232 KB Output is correct
6 Correct 0 ms 3232 KB Output is correct
7 Correct 0 ms 3232 KB Output is correct
8 Correct 0 ms 3232 KB Output is correct
9 Correct 0 ms 3232 KB Output is correct
10 Correct 0 ms 3232 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 3232 KB Output is correct
2 Correct 0 ms 3232 KB Output is correct
3 Correct 2 ms 3232 KB Output is correct
4 Correct 6 ms 3232 KB Output is correct
5 Correct 0 ms 3232 KB Output is correct
6 Correct 0 ms 3232 KB Output is correct
7 Correct 5 ms 3232 KB Output is correct
8 Correct 1 ms 3232 KB Output is correct
9 Correct 0 ms 3232 KB Output is correct
10 Correct 7 ms 3232 KB Output is correct
11 Correct 0 ms 3232 KB Output is correct
12 Correct 3 ms 3232 KB Output is correct
13 Correct 7 ms 3232 KB Output is correct
14 Correct 4 ms 3232 KB Output is correct
15 Correct 0 ms 3232 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 3232 KB Output is correct
2 Correct 4 ms 3232 KB Output is correct
3 Correct 10 ms 3232 KB Output is correct
4 Correct 12 ms 3232 KB Output is correct
5 Correct 8 ms 3232 KB Output is correct
6 Correct 9 ms 3232 KB Output is correct
7 Correct 5 ms 3232 KB Output is correct
8 Correct 0 ms 3232 KB Output is correct
9 Correct 7 ms 3232 KB Output is correct
10 Correct 0 ms 3232 KB Output is correct
11 Correct 3 ms 3232 KB Output is correct
12 Correct 3 ms 3232 KB Output is correct
13 Correct 7 ms 3232 KB Output is correct
14 Correct 0 ms 3232 KB Output is correct
15 Correct 0 ms 3232 KB Output is correct