43862023-03-27 11:52:26ZsofiaKeresztelyLádapakolás raktárban (50)cpp14Wrong answer 30/5046ms4020 KiB
#include <bits/stdc++.h>
using namespace std;

int main()
{
    int 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  || !up && a > b){
            sum = a;
            up = true;
            piles++;
        }
        else{
            sum += a;
            if (a < b) up = false;
        }
        b = a;
    }
    cout << n - piles;
}
SubtaskSumTestVerdictTimeMemory
base30/50
1Accepted0/03ms1744 KiB
2Wrong answer0/04ms1912 KiB
3Accepted2/23ms2120 KiB
4Wrong answer0/23ms2340 KiB
5Accepted2/22ms2544 KiB
6Accepted2/23ms2768 KiB
7Accepted2/23ms2972 KiB
8Accepted2/22ms3052 KiB
9Accepted3/32ms3052 KiB
10Accepted2/23ms3184 KiB
11Wrong answer0/23ms3296 KiB
12Wrong answer0/23ms3428 KiB
13Accepted3/34ms3648 KiB
14Wrong answer0/34ms3676 KiB
15Accepted3/36ms3688 KiB
16Wrong answer0/228ms3812 KiB
17Accepted3/337ms3812 KiB
18Accepted3/346ms3816 KiB
19Accepted3/328ms3968 KiB
20Wrong answer0/330ms3904 KiB
21Wrong answer0/328ms4020 KiB
22Wrong answer0/332ms4020 KiB