129062025-01-03 11:40:22PKBDNS szakaszok száma (75 pont)cpp17Wrong answer 0/754ms608 KiB
#include <bits/stdc++.h>
using namespace std;

int main() {
    int dns_length;
    cin >> dns_length;

    string dns;
    cin >> dns;

    int count_A = 0;      // Count of 'A'
    int count_AG = 0;     // Count of 'AG'
    int found_dns = 0;    // Count of 'AGT'

    // Process the string in a single pass
    for (int i = 0; i < dns_length; i++) {
        if (dns[i] == 'T') {
            found_dns += count_AG; // Every 'AG' before this 'T' can form an 'AGT'
        } else if (dns[i] == 'G') {
            count_AG += count_A;  // Every 'A' before this 'G' can form an 'AG'
        } else if (dns[i] == 'A') {
            count_A++;            // Increment the count of 'A'
        }
    }

    cout << found_dns-1 << endl;

    return 0;
}
SubtaskSumTestVerdictTimeMemory
base0/75
1Accepted0/01ms508 KiB
2Wrong answer0/04ms568 KiB
3Wrong answer0/31ms320 KiB
4Wrong answer0/41ms508 KiB
5Wrong answer0/41ms320 KiB
6Wrong answer0/41ms320 KiB
7Wrong answer0/41ms320 KiB
8Wrong answer0/31ms320 KiB
9Wrong answer0/31ms320 KiB
10Wrong answer0/41ms320 KiB
11Wrong answer0/41ms320 KiB
12Wrong answer0/41ms320 KiB
13Wrong answer0/41ms320 KiB
14Wrong answer0/41ms320 KiB
15Wrong answer0/33ms456 KiB
16Wrong answer0/43ms568 KiB
17Wrong answer0/44ms592 KiB
18Wrong answer0/43ms568 KiB
19Wrong answer0/43ms568 KiB
20Wrong answer0/43ms608 KiB
21Wrong answer0/33ms568 KiB
22Wrong answer0/43ms568 KiB