8592022-01-21 11:48:49zsebiA sárkány feladványa (50)cpp11Wrong answer 0/50298ms1984 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
base0/50
1Wrong answer0/02ms1804 KiB
2Time limit exceeded0/0293ms1444 KiB
3Wrong answer0/31ms1904 KiB
4Wrong answer0/31ms1808 KiB
5Wrong answer0/31ms1916 KiB
6Wrong answer0/31ms1920 KiB
7Wrong answer0/31ms1924 KiB
8Time limit exceeded0/3294ms1208 KiB
9Time limit exceeded0/3293ms1464 KiB
10Time limit exceeded0/3298ms1668 KiB
11Time limit exceeded0/3254ms1288 KiB
12Wrong answer0/31ms1948 KiB
13Time limit exceeded0/4298ms1488 KiB
14Wrong answer0/44ms1976 KiB
15Time limit exceeded0/4298ms1304 KiB
16Time limit exceeded0/4298ms1440 KiB
17Wrong answer0/42ms1984 KiB