結果
問題 |
No.1951 消えたAGCT(2)
|
ユーザー |
![]() |
提出日時 | 2022-05-20 23:12:00 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 704 bytes |
コンパイル時間 | 478 ms |
コンパイル使用メモリ | 82,176 KB |
実行使用メモリ | 255,464 KB |
最終ジャッジ日時 | 2024-09-20 09:34:34 |
合計ジャッジ時間 | 6,303 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 13 TLE * 1 -- * 14 |
ソースコード
""" あらかじめ反転 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)