結果

問題 No.1943 消えたAGCT(1)
ユーザー ThetaTheta
提出日時 2022-11-02 16:12:31
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
TLE  
実行時間 -
コード長 467 bytes
コンパイル時間 173 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 18,848 KB
最終ジャッジ日時 2024-07-17 05:21:18
合計ジャッジ時間 4,433 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 9 TLE * 1 -- * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import Counter


def main():
    n = int(input())
    S = input()
    S_counter = Counter(S)

    operations = 0
    while any(letter in S for letter in ("A", "G", "C", "T")):
        idx = S_counter["A"] + S_counter["G"] + \
            S_counter["C"] + S_counter["T"] - 1
        removed = S[idx]
        S = S[:idx] + S[idx+1:]
        S_counter[removed] -= 1
        operations += 1

    print(operations)


if __name__ == "__main__":
    main()
0