Submission #15735

#TimeUsernameProblemLanguageResultExecution timeMemory
15735cki86201이상한 수열 (OJUZ10_bizarre)C++98
100 / 100
12 ms3232 KiB
#include<stdio.h> int p[50050], cnt; bool chk[2000020]; int main(){ int n, m; scanf("%d",&n); for(int i=0;i<n;i++)scanf("%d",p+i); scanf("%d",&m); if(m<=n)return printf("%d",p[m-1]) & 0; for(int i=0;i<n;i++){ if(!chk[p[i]+1000000])chk[p[i]+1000000] = 1, cnt++; } int i; for(i=cnt+1000000;i<=2000000 && i<cnt+1000000+m-n-1;i++){ if(chk[i])break; } if(i == 2000001)printf("%d",m-n+cnt-1); else printf("%d",i-1000000); 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...