31222023-02-17 07:45:41baranyimarcellHús sütés (75 pont)cpp17Accepted 75/7550ms12672 KiB
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main()
{
    int N, i, j;
    cin>>N;
    vector<int> hus(N);
    vector<int> db;
    db.resize(1000000);
    int mx=0;
    for (i=0; i<N; i++)
    {
        cin>>hus[i];
    }
    sort(hus.begin(), hus.end(), std::greater<int>());
    int szml=0;
    for (i=0; i<N; i++)
    {
        szml+=1;
        if (szml+hus[i]-1>mx) mx=szml+hus[i]-1;
    }
    cout<<mx<<endl;
}
SubtaskSumTestVerdictTimeMemory
base75/75
1Accepted0/06ms9532 KiB
2Accepted0/06ms9816 KiB
3Accepted0/028ms10340 KiB
4Accepted3/34ms10160 KiB
5Accepted3/36ms10116 KiB
6Accepted3/36ms10376 KiB
7Accepted3/36ms10584 KiB
8Accepted4/44ms10540 KiB
9Accepted4/46ms10800 KiB
10Accepted4/46ms10752 KiB
11Accepted4/47ms11012 KiB
12Accepted4/46ms11420 KiB
13Accepted4/450ms12156 KiB
14Accepted4/450ms12044 KiB
15Accepted5/548ms12320 KiB
16Accepted5/550ms12256 KiB
17Accepted5/550ms12404 KiB
18Accepted4/450ms12536 KiB
19Accepted4/450ms12496 KiB
20Accepted4/446ms12496 KiB
21Accepted4/435ms12520 KiB
22Accepted2/246ms12672 KiB
23Accepted2/224ms12632 KiB