248062026-02-15 18:35:02sarminÉrdekes túra (70 pont)cpp17Wrong answer 66/7010ms820 KiB
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
// const ll MOD = 1e9+7;

#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int n; cin >> n;
    vector<int> a(n);
    int db = 0, mx = 0, st = 0;
    bool van = 0;
    for (int i = 0; i < n; i++) {
    	cin >> a[i];
    	if (a[i] != a[i-1]) van = true;
    	if (a[i] == a[i-1]) {
    		mx = max(mx, i-st);
    		if (i-st != 1) db++;
    		st = i;
    	}
    }
    mx = max(mx, n-st);
    if (n-st != 0) db++;
    
    if (!van || mx == 1) {
    	cout << "0\n-1" << "\n";
    } else {
    	cout << db << "\n" << mx << "\n";
    }
	

    return 0;
}
SubtaskSumTestVerdictTimeMemory
base66/70
1Wrong answer0/01ms500 KiB
2Accepted0/09ms820 KiB
3Accepted3/31ms316 KiB
4Accepted3/31ms316 KiB
5Partially correct2/31ms316 KiB
6Partially correct2/31ms536 KiB
7Partially correct2/31ms508 KiB
8Partially correct2/31ms316 KiB
9Accepted3/31ms316 KiB
10Accepted3/31ms316 KiB
11Accepted3/31ms316 KiB
12Accepted3/31ms316 KiB
13Accepted4/41ms316 KiB
14Accepted4/46ms580 KiB
15Accepted4/47ms756 KiB
16Accepted4/47ms564 KiB
17Accepted4/47ms564 KiB
18Accepted4/48ms564 KiB
19Accepted4/49ms564 KiB
20Accepted4/49ms820 KiB
21Accepted4/410ms820 KiB
22Accepted4/48ms708 KiB