結果

問題 No.1943 消えたAGCT(1)
ユーザー ikomaikoma
提出日時 2022-05-20 21:34:12
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 110 ms / 2,000 ms
コード長 292 bytes
コンパイル時間 164 ms
コンパイル使用メモリ 81,648 KB
実行使用メモリ 106,028 KB
最終ジャッジ日時 2023-10-20 11:53:30
合計ジャッジ時間 3,267 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,420 KB
testcase_01 AC 39 ms
53,420 KB
testcase_02 AC 39 ms
53,420 KB
testcase_03 AC 39 ms
53,420 KB
testcase_04 AC 38 ms
53,420 KB
testcase_05 AC 38 ms
53,420 KB
testcase_06 AC 37 ms
53,420 KB
testcase_07 AC 37 ms
53,420 KB
testcase_08 AC 37 ms
53,420 KB
testcase_09 AC 93 ms
102,212 KB
testcase_10 AC 82 ms
101,752 KB
testcase_11 AC 77 ms
93,956 KB
testcase_12 AC 96 ms
106,028 KB
testcase_13 AC 67 ms
83,008 KB
testcase_14 AC 46 ms
62,040 KB
testcase_15 AC 105 ms
104,360 KB
testcase_16 AC 91 ms
95,508 KB
testcase_17 AC 96 ms
99,664 KB
testcase_18 AC 109 ms
104,448 KB
testcase_19 AC 110 ms
104,968 KB
testcase_20 AC 109 ms
105,780 KB
testcase_21 AC 110 ms
104,976 KB
testcase_22 AC 109 ms
101,280 KB
testcase_23 AC 108 ms
101,280 KB
testcase_24 AC 78 ms
93,952 KB
testcase_25 AC 77 ms
93,956 KB
testcase_26 AC 77 ms
93,468 KB
権限があれば一括ダウンロードができます

ソースコード

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