70252023-12-27 17:06:33horvathabelDNScpp11Wrong answer 18/4013ms4236 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){
                charnow=0;
                mustother=0;
            }
            if (i+1-mustother<(2*charnow)){
                ans=max(i+1,ans);
            }
            else{
                ans=max(ans, 2*charnow);
            }
        }

    }
    cout<<ans;
}
SubtaskSumTestVerdictTimeMemory
base18/40
1Accepted0/03ms2088 KiB
2Wrong answer0/013ms2768 KiB
3Wrong answer0/23ms2388 KiB
4Accepted2/23ms2420 KiB
5Wrong answer0/23ms2484 KiB
6Accepted2/23ms2492 KiB
7Wrong answer0/23ms2684 KiB
8Wrong answer0/44ms2908 KiB
9Wrong answer0/46ms3180 KiB
10Wrong answer0/47ms3292 KiB
11Wrong answer0/48ms3824 KiB
12Accepted4/48ms4116 KiB
13Accepted5/59ms4212 KiB
14Accepted5/59ms4236 KiB