답안 #13967

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
13967 2015-04-24T16:39:44 Z gs14004 이상한 수열 (OJUZ10_bizarre) C++14
8 / 100
15 ms 1472 KB
#include <cstdio>
#include <algorithm>
using namespace std;

int n,a[100005];

int main(){
    scanf("%d",&n);
    for (int i=0; i<n; i++) {
        scanf("%d",&a[i]);
    }
    int m;
    scanf("%d",&m);
    if(m <= n){
        printf("%d",a[m-1]);
        return 0;
    }
    sort(a,a+n);
    m -= n;
    n = (int)(unique(a,a+n) - a);
    int k = (int)(lower_bound(a,a+n,m) - a);
    if(k == n){
        printf("%d",m - n + 1);
        return 0;
    }
    m--;
    while (m && n < a[k]) {
        n++;
        m--;
    }
    printf("%d",n);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 1472 KB Output is correct
2 Correct 0 ms 1472 KB Output is correct
3 Correct 0 ms 1472 KB Output is correct
4 Correct 0 ms 1472 KB Output is correct
5 Correct 0 ms 1472 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 1472 KB Output is correct
2 Incorrect 0 ms 1472 KB Output isn't correct
3 Incorrect 0 ms 1472 KB Output isn't correct
4 Incorrect 0 ms 1472 KB Output isn't correct
5 Incorrect 0 ms 1472 KB Output isn't correct
6 Correct 0 ms 1472 KB Output is correct
7 Correct 0 ms 1472 KB Output is correct
8 Incorrect 0 ms 1472 KB Output isn't correct
9 Incorrect 0 ms 1472 KB Output isn't correct
10 Incorrect 0 ms 1472 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 1472 KB Output isn't correct
2 Incorrect 0 ms 1472 KB Output isn't correct
3 Correct 0 ms 1472 KB Output is correct
4 Correct 0 ms 1472 KB Output is correct
5 Correct 0 ms 1472 KB Output is correct
6 Incorrect 0 ms 1472 KB Output isn't correct
7 Correct 5 ms 1472 KB Output is correct
8 Incorrect 0 ms 1472 KB Output isn't correct
9 Incorrect 0 ms 1472 KB Output isn't correct
10 Correct 7 ms 1472 KB Output is correct
11 Incorrect 15 ms 1472 KB Output isn't correct
12 Incorrect 8 ms 1472 KB Output isn't correct
13 Correct 0 ms 1472 KB Output is correct
14 Correct 0 ms 1472 KB Output is correct
15 Incorrect 0 ms 1472 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 1472 KB Output isn't correct
2 Incorrect 0 ms 1472 KB Output isn't correct
3 Incorrect 0 ms 1472 KB Output isn't correct
4 Incorrect 7 ms 1472 KB Output isn't correct
5 Incorrect 12 ms 1472 KB Output isn't correct
6 Incorrect 14 ms 1472 KB Output isn't correct
7 Incorrect 12 ms 1472 KB Output isn't correct
8 Incorrect 0 ms 1472 KB Output isn't correct
9 Incorrect 10 ms 1472 KB Output isn't correct
10 Correct 6 ms 1472 KB Output is correct
11 Incorrect 11 ms 1472 KB Output isn't correct
12 Incorrect 10 ms 1472 KB Output isn't correct
13 Incorrect 0 ms 1472 KB Output isn't correct
14 Incorrect 8 ms 1472 KB Output isn't correct
15 Incorrect 0 ms 1472 KB Output isn't correct