8602022-01-21 11:54:48zsebiLeggyorsabb pénzkeresés (50)cpp11Time limit exceeded 16/50298ms10720 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=0;
        s=0;
        for(j=i;j<=n;++j)
        {
            s+=x[j];
            db++;
            if(s>=p && db<mini)
            {
               mini=db;
               break;

            }
        }
        ++i;
    }
    cout<<mini;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base16/50
1Accepted0/02ms1800 KiB
2Time limit exceeded0/0296ms2224 KiB
3Accepted2/21ms2392 KiB
4Accepted2/21ms2396 KiB
5Accepted2/21ms2400 KiB
6Accepted2/279ms2612 KiB
7Accepted2/281ms2660 KiB
8Accepted2/279ms2584 KiB
9Accepted2/282ms2632 KiB
10Accepted2/279ms2800 KiB
11Time limit exceeded0/2298ms2820 KiB
12Time limit exceeded0/2298ms3296 KiB
13Time limit exceeded0/2296ms3904 KiB
14Time limit exceeded0/2298ms4392 KiB
15Time limit exceeded0/2298ms4936 KiB
16Time limit exceeded0/2294ms5352 KiB
17Time limit exceeded0/2268ms5832 KiB
18Time limit exceeded0/2289ms6376 KiB
19Time limit exceeded0/2293ms6808 KiB
20Time limit exceeded0/2275ms7300 KiB
21Time limit exceeded0/2298ms7704 KiB
22Time limit exceeded0/2296ms8252 KiB
23Time limit exceeded0/2298ms8800 KiB
24Time limit exceeded0/2296ms9088 KiB
25Time limit exceeded0/2247ms9636 KiB
26Time limit exceeded0/2298ms10112 KiB
27Time limit exceeded0/2296ms10720 KiB