結果

問題 No.2073 Concon Substrings (Swap Version)
ユーザー lloyzlloyz
提出日時 2023-08-02 00:34:56
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 112 ms / 2,000 ms
コード長 342 bytes
コンパイル時間 414 ms
コンパイル使用メモリ 82,572 KB
実行使用メモリ 104,852 KB
最終ジャッジ日時 2024-04-20 01:20:06
合計ジャッジ時間 4,665 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
55,052 KB
testcase_01 AC 39 ms
54,308 KB
testcase_02 AC 39 ms
53,476 KB
testcase_03 AC 41 ms
54,012 KB
testcase_04 AC 37 ms
53,544 KB
testcase_05 AC 112 ms
104,808 KB
testcase_06 AC 108 ms
104,784 KB
testcase_07 AC 39 ms
55,252 KB
testcase_08 AC 89 ms
94,240 KB
testcase_09 AC 100 ms
98,232 KB
testcase_10 AC 108 ms
104,852 KB
testcase_11 AC 105 ms
104,832 KB
testcase_12 AC 39 ms
53,668 KB
testcase_13 AC 48 ms
66,768 KB
testcase_14 AC 97 ms
100,728 KB
testcase_15 AC 66 ms
84,096 KB
testcase_16 AC 104 ms
104,852 KB
testcase_17 AC 41 ms
54,188 KB
testcase_18 AC 52 ms
66,028 KB
testcase_19 AC 105 ms
103,688 KB
testcase_20 AC 89 ms
94,244 KB
testcase_21 AC 84 ms
93,152 KB
testcase_22 AC 105 ms
104,696 KB
testcase_23 AC 38 ms
54,620 KB
testcase_24 AC 44 ms
61,192 KB
testcase_25 AC 83 ms
94,912 KB
testcase_26 AC 108 ms
104,772 KB
testcase_27 AC 39 ms
54,844 KB
testcase_28 AC 96 ms
99,604 KB
testcase_29 AC 56 ms
75,940 KB
testcase_30 AC 91 ms
95,336 KB
testcase_31 AC 67 ms
85,168 KB
testcase_32 AC 49 ms
68,696 KB
testcase_33 AC 53 ms
71,540 KB
testcase_34 AC 49 ms
71,232 KB
testcase_35 AC 80 ms
90,860 KB
testcase_36 AC 52 ms
72,392 KB
testcase_37 AC 77 ms
90,012 KB
testcase_38 AC 50 ms
70,132 KB
testcase_39 AC 80 ms
92,196 KB
testcase_40 AC 79 ms
89,932 KB
testcase_41 AC 81 ms
92,084 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict

n = int(input())
S = list(input())

C = [defaultdict(int) for _ in range(3)]
for i in range(3 * n):
    C[i % 3][S[i]] += 1
ANS = []
for i in range(3):
    ANS.append(min(C[i % 3]['c'], C[(i + 1) % 3]['o'], C[(i + 2) % 3]['n']))
ans = sum(ANS)
if ans == n:
    if ANS[0] != n:
        ans -= 1
print(ans)
0