43872023-03-27 12:10:47ZsofiaKeresztelyLádapakolás raktárban (50)cpp14Wrong answer 32/5046ms4092 KiB
#include <bits/stdc++.h>
using namespace std;

int main()
{
    long long n, m, piles = 1, sum=0, a, b = 0;
    bool up = true;
    cin >> n >> m;
    for (int i=0; i<n; i++){
        cin >> a;
        if (sum + a > m || a == b || !up && a > b){
            sum = a;
            up = true;
            piles++;
        }
        else{
            sum += a;
            if (a < b) up = false;
        }
        b = a;
    }
    cout << n - piles;
}
SubtaskSumTestVerdictTimeMemory
base32/50
1Accepted0/03ms1880 KiB
2Wrong answer0/04ms2116 KiB
3Accepted2/22ms2200 KiB
4Wrong answer0/23ms2448 KiB
5Accepted2/23ms2656 KiB
6Accepted2/23ms2692 KiB
7Accepted2/22ms2692 KiB
8Accepted2/22ms2576 KiB
9Accepted3/32ms2576 KiB
10Accepted2/23ms2704 KiB
11Accepted2/22ms2788 KiB
12Wrong answer0/23ms2916 KiB
13Accepted3/34ms3000 KiB
14Wrong answer0/34ms3124 KiB
15Accepted3/36ms3376 KiB
16Wrong answer0/227ms3420 KiB
17Accepted3/337ms3548 KiB
18Accepted3/346ms3672 KiB
19Accepted3/329ms3788 KiB
20Wrong answer0/330ms3764 KiB
21Wrong answer0/328ms4004 KiB
22Wrong answer0/332ms4092 KiB