Submission #14292

#TimeUsernameProblemLanguageResultExecution timeMemory
14292mindol이상한 수열 (OJUZ10_bizarre)C++98
8 / 100
31 ms23180 KiB
#include<cstdio> #include<algorithm> #include<set> int s[50001]; int b[5000000]; std::set<int> st; int main() { int n,m,i; scanf("%d",&n); for(i=1;i<=n;i++) scanf("%d",&s[i]),b[i]=s[i],st.insert(s[i]); std::set<int>::iterator k=st.upper_bound(st.size()-1); scanf("%d",&m); if(m<=n) printf("%d",b[m]); else if(m<=n+(*k-st.size()+1)) printf("%d",m-n-1+st.size()); else printf("%d",*k); 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...