8612022-01-21 12:05:46zsebiLeggyorsabb pénzkeresés (50)cpp11Time limit exceeded 16/50298ms4008 KiB
#include <iostream>
#include <vector>
#include <climits>


#define ll long long

using namespace std;
ll i,p,n,j,db,s,mini;
vector <ll> x;
int main()
{
    cin>>n>>p;
    x.resize(n+1);
    for(i=1;i<=n;++i)
    {
        cin>>x[i];
    }

    mini=INT_MAX;
    i=1;
    while(i<=n)
    {
        db=1;
        s=x[i];
        if(s>=p)
        {
            mini=1;
            break;
        }
        else
        for(j=i+1;j<=n;++j)
        {
            s+=x[j];
            db++;
            if(s>=p && db<mini)
            {
               mini=db;
               break;

            }
        }
        ++i;
    }
    cout<<mini;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base16/50
1Accepted0/02ms1804 KiB
2Time limit exceeded0/0296ms2136 KiB
3Accepted2/21ms2372 KiB
4Accepted2/21ms2384 KiB
5Accepted2/21ms2388 KiB
6Accepted2/282ms2468 KiB
7Accepted2/276ms2636 KiB
8Accepted2/283ms2696 KiB
9Accepted2/281ms2744 KiB
10Accepted2/279ms2796 KiB
11Time limit exceeded0/2296ms2824 KiB
12Time limit exceeded0/2296ms3288 KiB
13Time limit exceeded0/2296ms3832 KiB
14Time limit exceeded0/2298ms3876 KiB
15Time limit exceeded0/2298ms3812 KiB
16Time limit exceeded0/2298ms4008 KiB
17Time limit exceeded0/2266ms3816 KiB
18Time limit exceeded0/2296ms3880 KiB
19Time limit exceeded0/2202ms3876 KiB
20Time limit exceeded0/2238ms3816 KiB
21Time limit exceeded0/2252ms3876 KiB
22Time limit exceeded0/2252ms3944 KiB
23Time limit exceeded0/2202ms3816 KiB
24Time limit exceeded0/2252ms4004 KiB
25Time limit exceeded0/2209ms3876 KiB
26Time limit exceeded0/2208ms3880 KiB
27Time limit exceeded0/2250ms3876 KiB