結果

問題 No.2073 Concon Substrings (Swap Version)
コンテスト
ユーザー ニックネーム
提出日時 2022-09-16 22:10:32
言語 Python3
(3.15.0 + numpy 2.5.4 + scipy 1.18.1 + ACL)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
AC  
実行時間 31 ms / 2,000 ms
+ 420µs
コード長 277 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 517 ms
コンパイル使用メモリ 14,464 KB
実行使用メモリ 12,724 KB
最終ジャッジ日時 2026-10-20 06:46:09
合計ジャッジ時間 4,295 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 5
other AC * 38
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

m = int(input())
s = input()
c = [s[i::3].count("c") for i in range(3)]
o = [s[i::3].count("o") for i in range(3)]
n = [s[i::3].count("n") for i in range(3)]
ans = [min(c[i], o[(i+1)%3], n[(i+2)%3]) for i in range(3)]
print(min(sum(ans), m-1) if ans[1] or ans[2] else sum(ans))
0