Submission #14113

#TimeUsernameProblemLanguageResultExecution timeMemory
14113ggoh이상한 수열 (OJUZ10_bizarre)C++98
100 / 100
15 ms9112 KiB
#include<cstdio> #include<algorithm> #include<vector> #include<queue> #include<cstring> int a,b,i,s,p,x[55555],c[2000002],M=1000000; main() { scanf("%d",&a); for(i=1;i<=a;i++) { scanf("%d",&x[i]); c[M+x[i]]++; if(c[M+x[i]]==1)s++; } scanf("%d",&b); if(b<=a) { printf("%d",x[b]); return 0; } else { for(i=a+1;i<=b&&i<=M;i++) { if(c[s+M]==0) { c[s+M]=1; s++; } else { p=1; s++; break; } } if(b<=M)printf("%d",s-1); else { if(p==1)printf("%d",s-1); else { printf("%d",b-M+s-1); } } } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...