結果

問題 No.1943 消えたAGCT(1)
ユーザー ThetaTheta
提出日時 2022-11-02 16:12:31
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 467 bytes
コンパイル時間 144 ms
コンパイル使用メモリ 10,684 KB
実行使用メモリ 13,804 KB
最終ジャッジ日時 2023-09-24 05:06:52
合計ジャッジ時間 5,568 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
8,608 KB
testcase_01 AC 16 ms
8,472 KB
testcase_02 AC 15 ms
8,448 KB
testcase_03 AC 16 ms
8,608 KB
testcase_04 AC 15 ms
8,600 KB
testcase_05 AC 15 ms
8,440 KB
testcase_06 AC 15 ms
8,552 KB
testcase_07 AC 16 ms
8,576 KB
testcase_08 AC 16 ms
8,408 KB
testcase_09 TLE -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
権限があれば一括ダウンロードができます

ソースコード

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