結果

問題 No.1951 消えたAGCT(2)
ユーザー 👑 SPD_9X2SPD_9X2
提出日時 2022-05-20 23:12:00
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 704 bytes
コンパイル時間 155 ms
コンパイル使用メモリ 81,832 KB
実行使用メモリ 255,252 KB
最終ジャッジ日時 2023-10-20 14:04:36
合計ジャッジ時間 6,462 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
53,552 KB
testcase_01 AC 39 ms
53,552 KB
testcase_02 AC 40 ms
53,552 KB
testcase_03 AC 39 ms
53,552 KB
testcase_04 AC 39 ms
53,552 KB
testcase_05 AC 40 ms
53,552 KB
testcase_06 AC 41 ms
53,552 KB
testcase_07 AC 39 ms
53,552 KB
testcase_08 AC 280 ms
255,252 KB
testcase_09 AC 117 ms
109,464 KB
testcase_10 AC 157 ms
146,228 KB
testcase_11 AC 274 ms
255,248 KB
testcase_12 AC 124 ms
120,708 KB
testcase_13 TLE -
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 -- -
testcase_27 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

"""

あらかじめ反転
1色にできるか?

"""

from sys import stdin


N = n = int(stdin.readline())

s = list(stdin.readline()[:-1])

oa = ord("A")
agct = [ord("A")-oa , ord("G")-oa, ord("C")-oa, ord("T")-oa]
for i in range(N):
    s[i] = ord(s[i])-oa

ans = 0
for loop in range(n):

    c1 = 0
    for i in range(len(s)):
        if s[i] in agct:
            c1 += 1

    if c1 == 0:
        break
    ans += 1

    t = []
    c2 = 0
    CC = s[c1-1]
    
    for i in range(len(s)):
        if i != c1-1:
            t.append(s[i])
            if s[i] == CC:
                c2 += 1

    for i in range(len(t)):
        t[i] += c2
        t[i] %= 26

    s = t
print (ans)
    
            
0