85802024-01-22 12:13:43IgnácÉrdekes túra (70 pont)cpp17Accepted 70/7029ms3700 KiB
// Source: https://usaco.guide/general/io

#include <bits/stdc++.h>
using namespace std;

int main() {
	int n;
	cin >> n;
	int h = 1, maxh = 1, db = 0;
	int elozo;
	cin >> elozo;
	for (int i = 1; i < n; i++) {
		int a;
		cin >> a;
		if (a != elozo) {
			h++;
			if (h > maxh) maxh = h;
		} else {
			if (h > 1) db++;
			h = 1;
		}

		elozo = a;
	}

	if (h > 1) db++;
	cout << db << "\n";
	if (maxh == 1) cout << -1;
	else cout << maxh;
}
SubtaskSumTestVerdictTimeMemory
base70/70
1Accepted0/03ms2132 KiB
2Accepted0/025ms2192 KiB
3Accepted3/32ms2184 KiB
4Accepted3/33ms2440 KiB
5Accepted3/33ms2536 KiB
6Accepted3/33ms2768 KiB
7Accepted3/33ms2860 KiB
8Accepted3/33ms2992 KiB
9Accepted3/33ms3192 KiB
10Accepted3/33ms3304 KiB
11Accepted3/33ms3392 KiB
12Accepted3/33ms3616 KiB
13Accepted4/43ms3460 KiB
14Accepted4/416ms3460 KiB
15Accepted4/417ms3460 KiB
16Accepted4/417ms3464 KiB
17Accepted4/419ms3460 KiB
18Accepted4/420ms3588 KiB
19Accepted4/427ms3672 KiB
20Accepted4/425ms3672 KiB
21Accepted4/429ms3700 KiB
22Accepted4/423ms3700 KiB