70242023-12-27 17:04:27horvathabelDNScpp11Wrong answer 20/4013ms3972 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<(2*charnow)-mustother){
                ans=max(i,ans);
            }
            else{
                ans=max(ans, 2*charnow);
            }
        }

    }
    cout<<ans;
}
SubtaskSumTestVerdictTimeMemory
base20/40
1Accepted0/03ms1944 KiB
2Wrong answer0/013ms2820 KiB
3Wrong answer0/23ms2200 KiB
4Accepted2/23ms2548 KiB
5Wrong answer0/23ms2488 KiB
6Wrong answer0/23ms2552 KiB
7Wrong answer0/23ms2556 KiB
8Wrong answer0/44ms3028 KiB
9Wrong answer0/46ms3180 KiB
10Wrong answer0/47ms3044 KiB
11Accepted4/48ms3364 KiB
12Accepted4/48ms3632 KiB
13Accepted5/59ms3888 KiB
14Accepted5/510ms3972 KiB