236062026-01-26 09:55:53szentedLeggyorsabb pénzkeresés (50)cpp17Wrong answer 2/50300ms1592 KiB
#include <iostream>

using namespace std;

int main()
{
    int n;
    int p;
    int a[100000];
    cin >> n;
    cin >> p;
    for(int i=0; i<n; i++){
        cin >> a[i];
    }

    int s=0;
    int mini_napok=n;
    int j=0;
    int napok=0;

    for(int i=0; i<n; i++){
        napok=0;
        j=i;
        s=0;
        while(s<p && j<n){
            s=s+a[j];
            j++;
        }
        napok=j-i;
        cout << napok << " ";
        if(napok<mini_napok && s>=p) mini_napok=napok;
    }
    cout <<endl<< mini_napok;

    return 0;
}
SubtaskSumTestVerdictTimeMemory
base2/50
1Wrong answer0/01ms316 KiB
2Time limit exceeded0/0282ms1088 KiB
3Wrong answer0/21ms508 KiB
4Wrong answer0/21ms316 KiB
5Accepted2/21ms508 KiB
6Wrong answer0/29ms448 KiB
7Wrong answer0/228ms472 KiB
8Wrong answer0/237ms316 KiB
9Wrong answer0/29ms524 KiB
10Wrong answer0/232ms488 KiB
11Wrong answer0/239ms740 KiB
12Time limit exceeded0/2298ms1060 KiB
13Time limit exceeded0/2291ms1172 KiB
14Wrong answer0/2108ms1076 KiB
15Time limit exceeded0/2280ms1588 KiB
16Wrong answer0/2104ms1080 KiB
17Wrong answer0/293ms1076 KiB
18Wrong answer0/2137ms1080 KiB
19Time limit exceeded0/2300ms1076 KiB
20Time limit exceeded0/2238ms1076 KiB
21Wrong answer0/2150ms1076 KiB
22Time limit exceeded0/2204ms1592 KiB
23Time limit exceeded0/2282ms1076 KiB
24Wrong answer0/2197ms1084 KiB
25Time limit exceeded0/2252ms1076 KiB
26Wrong answer0/2145ms1076 KiB
27Wrong answer0/2143ms1068 KiB