結果
| 問題 |
No.1943 消えたAGCT(1)
|
| コンテスト | |
| ユーザー |
MasKoaTS
|
| 提出日時 | 2022-05-20 21:54:18 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 244 ms / 2,000 ms |
| コード長 | 1,103 bytes |
| コンパイル時間 | 170 ms |
| コンパイル使用メモリ | 82,048 KB |
| 実行使用メモリ | 135,860 KB |
| 最終ジャッジ日時 | 2024-09-20 07:58:26 |
| 合計ジャッジ時間 | 6,242 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 27 |
ソースコード
import itertools as iter
import collections as coll
import heapq as hq
import bisect as bis
from decimal import Decimal as dec
from functools import cmp_to_key
import math
import sys
#import pypyjit
#pypyjit.set_param('max_unroll_recursion=-1')
sys.setrecursionlimit(10 ** 6)
inp = sys.stdin.readline
input = lambda : inp().rstrip()
getN = lambda : int(inp())
getNs = lambda : map(int, inp().split())
getList = lambda :list(map(int, inp().split()))
getStrs = lambda n : [input() for _ in [0] * n]
def yexit(): print("Yes"); exit(0)
def nexit(): print("No"); exit(0)
pi = 3.141592653589793
mod = 1000000007
MOD = 998244353
INF = 4611686018427387903
dx = [1, 0, -1, 0]; dy = [0, 1, 0, -1]
"""
Main Code
"""
n = getN()
s = input()
lis = []
cnt = 0
for c in s:
if(c in "AGCT"):
cnt += 1
lis.append(c)
if(cnt == 0):
print(0)
exit(0)
que1 = coll.deque(lis[:(cnt - 1)])
que2 = coll.deque(lis[(cnt - 1):])
while(cnt > 0):
#print(que1)
#print(que2)
c = que2.popleft()
cnt -= (c in "AGCT")
if(c in "AGCT" and len(que1) > 0):
d = que1.pop()
que2.appendleft(d)
print(n - len(que1) - len(que2))
MasKoaTS