145002025-01-12 20:13:52sarminÉrdekes túra (70 pont)cpp17Partially correct 66/7010ms1156 KiB
// Created by Armin on 1/12/2025.

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pp = pair<int, int>;

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    
    int n; cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
      cin >> a[i];
    }

    int hany = 0, leghosszabb = 0, curr_hossz = 0;
    for (int i = 1; i < n; i++) {
      if (a[i] != a[i - 1]) {
        curr_hossz++;
        if (i == 1) curr_hossz++;
      } else if (curr_hossz >= 2) {
          hany++;
          leghosszabb = max(leghosszabb, curr_hossz);
          curr_hossz = 1;
      }
    }
    if (hany == 0) leghosszabb = -1;
    if (curr_hossz >= 2) {
    	hany++;
    	leghosszabb = max(leghosszabb, curr_hossz);
    }
    cout << hany << '\n' << leghosszabb << '\n';
    
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base66/70
1Accepted0/01ms500 KiB
2Accepted0/09ms1076 KiB
3Accepted3/31ms316 KiB
4Accepted3/31ms420 KiB
5Partially correct1/31ms500 KiB
6Partially correct1/31ms316 KiB
7Accepted3/31ms316 KiB
8Accepted3/31ms316 KiB
9Accepted3/31ms316 KiB
10Accepted3/31ms320 KiB
11Accepted3/31ms316 KiB
12Accepted3/31ms316 KiB
13Accepted4/41ms532 KiB
14Accepted4/46ms820 KiB
15Accepted4/47ms820 KiB
16Accepted4/47ms948 KiB
17Accepted4/47ms748 KiB
18Accepted4/48ms820 KiB
19Accepted4/49ms1156 KiB
20Accepted4/49ms1076 KiB
21Accepted4/410ms1088 KiB
22Accepted4/48ms1076 KiB