제출 #165716

#제출 시각아이디문제언어결과실행 시간메모리
165716itiamHindeks (COCI17_hindeks)C++11
50 / 50
305 ms2312 KiB
#include <iostream> #include <algorithm> #include <cstdio> using namespace std; int L[500005]; int main(){ int N,x,zb=0,me=0,br=0; cin >> N; for (int i=0;i<N;i++){ cin >> x; if (x<=500000) L[x]+=1; else L[500000+1]+=1; if (x>me) me=x; } if (me>=500000){ me=500001; } /*cout << "L: "; for (int i=0;i<=me;i++) cout << L[i] << " "; cout << "\n"; */ for (int i=me;i>=0;i--){ for (int j=i;j<=me-br;j++){ zb+=L[j]; } //cout << "zb: " << zb << "\n"; br+=1; if (zb>=i){ zb=i; break; } } cout << zb; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...