結果

問題 No.2073 Concon Substrings (Swap Version)
ユーザー 👑 Kazun
提出日時 2022-09-16 22:33:21
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 340 bytes
コンパイル時間 201 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 77,056 KB
最終ジャッジ日時 2024-12-21 21:49:45
合計ジャッジ時間 4,666 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 5
other AC * 17 WA * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict


def solve():
    N=int(input())
    S=input()

    A=[defaultdict(int), defaultdict(int), defaultdict(int)]

    for i in range(3*N):
        A[i%3][S[i]]+=1

    p,q,r="con"
    ans=0

    for _ in range(3):
        ans+=min(A[0][p],A[1][q],A[2][r])
        p,q,r=q,r,p
    return ans

print(solve())
0