Submission #14339

#TimeUsernameProblemLanguageResultExecution timeMemory
14339Namnamseo이상한 수열 (OJUZ10_bizarre)C++98
100 / 100
124 ms8932 KiB
#include <cstdio> #include <set> using namespace std; set<int> s; int n; int data[50010]; int main() { scanf("%d",&n); int i; for(i=1;i<=n;++i) scanf("%d",data+i); int om,m; scanf("%d",&m); if(m<=n){ printf("%d\n",data[m]); } else { for(i=1;i<=n;++i) s.insert(data[i]); m-=n+1; set<int>::iterator it; for(i=1;m;++i){ if(s.lower_bound(s.size())==s.end()){ break; } if(s.find(s.size()) != s.end()){ m=0; break; } --m; s.insert(s.size()); } if(m){ printf("%d\n",s.size()+m); } else printf("%d\n",s.size()); } 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...