19132022-12-09 23:28:42kdbSíkság (55)cpp11Wrong answer 29/5512ms4604 KiB
#include <iostream>
#include <vector>
using namespace std;
int main()
{
    cin.tie(nullptr);
    cout.tie(nullptr);
    ios_base::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<int>vec(n);
    for (size_t i = 0; i < n; i++) cin >> vec[i];

    int p = -1, c = vec[0], pc = 0, cc = 1, l = -1, m = 0;
    for (size_t i = 0; i < n; i++)
    {
        if (vec[i] == c) cc++;
        else if(p == vec[i])
        {
            pc += cc;
            p = c;
            c = vec[i];
            cc = 1;
        }
        else
        {
            if (l < cc + pc)
            {
                l = cc + pc;
                m = i;
            }
            pc = cc;
            p = c;
            c = vec[i];
            cc = 1;
        }
    }
    cout << l << " " << m - l + 1 << endl;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base29/55
1Accepted0/03ms1828 KiB
2Accepted0/03ms2196 KiB
3Wrong answer0/22ms2336 KiB
4Wrong answer0/22ms2540 KiB
5Wrong answer0/22ms2892 KiB
6Wrong answer0/22ms2768 KiB
7Accepted3/32ms2928 KiB
8Accepted2/22ms2956 KiB
9Wrong answer0/32ms3180 KiB
10Accepted3/33ms3180 KiB
11Accepted3/33ms3180 KiB
12Wrong answer0/33ms3432 KiB
13Wrong answer0/312ms4148 KiB
14Accepted3/38ms4268 KiB
15Accepted3/310ms4604 KiB
16Accepted3/312ms4564 KiB
17Wrong answer0/312ms4436 KiB
18Wrong answer0/312ms4324 KiB
19Accepted3/312ms4328 KiB
20Accepted3/312ms4472 KiB
21Accepted3/37ms4064 KiB
22Wrong answer0/39ms4128 KiB