56392023-08-31 16:52:01TomaSajtÉrdekes túra (70 pont)cpp17Accepted 70/7032ms8416 KiB
#include <bits/stdc++.h>
using namespace std;

int main() {
  int n;
  cin >> n;

  vector<int> h(n);
  for (int& hi : h) cin >> hi;

  int len = 1, best_len = 1, cnt = 0;
  for (int i = 1; i < n; i++) {
    if (h[i - 1] == h[i]) {
      len = 1;
      continue;
    }
    if (len == 1) cnt++;
    len++;
    best_len = max(best_len, len);
  }

  cout << cnt << '\n';
  cout << (cnt == 0 ? -1 : best_len);
}
SubtaskSumTestVerdictTimeMemory
base70/70
1Accepted0/03ms1808 KiB
2Accepted0/027ms3224 KiB
3Accepted3/33ms2868 KiB
4Accepted3/32ms3052 KiB
5Accepted3/32ms3180 KiB
6Accepted3/32ms3156 KiB
7Accepted3/33ms3436 KiB
8Accepted3/33ms3512 KiB
9Accepted3/33ms3732 KiB
10Accepted3/33ms3820 KiB
11Accepted3/33ms4196 KiB
12Accepted3/33ms4300 KiB
13Accepted4/43ms4220 KiB
14Accepted4/417ms5000 KiB
15Accepted4/419ms5340 KiB
16Accepted4/419ms5792 KiB
17Accepted4/420ms6160 KiB
18Accepted4/421ms6620 KiB
19Accepted4/428ms7400 KiB
20Accepted4/427ms7916 KiB
21Accepted4/432ms8404 KiB
22Accepted4/424ms8416 KiB