結果

問題 No.2073 Concon Substrings (Swap Version)
ユーザー とりゐ
提出日時 2022-09-16 21:53:17
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 404 bytes
コンパイル時間 325 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 74,624 KB
最終ジャッジ日時 2024-12-21 19:10:54
合計ジャッジ時間 3,973 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 5
other AC * 29 WA * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict


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

ans=[]
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.append(min(cnt))

if sum(ans)==n:
  if max(ans)==n:
    print(n)
  else:
    print(n-1)
else:
  print(sum(ans))
0