답안 #14033

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
14033 2015-04-25T10:51:00 Z baneling100 이상한 수열 (OJUZ10_bizarre) C++
100 / 100
14 ms 1276 KB
#include <stdio.h>
#include <algorithm>
#define INF 0x7fffffff

using namespace std;

int N, S[50001], M, K, Ans;

int main(void) {

    int i;

    scanf("%d",&N);
    for(i=1 ; i<=N ; i++) scanf("%d",&S[i]);
    scanf("%d",&M);
    if(M<=N) printf("%d",S[M]);
    else {
        sort(S+1,S+N+1);
        S[0]=-INF;
        for(i=1 ; i<=N ; i++)
            if(S[i]!=S[i-1]) K++;
        Ans=K+M-N-1;
        for(i=1 ; i<=N ; i++) if(K<=S[i] && S[i]<=K+M-N-1 && Ans>S[i]) Ans=S[i];
        printf("%d",Ans);
    }
    return 0;
}
# 결과 실행 시간 메모리 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
# 결과 실행 시간 메모리 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
# 결과 실행 시간 메모리 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 13 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 8 ms 1276 KB Output is correct
10 Correct 0 ms 1276 KB Output is correct
11 Correct 4 ms 1276 KB Output is correct
12 Correct 0 ms 1276 KB Output is correct
13 Correct 0 ms 1276 KB Output is correct
14 Correct 0 ms 1276 KB Output is correct
15 Correct 14 ms 1276 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 1276 KB Output is correct
2 Correct 8 ms 1276 KB Output is correct
3 Correct 0 ms 1276 KB Output is correct
4 Correct 9 ms 1276 KB Output is correct
5 Correct 12 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 8 ms 1276 KB Output is correct
9 Correct 4 ms 1276 KB Output is correct
10 Correct 0 ms 1276 KB Output is correct
11 Correct 12 ms 1276 KB Output is correct
12 Correct 11 ms 1276 KB Output is correct
13 Correct 0 ms 1276 KB Output is correct
14 Correct 0 ms 1276 KB Output is correct
15 Correct 9 ms 1276 KB Output is correct