83982024-01-15 15:34:19lacitoDNS szakaszok száma (75 pont)cpp17Wrong answer 0/757ms6040 KiB
// Source: https://usaco.guide/general/io

#include <bits/stdc++.h>
using namespace std;

int main() {
	int n;
	string s;
	cin >> n >> s;
	vector<int> tcount(n), nextg(n);
	int t = 0, g = -1;
	long long ans;
	for (int i = n - 1; i >= 0; i--) {
		tcount[i] = t;
		nextg[i] = g;
		if (s[i] == 'G') g = i;
		if (s[i] == 'T') t++;
		if (s[i] == 'A' && nextg[i] != -1) {
			ans += tcount[nextg[i]];
		}
	}
	cout << ans << endl;
}
SubtaskSumTestVerdictTimeMemory
base0/75
1Wrong answer0/03ms1808 KiB
2Wrong answer0/07ms3872 KiB
3Wrong answer0/33ms2344 KiB
4Wrong answer0/43ms2308 KiB
5Wrong answer0/43ms2552 KiB
6Wrong answer0/43ms2764 KiB
7Wrong answer0/43ms3012 KiB
8Wrong answer0/33ms3008 KiB
9Wrong answer0/33ms3128 KiB
10Wrong answer0/43ms3040 KiB
11Wrong answer0/43ms3116 KiB
12Wrong answer0/43ms3372 KiB
13Wrong answer0/43ms3396 KiB
14Wrong answer0/43ms3464 KiB
15Wrong answer0/36ms5536 KiB
16Wrong answer0/46ms5428 KiB
17Wrong answer0/46ms5432 KiB
18Wrong answer0/46ms5580 KiB
19Wrong answer0/46ms5688 KiB
20Wrong answer0/46ms5808 KiB
21Wrong answer0/36ms5956 KiB
22Wrong answer0/46ms6040 KiB