結果

問題 No.2073 Concon Substrings (Swap Version)
ユーザー rin204
提出日時 2022-09-16 21:30:54
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 361 bytes
コンパイル時間 303 ms
コンパイル使用メモリ 81,980 KB
実行使用メモリ 76,828 KB
最終ジャッジ日時 2024-12-21 18:27:46
合計ジャッジ時間 3,462 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 5
other AC * 17 WA * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
S = input()
cnt = [[0] * 3 for _ in range(3)]
for i, s in enumerate(S):
    if s == "c":
        cnt[i % 3][0] += 1
    elif s == "o":
        cnt[i % 3][1] += 1
    elif s == "n":
        cnt[i % 3][2] += 1


ans = 0
for i in range(3):
    mi = 1 << 30
    for j in range(3):
        mi = min(mi, cnt[(i + j) % 3][j])
    ans += mi
print(ans)
0