結果

問題 No.1943 消えたAGCT(1)
ユーザー vwxyz
提出日時 2022-09-06 15:29:22
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 217 ms / 2,000 ms
コード長 401 bytes
コンパイル時間 166 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 11,776 KB
最終ジャッジ日時 2024-11-21 16:42:14
合計ジャッジ時間 4,130 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict
import sys
readline=sys.stdin.readline
write=sys.stdout.write

N=int(readline())
S=readline().rstrip()
cnt=sum(S.count(s) for s in "AGCT")
if cnt==0:
    ans=0
else:
    l,r=cnt-1,cnt
    cur=cnt-1
    while cnt:
        if S[cur] in "AGCT":
            cnt-=1
            l-=1
            cur=l
        else:
            cur=r
            r+=1
    ans=r
print(ans)
0