42862023-03-22 10:31:49gkataLeggyorsabb pénzkeresés (50)cpp17Wrong answer 8/50189ms7028 KiB
#include <iostream>
#include <queue>
#define ll long long

using namespace std;

//ifstream cin("penz.in");
//ofstream cout("penz.out");

vector <ll>x;
ll a,h,i,n,p,s;
bool ok=false;

int main()
{
    cin>>n>>p;
    for(i=0;i<n;++i)
    {
        cin>>a;
        s+=a;
        x.push_back(s);
    }
    //for(auto &e:x) cout<<e<<" ";

    for(h=1;h<=n;++h)
     {
        for(a=0;a<=n-h;++a)
        {
            if(x[a+h-1]-x[a-1]==p)
            {
                ok=true;
                break;
            }
        }
        if(ok) break;
     }

     cout<<h;

    return 0;
}
SubtaskSumTestVerdictTimeMemory
base8/50
1Accepted0/03ms1872 KiB
2Wrong answer0/0181ms4152 KiB
3Wrong answer0/23ms2284 KiB
4Accepted2/23ms2488 KiB
5Wrong answer0/23ms2704 KiB
6Wrong answer0/248ms3368 KiB
7Wrong answer0/214ms3656 KiB
8Wrong answer0/219ms3764 KiB
9Wrong answer0/27ms3976 KiB
10Wrong answer0/248ms4188 KiB
11Accepted2/230ms6076 KiB
12Wrong answer0/2189ms6280 KiB
13Wrong answer0/2135ms6356 KiB
14Wrong answer0/257ms6268 KiB
15Wrong answer0/2136ms6264 KiB
16Wrong answer0/256ms6268 KiB
17Wrong answer0/252ms6188 KiB
18Wrong answer0/271ms6256 KiB
19Wrong answer0/2165ms6388 KiB
20Wrong answer0/2114ms6468 KiB
21Wrong answer0/276ms6548 KiB
22Wrong answer0/2101ms6644 KiB
23Wrong answer0/2185ms6608 KiB
24Accepted2/296ms6860 KiB
25Accepted2/2116ms6944 KiB
26Wrong answer0/275ms6900 KiB
27Wrong answer0/272ms7028 KiB