結果

問題 No.1943 消えたAGCT(1)
ユーザー ikoma
提出日時 2022-05-20 21:34:12
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 102 ms / 2,000 ms
コード長 292 bytes
コンパイル時間 250 ms
コンパイル使用メモリ 82,688 KB
実行使用メモリ 106,580 KB
最終ジャッジ日時 2024-09-20 07:25:36
合計ジャッジ時間 2,885 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

N=int(input())
S=input().strip()
cnt=0
for s in S:
    if s in "AGCT":
        cnt+=1

L=list(S[:cnt])
R=list(S[cnt:])[::-1]
ans=0
while cnt>0:
    ans+=1
    s = L.pop()
    if s in "AGCT":
        cnt-=1
    else:
        L.append(R.pop())
print(ans)
0