Submission #14155

#TimeUsernameProblemLanguageResultExecution timeMemory
14155dohyun0324이상한 수열 (OJUZ10_bizarre)C++98
100 / 100
38 ms3848 KiB
#include<stdio.h> #include<map> using namespace std; int k,mini=2147483647,x[50010],n,ch[50010]; map<int,int >m; int main() { int i,cnt=0; scanf("%d",&n); for(i=1;i<=n;i++) { scanf("%d",&x[i]); if(m[x[i]]==0) cnt++; m[x[i]]=1; } for(i=1;i<=n;i++) { if(x[i]>=cnt && mini>x[i]) mini=x[i]; } scanf("%d",&k); if(k<=n) printf("%d",x[k]); else if(mini==2147483647) printf("%d",k+cnt-n-1); else if(k>=mini-cnt+1+n) printf("%d",mini); else printf("%d",cnt+k-n-1); 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...