結果

問題 No.2073 Concon Substrings (Swap Version)
ユーザー tassei903tassei903
提出日時 2022-09-19 23:31:03
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 98 ms / 2,000 ms
コード長 948 bytes
コンパイル時間 398 ms
コンパイル使用メモリ 82,036 KB
実行使用メモリ 76,856 KB
最終ジャッジ日時 2024-06-01 16:34:18
合計ジャッジ時間 4,238 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,844 KB
testcase_01 AC 39 ms
52,400 KB
testcase_02 AC 38 ms
52,532 KB
testcase_03 AC 38 ms
53,124 KB
testcase_04 AC 38 ms
52,760 KB
testcase_05 AC 73 ms
72,104 KB
testcase_06 AC 75 ms
72,104 KB
testcase_07 AC 38 ms
52,604 KB
testcase_08 AC 65 ms
69,780 KB
testcase_09 AC 67 ms
71,124 KB
testcase_10 AC 97 ms
76,800 KB
testcase_11 AC 98 ms
76,856 KB
testcase_12 AC 37 ms
52,880 KB
testcase_13 AC 80 ms
75,784 KB
testcase_14 AC 91 ms
76,224 KB
testcase_15 AC 81 ms
75,676 KB
testcase_16 AC 48 ms
63,684 KB
testcase_17 AC 38 ms
53,008 KB
testcase_18 AC 43 ms
59,976 KB
testcase_19 AC 49 ms
63,640 KB
testcase_20 AC 47 ms
61,296 KB
testcase_21 AC 45 ms
61,804 KB
testcase_22 AC 56 ms
65,756 KB
testcase_23 AC 38 ms
52,568 KB
testcase_24 AC 47 ms
62,016 KB
testcase_25 AC 53 ms
62,664 KB
testcase_26 AC 57 ms
65,340 KB
testcase_27 AC 39 ms
52,408 KB
testcase_28 AC 55 ms
63,868 KB
testcase_29 AC 49 ms
61,332 KB
testcase_30 AC 67 ms
69,712 KB
testcase_31 AC 63 ms
68,572 KB
testcase_32 AC 60 ms
67,684 KB
testcase_33 AC 62 ms
69,148 KB
testcase_34 AC 61 ms
68,940 KB
testcase_35 AC 65 ms
69,860 KB
testcase_36 AC 61 ms
67,904 KB
testcase_37 AC 65 ms
68,928 KB
testcase_38 AC 60 ms
67,624 KB
testcase_39 AC 66 ms
69,256 KB
testcase_40 AC 65 ms
69,892 KB
testcase_41 AC 66 ms
68,776 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