206342026-01-08 11:57:47badamSíkság (55)cpp17Wrong answer 15/55300ms724 KiB
#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n;
    cin >> n;
    int t[n];
    for(int i=0;i<n;i++) cin>>t[i];
    int maxi1=1, maxi2=1;
    int s=0,m;
    for(int i=0;i<n-1;i++)
    {int j=i+1;
     while(t[i]==t[j]) j++;
      s=j+1;
     while((t[s]==t[i] or t[s]==t[j]) and s<=n-1)
     {
         maxi1++;
         s++;
     }
     maxi1=maxi1+j-i;
     if(maxi1>maxi2) maxi2=maxi1, m=i+1;
     maxi1=1;
    }
cout << maxi2 << " " <<m;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base15/55
1Accepted0/01ms316 KiB
2Accepted0/017ms316 KiB
3Wrong answer0/21ms316 KiB
4Accepted2/21ms316 KiB
5Wrong answer0/21ms316 KiB
6Accepted2/21ms508 KiB
7Accepted3/31ms528 KiB
8Accepted2/21ms316 KiB
9Wrong answer0/32ms316 KiB
10Accepted3/313ms440 KiB
11Accepted3/33ms316 KiB
12Time limit exceeded0/3209ms432 KiB
13Wrong answer0/334ms716 KiB
14Time limit exceeded0/3300ms564 KiB
15Time limit exceeded0/3300ms712 KiB
16Time limit exceeded0/3282ms564 KiB
17Time limit exceeded0/3291ms564 KiB
18Wrong answer0/3172ms564 KiB
19Time limit exceeded0/3300ms564 KiB
20Time limit exceeded0/3300ms688 KiB
21Time limit exceeded0/3284ms580 KiB
22Time limit exceeded0/3300ms724 KiB