8622022-01-21 12:11:39zsebiLeggyorsabb pénzkeresés (50)cpp11Wrong answer 2/50215ms5496 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.sync();
    cin>>n>>p;
    x.resize(n+1);
    for(i=1;i<=n;++i)
    {
        cin>>x[i];
    }

    mini=INT_MAX;
    i=1;
    while(i<=n)
    {

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

            if(s>=p)
            {
               mini=j-i+1;
               break;
            }
        }
        ++i;
    }
    cout<<mini;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base2/50
1Wrong answer0/02ms1804 KiB
2Time limit exceeded0/0209ms3744 KiB
3Wrong answer0/21ms2356 KiB
4Wrong answer0/21ms2352 KiB
5Wrong answer0/21ms2364 KiB
6Wrong answer0/26ms2444 KiB
7Wrong answer0/214ms2620 KiB
8Wrong answer0/219ms2660 KiB
9Wrong answer0/26ms2576 KiB
10Wrong answer0/217ms2620 KiB
11Wrong answer0/228ms4336 KiB
12Time limit exceeded0/2215ms4560 KiB
13Wrong answer0/2153ms4608 KiB
14Wrong answer0/259ms5084 KiB
15Wrong answer0/2150ms5496 KiB
16Wrong answer0/259ms5484 KiB
17Wrong answer0/252ms5492 KiB
18Wrong answer0/275ms5496 KiB
19Wrong answer0/2181ms5492 KiB
20Wrong answer0/2123ms5496 KiB
21Wrong answer0/285ms5488 KiB
22Wrong answer0/2109ms5492 KiB
23Time limit exceeded0/2202ms5484 KiB
24Accepted2/2104ms5484 KiB
25Wrong answer0/2131ms5484 KiB
26Wrong answer0/276ms5492 KiB
27Wrong answer0/275ms5492 KiB