70272023-12-27 17:21:56horvathabelDNScpp11Wrong answer 14/4010ms4416 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--;
            }
            if (i+1<=2*charnow){
                ans=max(i+1,ans);
            }
            else{
                ans=max(ans, 2*charnow);
            }
        }

    }
    cout<<ans;
}
SubtaskSumTestVerdictTimeMemory
base14/40
1Wrong answer0/03ms1812 KiB
2Wrong answer0/010ms2920 KiB
3Wrong answer0/23ms2344 KiB
4Wrong answer0/23ms2412 KiB
5Wrong answer0/23ms2448 KiB
6Wrong answer0/23ms2692 KiB
7Wrong answer0/23ms2908 KiB
8Wrong answer0/44ms3096 KiB
9Wrong answer0/46ms3500 KiB
10Wrong answer0/46ms3672 KiB
11Wrong answer0/47ms4208 KiB
12Accepted4/47ms4416 KiB
13Accepted5/58ms4388 KiB
14Accepted5/58ms4388 KiB