Submission #18893

#TimeUsernameProblemLanguageResultExecution timeMemory
18893chan492811이상한 수열 (OJUZ10_bizarre)C++98
100 / 100
10 ms3232 KiB
#include <cstdio> int n,m; int ip[50010]; bool arr[2000010]; int main(){ int i,now=0,a; scanf("%d",&n); for(i=1;i<=n;i++){ scanf("%d",&ip[i]); ip[i]+=1000000; if(!arr[ip[i]]) now++; arr[ip[i]]=1; } scanf("%d",&m); now+=1000000; if(m<=n){ printf("%d",ip[m]-1000000); return 0; } m-=n+1; while(m && now<=2000005 && !arr[now]) now++,m--; if(now<=2000005) printf("%d",now-1000000); else printf("%d",now+m-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...