31092023-02-15 19:53:07baranyimarcellHús sütés (75 pont)cpp17Time limit exceeded 42/75377ms12148 KiB
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main()
{
    int N, i, j;
    cin>>N;
    int hus[N];
    vector<int> db;
    db.resize(1000000);
    vector<int> kulonb;
    int mx=0, mxh, mn;
    for (i=0; i<N; i++)
    {
        cin>>hus[i];
        if (i==0) mn=hus[0];
        db[hus[i]]+=1;
        if (count(kulonb.begin(), kulonb.end(), hus[i])==false)
        {
            kulonb.push_back(hus[i]);
        }
        //if (hus[i]>mx) mx=hus[i];
        if (hus[i]<mn) mn=hus[i];
    }
    int ki=0;
    vector<int> csokkeno;
    for (i=0; i<kulonb.size(); i++)
    {
        for (j=0; j<kulonb.size(); j++)
        {
            if (kulonb[j]>mx) mx=kulonb[j], mxh=j;
        }
        csokkeno.push_back(mx);
        mx=0;
        kulonb[mxh]=mn;
        //cout<<csokkeno[i]<<endl;;
    }
    int szml=0;
    for (i=0; i<csokkeno.size(); i++)
    {
        szml+=db[csokkeno[i]];
        if (szml+csokkeno[i]-1>mx) mx=szml+csokkeno[i]-1;
    }
    cout<<mx<<endl;
}
SubtaskSumTestVerdictTimeMemory
base42/75
1Accepted0/06ms9528 KiB
2Accepted0/04ms9740 KiB
3Time limit exceeded0/0367ms5916 KiB
4Accepted3/34ms10204 KiB
5Accepted3/34ms10440 KiB
6Accepted3/36ms10300 KiB
7Accepted3/36ms10708 KiB
8Accepted4/44ms10624 KiB
9Accepted4/44ms10880 KiB
10Accepted4/46ms10720 KiB
11Accepted4/46ms10752 KiB
12Accepted4/46ms10880 KiB
13Time limit exceeded0/4354ms6980 KiB
14Time limit exceeded0/4365ms7244 KiB
15Time limit exceeded0/5377ms7156 KiB
16Time limit exceeded0/5360ms7484 KiB
17Time limit exceeded0/5363ms7544 KiB
18Time limit exceeded0/4375ms7548 KiB
19Time limit exceeded0/4375ms7760 KiB
20Accepted4/443ms12148 KiB
21Accepted4/4122ms12144 KiB
22Time limit exceeded0/2356ms7532 KiB
23Accepted2/221ms12148 KiB