51002023-04-16 22:20:42tomi7Érdekes túra (70 pont)cpp11Wrong answer 43/7029ms5104 KiB
// Source: https://usaco.guide/general/io

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

long long lko(long long n, long long m){
	if(n%m==0 || m%n==0){
		return min(n, m);
	}
	if(n>m){
		return lko(n%m, m);
	}else{
		return lko(m%n, n);
	}
}

int main() {
	int n;
	cin>>n;
	vector<int> a(n);
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	int valasz=1;
	int vvalasz=0;
	int szamolo=0;
	for(int i=1;i<n;i++){
		if(a[i]!=a[i-1]){
			valasz++;
		}else{
			if(valasz>1){
				vvalasz=max(valasz, vvalasz);
				szamolo++;
				valasz=1;
			}
		}
	}
	if(szamolo==0){
		cout<<0<<'\n'<<-1;
	}else{
		cout<<szamolo<<'\n'<<vvalasz<<'\n';
	}
}
SubtaskSumTestVerdictTimeMemory
base43/70
1Accepted0/03ms1812 KiB
2Wrong answer0/026ms2772 KiB
3Wrong answer0/33ms2288 KiB
4Accepted3/33ms2616 KiB
5Accepted3/33ms2648 KiB
6Accepted3/33ms2896 KiB
7Accepted3/33ms3004 KiB
8Accepted3/33ms3244 KiB
9Partially correct2/33ms3328 KiB
10Partially correct2/33ms3560 KiB
11Partially correct2/33ms3952 KiB
12Partially correct2/33ms3872 KiB
13Partially correct2/43ms3880 KiB
14Partially correct2/416ms4088 KiB
15Partially correct2/418ms4388 KiB
16Partially correct2/418ms4472 KiB
17Partially correct2/419ms4472 KiB
18Partially correct2/420ms4468 KiB
19Partially correct2/427ms4772 KiB
20Partially correct2/426ms5028 KiB
21Partially correct2/429ms5104 KiB
22Partially correct2/423ms4804 KiB