43812023-03-27 11:38:40ZsofiaKeresztelyLádapakolás raktárban (50)cpp14Wrong answer 32/5046ms4304 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 || 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/03ms1876 KiB
2Wrong answer0/04ms2120 KiB
3Accepted2/23ms2332 KiB
4Wrong answer0/23ms2544 KiB
5Accepted2/23ms2740 KiB
6Accepted2/23ms2948 KiB
7Accepted2/22ms3060 KiB
8Accepted2/23ms3032 KiB
9Accepted3/33ms3032 KiB
10Accepted2/23ms3252 KiB
11Accepted2/23ms3216 KiB
12Wrong answer0/23ms3464 KiB
13Accepted3/34ms3672 KiB
14Wrong answer0/34ms3792 KiB
15Accepted3/36ms3904 KiB
16Wrong answer0/228ms3896 KiB
17Accepted3/337ms3876 KiB
18Accepted3/346ms4104 KiB
19Accepted3/328ms4088 KiB
20Wrong answer0/329ms4092 KiB
21Wrong answer0/330ms4216 KiB
22Wrong answer0/332ms4304 KiB