70282023-12-27 17:24:21horvathabelDNScpp11Wrong answer 8/4012ms4140 KiB
#include <bits/stdc++.h>
using namespace std;

int main()
{
    string a;
    cin>>a;
    int n=a.size();
    int ans=0;
    for (char most:{'A','C','T','G'}){
        int mustother=0;
        int charnow=0;
        for (int i=0; i<n;i++){
            if (a[i]==most) charnow++;
            else mustother++;
            if (mustother>charnow){
                if (charnow!=0) charnow--;
                mustother=charnow;
            }
            if (i+1<=2*charnow){
                ans=max(i+1,ans);
            }
            else{
                ans=max(ans, 2*charnow);
            }
        }

    }
    cout<<ans;
}
SubtaskSumTestVerdictTimeMemory
base8/40
1Accepted0/03ms1960 KiB
2Wrong answer0/012ms2812 KiB
3Wrong answer0/23ms2264 KiB
4Wrong answer0/23ms2392 KiB
5Accepted2/23ms2604 KiB
6Accepted2/23ms2856 KiB
7Wrong answer0/23ms2824 KiB
8Wrong answer0/44ms3048 KiB
9Wrong answer0/46ms3232 KiB
10Wrong answer0/46ms3336 KiB
11Accepted4/48ms3612 KiB
12Wrong answer0/48ms4004 KiB
13Wrong answer0/58ms3872 KiB
14Wrong answer0/58ms4140 KiB