91092024-02-14 11:04:09BencuLeggyorsabb pénzkeresés (50)cpp17Time limit exceeded 10/50300ms4816 KiB
#include <iostream>
//#include <fstream>

using namespace std;
//ifstream f("bohoc.in");
int n,a[100000],s;
long long p;

int main()
{
    cin>>n>>p;
    for (int i=1; i<=n; i++) cin>>a[i];
    for (int i=1; i<=n; i++) {
            for (int j=1; j<=n-i+1; j++) {
                int ma=0;
                for (int k=j; k<j+i; k++) ma=ma+a[k];
                if (ma>=p) {
                    s=i;
                    break;
                }
            }
            if (s!=0) break;
    }
    cout<<s;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base10/50
1Accepted0/03ms1748 KiB
2Time limit exceeded0/0300ms1592 KiB
3Accepted2/23ms2156 KiB
4Accepted2/23ms2372 KiB
5Accepted2/23ms2448 KiB
6Time limit exceeded0/2203ms2744 KiB
7Time limit exceeded0/2273ms2668 KiB
8Time limit exceeded0/2261ms2928 KiB
9Accepted2/2173ms3164 KiB
10Time limit exceeded0/2252ms2324 KiB
11Accepted2/229ms4072 KiB
12Wrong answer0/282ms4044 KiB
13Time limit exceeded0/2254ms2996 KiB
14Time limit exceeded0/2268ms3096 KiB
15Time limit exceeded0/2237ms3128 KiB
16Wrong answer0/2141ms4408 KiB
17Wrong answer0/2137ms4400 KiB
18Wrong answer0/297ms4404 KiB
19Time limit exceeded0/2256ms3364 KiB
20Time limit exceeded0/2277ms3524 KiB
21Time limit exceeded0/2268ms3436 KiB
22Time limit exceeded0/2268ms3568 KiB
23Wrong answer0/276ms4816 KiB
24Time limit exceeded0/2266ms4752 KiB
25Time limit exceeded0/2280ms3512 KiB
26Time limit exceeded0/2261ms3500 KiB
27Time limit exceeded0/2261ms3572 KiB