結果

問題 No.2073 Concon Substrings (Swap Version)
ユーザー 👑 KazunKazun
提出日時 2022-09-16 23:06:45
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 506 bytes
コンパイル時間 307 ms
コンパイル使用メモリ 87,116 KB
実行使用メモリ 78,892 KB
最終ジャッジ日時 2023-08-23 16:32:58
合計ジャッジ時間 6,631 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 85 ms
71,392 KB
testcase_01 AC 88 ms
71,652 KB
testcase_02 AC 87 ms
71,320 KB
testcase_03 AC 88 ms
71,348 KB
testcase_04 AC 87 ms
71,672 KB
testcase_05 AC 119 ms
78,772 KB
testcase_06 AC 123 ms
78,780 KB
testcase_07 AC 88 ms
71,648 KB
testcase_08 AC 113 ms
78,044 KB
testcase_09 AC 116 ms
78,372 KB
testcase_10 AC 147 ms
78,784 KB
testcase_11 AC 143 ms
78,828 KB
testcase_12 AC 85 ms
71,708 KB
testcase_13 AC 102 ms
77,452 KB
testcase_14 AC 137 ms
78,752 KB
testcase_15 AC 115 ms
77,204 KB
testcase_16 AC 135 ms
78,892 KB
testcase_17 AC 86 ms
71,592 KB
testcase_18 AC 102 ms
77,196 KB
testcase_19 AC 135 ms
78,760 KB
testcase_20 AC 125 ms
78,100 KB
testcase_21 AC 122 ms
78,192 KB
testcase_22 AC 136 ms
78,668 KB
testcase_23 AC 88 ms
71,680 KB
testcase_24 AC 97 ms
77,320 KB
testcase_25 AC 126 ms
78,192 KB
testcase_26 AC 137 ms
78,824 KB
testcase_27 AC 89 ms
71,588 KB
testcase_28 AC 130 ms
78,612 KB
testcase_29 AC 109 ms
77,456 KB
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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())
0