답안 #14301

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
14301 2015-05-10T15:23:42 Z operaghost 이상한 수열 (OJUZ10_bizarre) C++
100 / 100
14 ms 9092 KB
#include <stdio.h>
#include <stdlib.h>
#define MIN(a,b)a<b?a:b
int a[50001],visit[2000002],mi=0x7fffffff;
int main()
{
    int n,i,m,cnt=0;
    scanf("%d",&n);
    for(i=1;i<=n;i++){
        scanf("%d",&a[i]);
        if(a[i]>=0&&visit[a[i]]==0)                 cnt++,visit[a[i]]=1;
        else if(a[i]<0&&visit[abs(a[i])+1000000]==0)cnt++,visit[abs(a[i])+1000000]=1;
        //if(a[i]>=0&&a[i]>=n&&a[i]<mi)mi=a[i];
    }
    for(i=1;i<=n;i++){
        if(a[i]>=0&&a[i]>=cnt&&a[i]<mi)mi=a[i];
    }
    scanf("%d",&m);
    //printf("%d %d\n",cnt,mi);
    if(m<=n)printf("%d",a[m]);
    else{
        if(n+mi-cnt+1<=m&&mi!=0x7fffffff)printf("%d",mi);
        else                             printf("%d",cnt+m-n-1);
    }
   return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 9092 KB Output is correct
2 Correct 0 ms 9092 KB Output is correct
3 Correct 0 ms 9092 KB Output is correct
4 Correct 0 ms 9092 KB Output is correct
5 Correct 0 ms 9092 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 9092 KB Output is correct
2 Correct 1 ms 9092 KB Output is correct
3 Correct 0 ms 9092 KB Output is correct
4 Correct 0 ms 9092 KB Output is correct
5 Correct 0 ms 9092 KB Output is correct
6 Correct 0 ms 9092 KB Output is correct
7 Correct 0 ms 9092 KB Output is correct
8 Correct 0 ms 9092 KB Output is correct
9 Correct 0 ms 9092 KB Output is correct
10 Correct 0 ms 9092 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 9092 KB Output is correct
2 Correct 0 ms 9092 KB Output is correct
3 Correct 2 ms 9092 KB Output is correct
4 Correct 5 ms 9092 KB Output is correct
5 Correct 11 ms 9092 KB Output is correct
6 Correct 4 ms 9092 KB Output is correct
7 Correct 5 ms 9092 KB Output is correct
8 Correct 0 ms 9092 KB Output is correct
9 Correct 0 ms 9092 KB Output is correct
10 Correct 3 ms 9092 KB Output is correct
11 Correct 5 ms 9092 KB Output is correct
12 Correct 0 ms 9092 KB Output is correct
13 Correct 5 ms 9092 KB Output is correct
14 Correct 8 ms 9092 KB Output is correct
15 Correct 10 ms 9092 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 9092 KB Output is correct
2 Correct 0 ms 9092 KB Output is correct
3 Correct 3 ms 9092 KB Output is correct
4 Correct 2 ms 9092 KB Output is correct
5 Correct 4 ms 9092 KB Output is correct
6 Correct 14 ms 9092 KB Output is correct
7 Correct 0 ms 9092 KB Output is correct
8 Correct 10 ms 9092 KB Output is correct
9 Correct 2 ms 9092 KB Output is correct
10 Correct 5 ms 9092 KB Output is correct
11 Correct 11 ms 9092 KB Output is correct
12 Correct 4 ms 9092 KB Output is correct
13 Correct 7 ms 9092 KB Output is correct
14 Correct 8 ms 9092 KB Output is correct
15 Correct 1 ms 9092 KB Output is correct