85822024-01-22 12:37:23xxxÉrdekes túra (70 pont)cpp17Wrong answer 35/7013ms4764 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++) {
		hossz++;
		if (v[i] == v[i-1]) {
			if (i > 2 && v[i] != v[i-2]) {
				cnt++;
				hosszmax = max(hosszmax, hossz);
				hossz = 1;
			}
		}
	}

	cout << cnt << '\n' << hosszmax-1 << '\n';
}
SubtaskSumTestVerdictTimeMemory
base35/70
1Accepted0/03ms1824 KiB
2Wrong answer0/012ms3528 KiB
3Wrong answer0/33ms2244 KiB
4Partially correct1/33ms2440 KiB
5Partially correct1/33ms2552 KiB
6Partially correct1/32ms2624 KiB
7Partially correct1/33ms2624 KiB
8Accepted3/33ms2628 KiB
9Partially correct2/33ms3008 KiB
10Partially correct2/33ms2828 KiB
11Partially correct2/33ms2972 KiB
12Partially correct2/33ms2888 KiB
13Partially correct2/43ms3048 KiB
14Partially correct2/48ms4020 KiB
15Partially correct2/48ms3984 KiB
16Partially correct2/48ms3968 KiB
17Partially correct2/48ms4136 KiB
18Partially correct2/49ms4488 KiB
19Partially correct2/412ms4492 KiB
20Partially correct2/412ms4620 KiB
21Partially correct2/413ms4764 KiB
22Partially correct2/410ms4640 KiB