8132022-01-16 19:44:18dancsakdenesLeggyorsabb pénzkeresés (50)cpp11Time limit exceeded 42/50280ms11640 KiB
#include <iostream>

using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    int n;
    int p;
    cin>>n>>p;
    int f[n];
    int ossz=0;
    int hossz=0;
    int legrov=n;
    int j=0;
    for(int i=0; i<n; i++)
    {
        cin>>f[i];
    }
    for(int i=0; i<n; i++)
    {
        j=i;
        ossz=0;
        hossz=0;
        while(ossz<p && j<n)
        {
            ossz+=f[j];
            hossz++;
            j++;
        }
        if(hossz<legrov && j!=n)
        {
            legrov=hossz;
        }
    }
    int veghossz=legrov;
    cout<<veghossz;
    cout<<endl;
	return 0;
}
SubtaskSumTestVerdictTimeMemory
base42/50
1Accepted0/02ms1828 KiB
2Time limit exceeded0/0277ms3236 KiB
3Accepted2/21ms2432 KiB
4Accepted2/21ms2444 KiB
5Accepted2/21ms2448 KiB
6Accepted2/27ms2488 KiB
7Accepted2/218ms2532 KiB
8Accepted2/225ms2584 KiB
9Accepted2/24ms2632 KiB
10Accepted2/220ms2680 KiB
11Accepted2/216ms3856 KiB
12Time limit exceeded0/2280ms4448 KiB
13Accepted2/2188ms4924 KiB
14Accepted2/259ms5284 KiB
15Accepted2/2189ms5888 KiB
16Accepted2/256ms6360 KiB
17Accepted2/248ms6852 KiB
18Accepted2/282ms7324 KiB
19Time limit exceeded0/2237ms7804 KiB
20Accepted2/2163ms8280 KiB
21Accepted2/289ms8768 KiB
22Accepted2/2127ms9248 KiB
23Time limit exceeded0/2239ms8292 KiB
24Wrong answer0/2130ms10200 KiB
25Accepted2/2163ms10688 KiB
26Accepted2/282ms11160 KiB
27Accepted2/282ms11640 KiB