Submission #14450

# Submission time Handle Problem Language Result Execution time Memory
14450 2015-05-17T06:25:57 Z yys980 이상한 수열 (OJUZ10_bizarre) C++
100 / 100
18 ms 9324 KB
#include <stdio.h>
#include <algorithm>
using namespace std;
int n,m;
int a[110000],cnt=0,Mnt;
int check[2000100];
int main()
{
    scanf("%d",&n);
    int i,f=0;
    for(i = 1 ; i <= n ; i++){
        scanf("%d",&a[i]);
        if(check[a[i]+1000000]==0)cnt++;
        check[a[i]+1000000]=1;
    }
    scanf("%d",&m);
    if(m <= n){
        printf("%d",a[m]);
    }
    else
    {
        Mnt=m-n+cnt-1;
        sort(a+1,a+n+1);
        for(i = 1 ; i <= n ; i++){
            if(a[i]<cnt)continue;
            if(a[i]>=Mnt)break;
            f=1;
            printf("%d",a[i]);
            break;
        }
        if(f==0)printf("%d",Mnt);
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 9324 KB Output is correct
2 Correct 0 ms 9324 KB Output is correct
3 Correct 0 ms 9324 KB Output is correct
4 Correct 0 ms 9324 KB Output is correct
5 Correct 0 ms 9324 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 9324 KB Output is correct
2 Correct 0 ms 9324 KB Output is correct
3 Correct 0 ms 9324 KB Output is correct
4 Correct 0 ms 9324 KB Output is correct
5 Correct 0 ms 9324 KB Output is correct
6 Correct 0 ms 9324 KB Output is correct
7 Correct 0 ms 9324 KB Output is correct
8 Correct 0 ms 9324 KB Output is correct
9 Correct 0 ms 9324 KB Output is correct
10 Correct 0 ms 9324 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 9324 KB Output is correct
2 Correct 0 ms 9324 KB Output is correct
3 Correct 10 ms 9324 KB Output is correct
4 Correct 4 ms 9324 KB Output is correct
5 Correct 2 ms 9324 KB Output is correct
6 Correct 0 ms 9324 KB Output is correct
7 Correct 0 ms 9324 KB Output is correct
8 Correct 0 ms 9324 KB Output is correct
9 Correct 7 ms 9324 KB Output is correct
10 Correct 0 ms 9324 KB Output is correct
11 Correct 0 ms 9324 KB Output is correct
12 Correct 1 ms 9324 KB Output is correct
13 Correct 8 ms 9324 KB Output is correct
14 Correct 15 ms 9324 KB Output is correct
15 Correct 12 ms 9324 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 9324 KB Output is correct
2 Correct 0 ms 9324 KB Output is correct
3 Correct 0 ms 9324 KB Output is correct
4 Correct 13 ms 9324 KB Output is correct
5 Correct 2 ms 9324 KB Output is correct
6 Correct 14 ms 9324 KB Output is correct
7 Correct 8 ms 9324 KB Output is correct
8 Correct 5 ms 9324 KB Output is correct
9 Correct 9 ms 9324 KB Output is correct
10 Correct 4 ms 9324 KB Output is correct
11 Correct 18 ms 9324 KB Output is correct
12 Correct 0 ms 9324 KB Output is correct
13 Correct 0 ms 9324 KB Output is correct
14 Correct 6 ms 9324 KB Output is correct
15 Correct 13 ms 9324 KB Output is correct