103862024-04-01 18:25:21MagyarKendeSZLGDNS szakaszok száma (75 pont)cpp17Accepted 75/756ms4276 KiB
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main() {
	cin.tie(0), ios::sync_with_stdio(0);
    
    int N;
    cin >> N;

    ll result = 0;
    int before_g = 0, after_g = 0;

    while (N--) {
        char C;
        cin >> C;

        if (C == 'C') continue;
        if (C == 'A') before_g++;
        else if (C == 'G') {
            after_g += before_g;
            before_g = 0;
        }
        else {
            result += after_g;
        }
    }

    cout << result;
}
SubtaskSumTestVerdictTimeMemory
base75/75
1Accepted0/03ms1928 KiB
2Accepted0/06ms2084 KiB
3Accepted3/33ms2192 KiB
4Accepted4/42ms2272 KiB
5Accepted4/43ms2396 KiB
6Accepted4/43ms2756 KiB
7Accepted4/43ms2728 KiB
8Accepted3/33ms2836 KiB
9Accepted3/33ms3052 KiB
10Accepted4/43ms3156 KiB
11Accepted4/43ms3100 KiB
12Accepted4/43ms3216 KiB
13Accepted4/43ms3328 KiB
14Accepted4/43ms3412 KiB
15Accepted3/34ms3568 KiB
16Accepted4/44ms3540 KiB
17Accepted4/44ms3772 KiB
18Accepted4/44ms3864 KiB
19Accepted4/44ms3836 KiB
20Accepted4/44ms4064 KiB
21Accepted3/34ms4196 KiB
22Accepted4/44ms4276 KiB