結果

問題 No.2073 Concon Substrings (Swap Version)
ユーザー とりゐ
提出日時 2022-09-16 21:51:24
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 313 bytes
コンパイル時間 293 ms
コンパイル使用メモリ 81,972 KB
実行使用メモリ 75,344 KB
最終ジャッジ日時 2024-12-21 19:07:57
合計ジャッジ時間 4,203 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 5
other AC * 17 WA * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict


n=int(input())
s=input()

ans=0
for x in range(3):
  y=(x+1)%3
  z=(x+2)%3
  cnt=[0]*3
  for i in range(3*n):
    if s[i]=='c' and i%3==x:
      cnt[0]+=1
    if s[i]=='o' and i%3==y:
      cnt[1]+=1
    if s[i]=='n' and i%3==z:
      cnt[2]+=1
  
  ans+=min(cnt)

print(ans)
0