85832024-01-22 12:45:19xxxÉrdekes túra (70 pont)cpp17Accepted 70/7012ms4836 KiB
#include <bits/stdc++.h>
using namespace std;
#define int long long


signed main() {
	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

	int n;
	cin >> n;
	vector<int> v(n+1);
	for(int i = 1; i <= n; i++) {
		cin >> v[i];
	}

	int cnt = 0, hossz = 1, hosszmax = -1;

	for(int i = 2; i <= n; i++) {
		
		if (v[i] == v[i-1]) {
			if (hossz > 1) {cnt++;}
			hossz = 1;
		} else {
			hossz++;
			hosszmax = max(hosszmax, hossz);
		}
	}

	if(hossz > 1) cnt++;
	cout << cnt << '\n';
	if(cnt) 
	cout << hosszmax << '\n';
	else
	cout << -1 << '\n';
}
SubtaskSumTestVerdictTimeMemory
base70/70
1Accepted0/03ms1828 KiB
2Accepted0/012ms3524 KiB
3Accepted3/33ms2264 KiB
4Accepted3/33ms2444 KiB
5Accepted3/33ms2676 KiB
6Accepted3/32ms2748 KiB
7Accepted3/32ms2752 KiB
8Accepted3/33ms2756 KiB
9Accepted3/33ms2988 KiB
10Accepted3/33ms3068 KiB
11Accepted3/33ms3072 KiB
12Accepted3/33ms3156 KiB
13Accepted4/43ms3500 KiB
14Accepted4/48ms4284 KiB
15Accepted4/48ms4240 KiB
16Accepted4/48ms4296 KiB
17Accepted4/48ms4292 KiB
18Accepted4/49ms4836 KiB
19Accepted4/412ms4800 KiB
20Accepted4/412ms4836 KiB
21Accepted4/412ms4816 KiB
22Accepted4/410ms4684 KiB