Submission #14115

#TimeUsernameProblemLanguageResultExecution timeMemory
14115minchurl이상한 수열 (OJUZ10_bizarre)C++98
62 / 100
12 ms9092 KiB
#include<stdio.h> #define N 1000000 int chk[2*N+5],n,m,max,cnt,b[50005]; FILE *in,*out; int main(){ int i,x; scanf("%d",&n); for(i=1;i<=n;i++){ scanf("%d",&x); if(chk[x+N]==1) continue; chk[x+N]=1; cnt++; b[i]=x; max=max>x?max:x; } scanf("%d",&m); for(i=1;i<=n;i++){ if(i==m){ printf("%d\n",b[i]); return 0; } } if(cnt>max){ printf("%d\n",cnt+m-n-1); return 0; } while(1){ if(chk[N+cnt]==1 || i==m){ printf("%d\n",cnt); return 0; } chk[N+cnt]=1; cnt++; i++; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...