119872024-11-22 16:22:15SzZsHús sütés (75 pont)cpp11Wrong answer 0/75400ms776 KiB
#include <iostream>
//#include <algorithm>

using namespace std;

const int MaxN = 100000;

int main()
{
    setlocale(LC_ALL, "hun"); //ékezetes kirásokhoz
    
    int husdb;
    cin >> husdb;

    int fokok[MaxN];
    for (int i = 1; i <= husdb; i++)
    {
        cin >> fokok[i-1];
    }

    //rendezzük sorba a husikat
    //int len = sizeof(fokok) / sizeof(fokok[0]);
    //sort(fokok, fokok+len);
    int seged;
    for (int i = 1; i <= husdb - 1; i++)
    {
        for (int j = i + 1; j <= husdb; j++)
        {
            if (fokok[i-1] < fokok[j-1])
            {
                seged = fokok[i-1];
                fokok[i-1] = fokok[j-1];
                fokok[j-1] = seged;
            }
        }
    }
    //ell.kiírás
    for (int i = 1; i <= husdb; i++)
    {
        cout << fokok[i - 1] << " ";
    }
    cout << endl;

    int valasz = fokok[0]; //a legnagyobbig biztos sütni kell
    int kulonbseg = 0; //egymás melletti adatok között összegyûjtött idõkül.
    for (int i = 1; i <= husdb - 1; i++)
    {
        if (fokok[i - 1] == fokok[i] && kulonbseg == 0) //ha ez a husi és köv.husi ugyanott tart
        {
            valasz++;
        }
        else
        {
            if (fokok[i - 1] == fokok[i] && kulonbseg > 0)
            {
                kulonbseg--;
            }
            else
            {
                kulonbseg = kulonbseg + fokok[i - 1] - fokok[i] - 1;
            }
        }
    }

    cout << valasz;
}
SubtaskSumTestVerdictTimeMemory
base0/75
1Wrong answer0/01ms512 KiB
2Wrong answer0/01ms320 KiB
3Time limit exceeded0/0384ms568 KiB
4Wrong answer0/31ms320 KiB
5Wrong answer0/31ms320 KiB
6Wrong answer0/31ms320 KiB
7Wrong answer0/31ms320 KiB
8Wrong answer0/41ms320 KiB
9Wrong answer0/41ms320 KiB
10Wrong answer0/42ms320 KiB
11Wrong answer0/43ms420 KiB
12Wrong answer0/43ms416 KiB
13Time limit exceeded0/4400ms772 KiB
14Time limit exceeded0/4400ms568 KiB
15Time limit exceeded0/5400ms664 KiB
16Time limit exceeded0/5389ms568 KiB
17Time limit exceeded0/5379ms776 KiB
18Time limit exceeded0/4400ms568 KiB
19Time limit exceeded0/4400ms568 KiB
20Time limit exceeded0/4391ms568 KiB
21Time limit exceeded0/4381ms572 KiB
22Time limit exceeded0/2400ms568 KiB
23Time limit exceeded0/2400ms568 KiB