Submission #14099

#TimeUsernameProblemLanguageResultExecution timeMemory
14099comet이상한 수열 (OJUZ10_bizarre)C++98
100 / 100
15 ms1472 KiB
#include<cstdio> #include<algorithm> using namespace std; int n,sz,m,a[50001],b[50001]; int main(){ scanf("%d",&n); for(int i=0;i<n;i++)scanf("%d",&a[i]),b[i]=a[i]; sort(a,a+n); sz=unique(a,a+n)-a; scanf("%d",&m); if(m<=n){ printf("%d",b[m-1]); return 0; } //for(int i=0;i<sz;i++)printf("%d ",a[i]); //puts(""); int l=lower_bound(a,a+sz,sz)-a; if(l==sz){ printf("%d",m-n-1+sz); return 0; } else{ if(m-n-1+sz>=a[l]){ printf("%d",a[l]); return 0; } printf("%d",m-n-1+sz); } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...