結果

問題 No.2073 Concon Substrings (Swap Version)
ユーザー tassei903tassei903
提出日時 2022-09-19 23:31:03
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 135 ms / 2,000 ms
コード長 948 bytes
コンパイル時間 382 ms
コンパイル使用メモリ 86,648 KB
実行使用メモリ 77,636 KB
最終ジャッジ日時 2023-08-23 19:12:32
合計ジャッジ時間 6,675 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 81 ms
71,368 KB
testcase_01 AC 79 ms
71,176 KB
testcase_02 AC 83 ms
71,216 KB
testcase_03 AC 79 ms
71,124 KB
testcase_04 AC 77 ms
71,132 KB
testcase_05 AC 114 ms
77,376 KB
testcase_06 AC 109 ms
77,312 KB
testcase_07 AC 75 ms
71,160 KB
testcase_08 AC 104 ms
76,640 KB
testcase_09 AC 108 ms
76,916 KB
testcase_10 AC 132 ms
77,584 KB
testcase_11 AC 135 ms
77,636 KB
testcase_12 AC 78 ms
71,228 KB
testcase_13 AC 115 ms
76,552 KB
testcase_14 AC 134 ms
77,348 KB
testcase_15 AC 120 ms
76,848 KB
testcase_16 AC 89 ms
77,380 KB
testcase_17 AC 80 ms
71,240 KB
testcase_18 AC 85 ms
75,624 KB
testcase_19 AC 92 ms
77,088 KB
testcase_20 AC 85 ms
76,688 KB
testcase_21 AC 84 ms
76,528 KB
testcase_22 AC 94 ms
77,336 KB
testcase_23 AC 77 ms
71,408 KB
testcase_24 AC 85 ms
75,888 KB
testcase_25 AC 92 ms
76,604 KB
testcase_26 AC 94 ms
77,608 KB
testcase_27 AC 79 ms
71,136 KB
testcase_28 AC 91 ms
76,916 KB
testcase_29 AC 87 ms
76,192 KB
testcase_30 AC 104 ms
76,796 KB
testcase_31 AC 100 ms
76,260 KB
testcase_32 AC 98 ms
76,032 KB
testcase_33 AC 101 ms
75,940 KB
testcase_34 AC 99 ms
75,880 KB
testcase_35 AC 100 ms
76,640 KB
testcase_36 AC 102 ms
75,780 KB
testcase_37 AC 103 ms
76,468 KB
testcase_38 AC 97 ms
75,816 KB
testcase_39 AC 104 ms
76,608 KB
testcase_40 AC 104 ms
76,492 KB
testcase_41 AC 106 ms
76,616 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = lambda :sys.stdin.readline()[:-1]
ni = lambda :int(input())
na = lambda :list(map(int,input().split()))
yes = lambda :print("yes");Yes = lambda :print("Yes");YES = lambda : print("YES")
no = lambda :print("no");No = lambda :print("No");NO = lambda : print("NO")
#######################################################################


n = ni()
s = input()

a = [0,0,0]
for i in range(n):
    if s[i*3] == "c":
        a[0] += 1
    if s[i*3+1] == "o":
        a[1] += 1
    if s[i*3+2] == "n":
        a[2] += 1
x1 = min(a)
if min(a) == n:
    print(n)
    exit()

a = [0,0,0]
for i in range(n):
    if s[i*3] == "o":
        a[0] += 1
    if s[i*3+1] == "n":
        a[1] += 1
    if s[i*3+2] == "c":
        a[2] += 1
x2 = min(a)


a = [0,0,0]
for i in range(n):
    if s[i*3] == "n":
        a[0] += 1
    if s[i*3+1] == "c":
        a[1] += 1
    if s[i*3+2] == "o":
        a[2] += 1
x3 = min(a)

print(min(x1+x2+x3, n-1))
0