답안 #14057

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
14057 2015-04-26T01:59:35 Z kipa00 이상한 수열 (OJUZ10_bizarre) C++
62 / 100
15 ms 1600 KB
#include <cstdio>
#include <algorithm>
using namespace std;

int arr[50000];
int main() {
    int N, i, differ = 1, sup = 1000001, ord, tst;
    scanf("%d", &N);
    for (i=0; i<N; ++i) {
        scanf("%d", arr+i);
    }
    scanf("%d", &ord);
    if (ord <= N) {
        printf("%d\n", arr[ord - 1]);
        return 0;
    }
    stable_sort(arr, arr+N);
    for (i=1; i<N; ++i) {
        differ += (arr[i] != arr[i - 1]);
    }
    for (i=0; i<N; ++i) {
        if (arr[i] >= differ) {
            sup = arr[i];
            break;
        }
    }
    tst = ord - (N + 1) + differ;
    if (tst >= sup) tst = sup;
    printf("%d\n", tst);
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 1408 KB Output is correct
2 Correct 0 ms 1408 KB Output is correct
3 Correct 0 ms 1408 KB Output is correct
4 Correct 0 ms 1408 KB Output is correct
5 Correct 0 ms 1408 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 1408 KB Output is correct
2 Correct 0 ms 1408 KB Output is correct
3 Correct 0 ms 1408 KB Output is correct
4 Correct 0 ms 1408 KB Output is correct
5 Correct 0 ms 1408 KB Output is correct
6 Correct 0 ms 1408 KB Output is correct
7 Correct 0 ms 1408 KB Output is correct
8 Correct 0 ms 1408 KB Output is correct
9 Correct 0 ms 1408 KB Output is correct
10 Correct 0 ms 1408 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 1408 KB Output is correct
2 Correct 0 ms 1408 KB Output is correct
3 Correct 0 ms 1408 KB Output is correct
4 Correct 5 ms 1564 KB Output is correct
5 Correct 0 ms 1408 KB Output is correct
6 Correct 15 ms 1600 KB Output is correct
7 Correct 14 ms 1600 KB Output is correct
8 Correct 0 ms 1408 KB Output is correct
9 Correct 0 ms 1408 KB Output is correct
10 Correct 0 ms 1408 KB Output is correct
11 Correct 0 ms 1408 KB Output is correct
12 Correct 0 ms 1408 KB Output is correct
13 Correct 0 ms 1556 KB Output is correct
14 Correct 11 ms 1600 KB Output is correct
15 Correct 0 ms 1408 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 1600 KB Output is correct
2 Incorrect 0 ms 1408 KB Output isn't correct
3 Correct 0 ms 1408 KB Output is correct
4 Incorrect 14 ms 1600 KB Output isn't correct
5 Correct 9 ms 1600 KB Output is correct
6 Incorrect 6 ms 1408 KB Output isn't correct
7 Incorrect 0 ms 1556 KB Output isn't correct
8 Incorrect 15 ms 1600 KB Output isn't correct
9 Incorrect 5 ms 1592 KB Output isn't correct
10 Correct 0 ms 1408 KB Output is correct
11 Incorrect 6 ms 1564 KB Output isn't correct
12 Incorrect 11 ms 1600 KB Output isn't correct
13 Correct 0 ms 1408 KB Output is correct
14 Incorrect 11 ms 1600 KB Output isn't correct
15 Correct 9 ms 1600 KB Output is correct