113702024-08-27 22:26:4742DNS szakaszok száma (75 pont)python3Accepted 75/7546ms7440 KiB
def f():
 N=int(input())
 s=input()
 T=[0]*N
 G=[-1]*N
 cur=0
 kov=-1
 for i in range(N-1,-1,-1):
  if s[i]=='T':
   cur+=1
  T[i]=cur
  if s[i]=='G':
   kov=i
  G[i]=kov
 res = 0
 for i in range(N):
  if s[i]=='A':
   if G[i]!=-1:
    res+=T[G[i]]
 print(res)

f()
SubtaskSumTestVerdictTimeMemory
base75/75
1Accepted0/017ms3216 KiB
2Accepted0/046ms6376 KiB
3Accepted3/317ms3084 KiB
4Accepted4/417ms3028 KiB
5Accepted4/417ms3048 KiB
6Accepted4/417ms3048 KiB
7Accepted4/417ms3184 KiB
8Accepted3/316ms3088 KiB
9Accepted3/316ms3152 KiB
10Accepted4/417ms3100 KiB
11Accepted4/416ms3192 KiB
12Accepted4/416ms3176 KiB
13Accepted4/416ms3104 KiB
14Accepted4/417ms3176 KiB
15Accepted3/343ms6272 KiB
16Accepted4/445ms5676 KiB
17Accepted4/441ms7440 KiB
18Accepted4/446ms6684 KiB
19Accepted4/446ms5624 KiB
20Accepted4/445ms7312 KiB
21Accepted3/345ms6476 KiB
22Accepted4/446ms6416 KiB