結果

問題 No.2073 Concon Substrings (Swap Version)
ユーザー gew1fw
提出日時 2025-06-12 17:07:36
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 577 bytes
コンパイル時間 233 ms
コンパイル使用メモリ 81,992 KB
実行使用メモリ 77,888 KB
最終ジャッジ日時 2025-06-12 17:07:41
合計ジャッジ時間 4,619 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 5
other AC * 17 WA * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
s = input().strip()

from collections import defaultdict

groups = {
    0: {'c': 0, 'o': 0, 'n': 0},
    1: {'c': 0, 'o': 0, 'n': 0},
    2: {'c': 0, 'o': 0, 'n': 0}
}

for i in range(len(s)):
    mod = i % 3
    c = s[i]
    if c in ['c', 'o', 'n']:
        groups[mod][c] += 1

c0, o0, n0 = groups[0]['c'], groups[0]['o'], groups[0]['n']
c1, o1, n1 = groups[1]['c'], groups[1]['o'], groups[1]['n']
c2, o2, n2 = groups[2]['c'], groups[2]['o'], groups[2]['n']

t1 = min(c0, o1, n2)
t2 = min(c1, o2, n0)
t3 = min(c2, o0, n1)

total = t1 + t2 + t3

print(total)
0