結果

問題 No.2073 Concon Substrings (Swap Version)
ユーザー rafi2
提出日時 2023-03-15 17:52:12
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 489 bytes
コンパイル時間 137 ms
コンパイル使用メモリ 81,972 KB
実行使用メモリ 77,448 KB
最終ジャッジ日時 2024-09-18 08:49:51
合計ジャッジ時間 3,751 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 5
other AC * 29 WA * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
s = input()
from collections import defaultdict
d0 = defaultdict(int)
d1 = defaultdict(int)
d2 = defaultdict(int)

for i in range(n):
    d0[s[3*i]] += 1
    d1[s[3*i+1]] += 1
    d2[s[3*i+2]] += 1

ans = 0

l = ["c","o","n"]
ans1 = min(d0["c"],d1["o"],d2["n"])
ans2 = min(d0["n"],d1["c"],d2["o"])
ans3 = min(d0["o"],d1["n"],d2["c"])
if ans1 == n or ans2 == n or ans3 == n:
    print(n)
    exit()
ans = ans1+ans2+ans3
if ans == n:
    print(ans-1)
    exit()
print(ans)

0