Submission #13926

# Submission time Handle Problem Language Result Execution time Memory
13926 2015-04-23T15:38:29 Z model_code 이상한 수열 (OJUZ10_bizarre) C++
100 / 100
14 ms 1280 KB
#include<stdio.h>
#include<algorithm>
using namespace std;

int n, ba[50050], k, m;
// num is a b c ...(k) p q .. z : a b c .. p q .. z k k+1 ... p p p p

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