66512023-12-15 11:55:35tamasmarkLogisztikai központcpp17Wrong answer 0/5016ms12648 KiB
#include <iostream>
#include <vector>

using namespace std;

int n, i, mini, p, j, sum, db, a;
vector<long long>x;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> n >> p;
    x.resize(n + 1);
    for (i = 1; i <= n; ++i)
    {
        cin >> x[i];
    }
    i = 1;
    mini = 99999;
    while (i <= n)
    {
        if (sum == 0) a = i;
        sum += x[i];
        db++;
        if (sum >= p)
        {
            if (db < mini) mini = db;
            db = 0;
            sum = 0;
            i = a + 1;
        }
        else i++;
    }
    cout << mini;
    return 0;
}
/*
8 11
3 6 4 2 3 7 2 9

*/
SubtaskSumTestVerdictTimeMemory
base0/50
1Wrong answer0/03ms1892 KiB
2Wrong answer0/014ms4224 KiB
3Wrong answer0/43ms3100 KiB
4Wrong answer0/43ms3316 KiB
5Wrong answer0/43ms3648 KiB
6Wrong answer0/43ms3596 KiB
7Wrong answer0/43ms3732 KiB
8Wrong answer0/53ms3824 KiB
9Wrong answer0/216ms6268 KiB
10Wrong answer0/214ms7248 KiB
11Wrong answer0/23ms5876 KiB
12Wrong answer0/23ms6148 KiB
13Wrong answer0/23ms6420 KiB
14Wrong answer0/24ms6888 KiB
15Wrong answer0/214ms8724 KiB
16Wrong answer0/214ms9348 KiB
17Wrong answer0/214ms10160 KiB
18Wrong answer0/212ms10328 KiB
19Wrong answer0/216ms12012 KiB
20Wrong answer0/313ms12648 KiB