Submission #14035

#TimeUsernameProblemLanguageResultExecution timeMemory
14035paulsohn이상한 수열 (OJUZ10_bizarre)C++98
100 / 100
14 ms1280 KiB
#include <cstdio> #include <algorithm> using namespace std; int N, M, d=1; int S[50050]; int main() { int i; scanf("%d",&N); for(i=1;i<=N;++i) scanf("%d",S+i); scanf("%d",&M); if(M<=N){ printf("%d",S[M]); return 0; } sort(S+1,S+N+1); for(i=1;i<N;++i) if(S[i]!=S[i+1]) ++d; for(i=1;i<=N;++i) if(d<=S[i]) break; S[N+1]=0x7FFFFFFF; printf("%d",min(S[i],d+M-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...