結果

問題 No.2738 CPC To F
コンテスト
ユーザー NP
提出日時 2024-04-20 10:52:58
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
WA  
実行時間 -
コード長 450 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 172 ms
コンパイル使用メモリ 84,736 KB
実行使用メモリ 80,512 KB
最終ジャッジ日時 2026-04-28 18:06:37
合計ジャッジ時間 2,072 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 1
other WA * 22
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

def maxConsecutiveStrings(S: str) -> int:
    n = len(S)
    last_c = None
    count = 0
    max_count = 0
    for i in range(n):
        if S[i] == 'C':
            if last_c == 'T':
                count -= 1
            count += 1
        else:
            last_c = S[i]
        if S[i] == 'F':
            max_count = max(max_count, count)
            count = 0
    return max_count


N = int(input())
s = input()
print(maxConsecutiveStrings(s))
0