結果

問題 No.2073 Concon Substrings (Swap Version)
ユーザー 👑 KazunKazun
提出日時 2022-09-16 23:45:31
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 148 ms / 2,000 ms
コード長 440 bytes
コンパイル時間 293 ms
コンパイル使用メモリ 87,000 KB
実行使用メモリ 78,744 KB
最終ジャッジ日時 2023-08-23 17:00:57
合計ジャッジ時間 7,156 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 93 ms
71,676 KB
testcase_01 AC 94 ms
71,512 KB
testcase_02 AC 90 ms
71,468 KB
testcase_03 AC 92 ms
71,632 KB
testcase_04 AC 93 ms
71,340 KB
testcase_05 AC 114 ms
78,476 KB
testcase_06 AC 118 ms
78,496 KB
testcase_07 AC 92 ms
71,676 KB
testcase_08 AC 110 ms
78,004 KB
testcase_09 AC 113 ms
78,024 KB
testcase_10 AC 147 ms
78,496 KB
testcase_11 AC 148 ms
78,460 KB
testcase_12 AC 94 ms
71,728 KB
testcase_13 AC 109 ms
77,004 KB
testcase_14 AC 141 ms
78,680 KB
testcase_15 AC 116 ms
77,336 KB
testcase_16 AC 142 ms
78,460 KB
testcase_17 AC 95 ms
71,476 KB
testcase_18 AC 106 ms
76,936 KB
testcase_19 AC 140 ms
78,548 KB
testcase_20 AC 130 ms
78,176 KB
testcase_21 AC 126 ms
78,112 KB
testcase_22 AC 141 ms
78,512 KB
testcase_23 AC 91 ms
71,348 KB
testcase_24 AC 105 ms
77,032 KB
testcase_25 AC 131 ms
77,892 KB
testcase_26 AC 143 ms
78,744 KB
testcase_27 AC 92 ms
71,480 KB
testcase_28 AC 136 ms
78,348 KB
testcase_29 AC 115 ms
77,020 KB
testcase_30 AC 131 ms
78,016 KB
testcase_31 AC 120 ms
77,080 KB
testcase_32 AC 113 ms
77,104 KB
testcase_33 AC 111 ms
77,092 KB
testcase_34 AC 112 ms
76,960 KB
testcase_35 AC 130 ms
77,820 KB
testcase_36 AC 111 ms
76,968 KB
testcase_37 AC 123 ms
77,604 KB
testcase_38 AC 112 ms
76,976 KB
testcase_39 AC 127 ms
78,124 KB
testcase_40 AC 125 ms
77,708 KB
testcase_41 AC 126 ms
77,940 KB
権限があれば一括ダウンロードができます

ソースコード

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

    ans=0
    p,q,r="con"
    for _ in range(3):
        ans+=min(A[0][p], A[1][q], A[2][r])
        p,q,r=q,r,p

    if ans==N and A[0]["c"]<N:
        ans-=1

    return ans

print(solve())
0