제출 #1248966

#제출 시각아이디문제언어결과실행 시간메모리
1248966huylqHindeks (COCI17_hindeks)C++20
50 / 50
55 ms2372 KiB
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#define ford(a,b,c) for(int a = b; a <= c; a++)
#define fti(a,b,c) for(int a = b; a >= c; a--)
#define file(name) freopen(name ".inp", "r", stdin); freopen(name ".out", "w", stdout);
#define siz size()
#define pll pair<long long,long long>
#define pii pair<int,int>
#define timestart clock_t begin = clock();
#define timeend clock_t end = clock();
#define couttime cout << "\n" << (long double)(end - begin) / CLOCKS_PER_SEC << "s" << "\n";
#define ll long long
#define ms(a,b) memset(a,b,sizeof(a))
#define all(a) a.begin(),a.end()
#define pb push_back
#define fi first
#define se second
using namespace std;
int n,c[500001];
int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    cin >> n;
    ford(i,1,n) cin >> c[i];
    sort(c+1,c+n+1,greater<int>());
    int cnt=0;
    ford(i,1,n) {
        if(c[i]>cnt&&cnt<=i) {
            cnt++;
        }
        else {
            break;
        }
    }
    cout << cnt;
    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...