221622026-01-14 17:32:45szabelrLádapakolás raktárban (50)cpp17Wrong answer 8/5014ms552 KiB
#include <iostream>
#include <vector>

using namespace std;

int main() {
    // Gyorsítás az időlimit miatt
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int N;
    long long M;
    if (!(cin >> N >> M)) return 0;

    long long aktualis_osszeg = 0;
    int felszabaditott_hely = 0;

    for (int i = 0; i < N; ++i) {
        long long h;
        cin >> h;

        if (aktualis_osszeg + h <= M) {
            // Ha hozzá tudjuk adni az aktuális toronyhoz
            if (aktualis_osszeg > 0) {
                felszabaditott_hely++;
            }
            aktualis_osszeg += h;
        } else {
            // Új tornyot kell kezdenünk a földön
            aktualis_osszeg = h;
        }
    }

    cout << felszabaditott_hely << endl;

    return 0;
}
SubtaskSumTestVerdictTimeMemory
base8/50
1Wrong answer0/01ms316 KiB
2Wrong answer0/02ms316 KiB
3Accepted2/21ms508 KiB
4Wrong answer0/21ms316 KiB
5Accepted2/21ms552 KiB
6Accepted2/21ms316 KiB
7Accepted2/21ms508 KiB
8Wrong answer0/21ms316 KiB
9Wrong answer0/31ms316 KiB
10Wrong answer0/22ms316 KiB
11Wrong answer0/21ms316 KiB
12Wrong answer0/22ms316 KiB
13Wrong answer0/32ms316 KiB
14Wrong answer0/32ms316 KiB
15Wrong answer0/32ms316 KiB
16Wrong answer0/210ms420 KiB
17Wrong answer0/313ms316 KiB
18Wrong answer0/314ms500 KiB
19Wrong answer0/39ms316 KiB
20Wrong answer0/39ms316 KiB
21Wrong answer0/39ms428 KiB
22Wrong answer0/310ms424 KiB