結果

問題 No.1943 消えたAGCT(1)
コンテスト
ユーザー terasa
提出日時 2022-05-21 18:53:14
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
WA  
実行時間 -
コード長 557 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 205 ms
コンパイル使用メモリ 85,376 KB
実行使用メモリ 83,968 KB
最終ジャッジ日時 2026-04-08 23:16:53
合計ジャッジ時間 2,717 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 17 WA * 10
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import sys
import pypyjit
import itertools
import heapq
import math
from collections import deque, defaultdict, Counter
import string
import random

input = sys.stdin.readline
sys.setrecursionlimit(10 ** 6)
pypyjit.set_param('max_unroll_recursion=-1')


N = int(input())
S = input()[:-1]

chars = {'A', 'G', 'C', 'T'}
cnt = 0
first = None
last = None
for i, c in enumerate(S):
    if c in chars:
        if first is None:
            first = i
        last = i
        cnt += 1
if first is None:
    print(0)
else:
    print(last - min(first, cnt - 1) + 1)
0