57942023-10-01 13:50:21xxxÉrdekes túra (70 pont)cpp14Runtime error 32/706ms4596 KiB
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0;i<n;i++)

int main() {
	int n;
	cin >> n;
	int m[10002] = {0};
	rep(i, n) {
		cin >> m[i];
	}

	int ans = 0, ans2 = 0;
	bool vane = false;
	int vanecnt = 1;
	for(int i = 1; i < n; i++) {
		if (m[i-1] != m[i]) {
			vane = true;
			vanecnt++;
		} else if (vane) {
			vane = false;
			ans2 = max(ans2, vanecnt);
			ans++;
			vanecnt = 1;
		}
	}
	if (vane) {
			vane = false;
			ans2 = max(ans2, vanecnt);
			ans++;
			vanecnt = 1;
		}
	cout << ans << "\n" << ans2 << "\n";

	return 0;
}

SubtaskSumTestVerdictTimeMemory
base32/70
1Accepted0/03ms1908 KiB
2Runtime error0/04ms2204 KiB
3Accepted3/32ms2312 KiB
4Partially correct1/33ms2656 KiB
5Accepted3/33ms2624 KiB
6Accepted3/32ms2968 KiB
7Accepted3/32ms2924 KiB
8Accepted3/33ms3260 KiB
9Accepted3/33ms3208 KiB
10Accepted3/33ms3296 KiB
11Accepted3/33ms3296 KiB
12Accepted3/33ms3472 KiB
13Accepted4/44ms3812 KiB
14Runtime error0/46ms3736 KiB
15Runtime error0/46ms3980 KiB
16Runtime error0/44ms4100 KiB
17Runtime error0/46ms4008 KiB
18Runtime error0/46ms4236 KiB
19Runtime error0/46ms4448 KiB
20Runtime error0/46ms4580 KiB
21Runtime error0/46ms4440 KiB
22Runtime error0/46ms4596 KiB