148702025-02-05 16:53:53PKBÉrdekes túra (70 pont)cpp17Wrong answer 0/7039ms1684 KiB
#include <iostream>
#include <vector>

using namespace std;

int main() {
    int hossz;

    cin >> hossz;

    vector<int> altitudes(hossz);



    for (int i = 0; i < hossz; i++) {
        cin >> altitudes[i];
    }

    int starting, ending;
    int jelenlegi = 0;

    vector<int> sor(2, -1);

    vector<vector<int>> izgalmas_turak(100, sor);

    int len = 0;
    int best_len = 0;



    for (int i = 1; i < hossz-1; i++) {
        if (altitudes[i] != altitudes[i+1]) {
            len++;
            if (len > best_len) {
                best_len = len;
            }
            if (izgalmas_turak[jelenlegi][0] == -1) {
               izgalmas_turak[jelenlegi][0] = i;
            } else {

                izgalmas_turak[jelenlegi][1] = i;
            }

            cout << len << "\n";
        } else {
            len = 0;
            jelenlegi++;

        }
    }

    int mennyi = 0;


    for (int i = 0; i < izgalmas_turak.size(); i++) {
        if (izgalmas_turak[i][0] != -1) {
            mennyi++;
        }
    }

    cout << "\n\n";



    if (mennyi == 0) {
        cout << "-1";
    } else {
        cout << mennyi << "\n";
    }

    cout << best_len+1;


}
SubtaskSumTestVerdictTimeMemory
base0/70
1Wrong answer0/01ms500 KiB
2Wrong answer0/035ms1588 KiB
3Wrong answer0/31ms316 KiB
4Wrong answer0/31ms316 KiB
5Wrong answer0/31ms316 KiB
6Wrong answer0/31ms508 KiB
7Wrong answer0/31ms316 KiB
8Wrong answer0/31ms316 KiB
9Wrong answer0/31ms316 KiB
10Wrong answer0/31ms316 KiB
11Wrong answer0/32ms388 KiB
12Wrong answer0/32ms508 KiB
13Wrong answer0/42ms316 KiB
14Wrong answer0/420ms844 KiB
15Wrong answer0/424ms1188 KiB
16Runtime error0/425ms1076 KiB
17Wrong answer0/426ms1076 KiB
18Wrong answer0/428ms1332 KiB
19Wrong answer0/437ms1432 KiB
20Runtime error0/435ms1588 KiB
21Wrong answer0/439ms1684 KiB
22Runtime error0/430ms1332 KiB