94222024-02-21 15:02:58KristófLeghosszabb nyaralás (75 pont)cpp17Time limit exceeded 16/75300ms4068 KiB
#include <iostream>
#include <vector>
struct penz{
    int budget;
    int nap;
} typedef;

using namespace std;

int main()
{
    int n , p;
    cin>>n>>p;
    int num;
    vector <penz> napok;
    int max=INT8_MIN;
    for(int i=0;i<n;i++)
    {
        cin>>num;
        napok.push_back({num,1});
        for(int j=0;j<napok.size()-1;j++)
        {
            if(napok[j].budget<p+1)
                {
                    napok[j].budget+=num;
                    napok[j].nap+=1;
                }
                else
                    {
                        if(napok[j].nap-1>max)
                        {
                            max=napok[j].nap-1;
                        }
                        napok.erase(napok.begin()+j);
                    }
        }
    }


    cout<<max;



    return 0;
}
SubtaskSumTestVerdictTimeMemory
base16/75
1Accepted0/03ms1808 KiB
2Time limit exceeded0/0300ms1544 KiB
3Accepted3/33ms2248 KiB
4Wrong answer0/33ms2444 KiB
5Wrong answer0/33ms2572 KiB
6Wrong answer0/33ms2804 KiB
7Accepted3/33ms3020 KiB
8Wrong answer0/43ms3068 KiB
9Wrong answer0/43ms3160 KiB
10Wrong answer0/54ms3296 KiB
11Accepted5/598ms3724 KiB
12Accepted5/550ms3908 KiB
13Time limit exceeded0/7250ms3064 KiB
14Time limit exceeded0/7250ms4068 KiB
15Time limit exceeded0/7206ms4056 KiB
16Time limit exceeded0/8266ms3344 KiB
17Time limit exceeded0/8277ms3456 KiB