85792024-01-22 12:11:58IgnácÉrdekes túra (70 pont)cpp17Partially correct 68/7028ms7488 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" << maxh;
}
SubtaskSumTestVerdictTimeMemory
base68/70
1Accepted0/03ms1876 KiB
2Accepted0/026ms2508 KiB
3Accepted3/33ms2708 KiB
4Partially correct1/33ms2840 KiB
5Accepted3/33ms3052 KiB
6Accepted3/32ms3144 KiB
7Accepted3/32ms3148 KiB
8Accepted3/33ms3280 KiB
9Accepted3/33ms3492 KiB
10Accepted3/33ms3568 KiB
11Accepted3/33ms3548 KiB
12Accepted3/33ms3704 KiB
13Accepted4/43ms3812 KiB
14Accepted4/416ms4100 KiB
15Accepted4/418ms4608 KiB
16Accepted4/417ms4884 KiB
17Accepted4/419ms5384 KiB
18Accepted4/420ms5928 KiB
19Accepted4/427ms6328 KiB
20Accepted4/425ms6760 KiB
21Accepted4/428ms7140 KiB
22Accepted4/423ms7488 KiB