結果
| 問題 | No.2073 Concon Substrings (Swap Version) | 
| コンテスト | |
| ユーザー | 👑  Kazun | 
| 提出日時 | 2022-09-16 23:06:45 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 506 bytes | 
| コンパイル時間 | 431 ms | 
| コンパイル使用メモリ | 82,464 KB | 
| 実行使用メモリ | 77,356 KB | 
| 最終ジャッジ日時 | 2024-12-21 22:38:42 | 
| 合計ジャッジ時間 | 4,436 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 5 | 
| other | AC * 25 WA * 12 | 
ソースコード
from collections import defaultdict
def solve():
    N=int(input())
    S=input()
    A=[defaultdict(int), defaultdict(int), defaultdict(int)]
    for i in range(3*N):
        if S[i]=="c" or S[i]=="o" or S[i]=="n":
            A[i%3][S[i]]+=1
        else:
            A[i%3]["x"]+=1
    c,o,n,x="conx"
    ans=0
    p,q,r=c,o,n
    for t in range(3):
        x=min(A[0][p],A[1][q],A[2][r])
        if t!=0:
            x=min(x,N-1)
        ans+=x
        p,q,r=q,r,p
    return ans
print(solve())
            
            
            
        