結果

問題 No.2073 Concon Substrings (Swap Version)
ユーザー ntudantuda
提出日時 2022-09-18 19:30:53
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 130 ms / 2,000 ms
コード長 379 bytes
コンパイル時間 291 ms
コンパイル使用メモリ 87,040 KB
実行使用メモリ 105,472 KB
最終ジャッジ日時 2023-08-23 18:18:53
合計ジャッジ時間 5,846 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 66 ms
71,444 KB
testcase_01 AC 68 ms
71,388 KB
testcase_02 AC 74 ms
71,504 KB
testcase_03 AC 68 ms
71,220 KB
testcase_04 AC 71 ms
71,448 KB
testcase_05 AC 113 ms
105,404 KB
testcase_06 AC 118 ms
105,304 KB
testcase_07 AC 68 ms
71,472 KB
testcase_08 AC 97 ms
94,688 KB
testcase_09 AC 103 ms
98,716 KB
testcase_10 AC 124 ms
105,464 KB
testcase_11 AC 130 ms
105,472 KB
testcase_12 AC 68 ms
71,528 KB
testcase_13 AC 81 ms
76,980 KB
testcase_14 AC 116 ms
99,484 KB
testcase_15 AC 95 ms
84,636 KB
testcase_16 AC 122 ms
105,324 KB
testcase_17 AC 68 ms
71,036 KB
testcase_18 AC 75 ms
76,980 KB
testcase_19 AC 118 ms
104,324 KB
testcase_20 AC 103 ms
94,500 KB
testcase_21 AC 97 ms
94,040 KB
testcase_22 AC 115 ms
105,424 KB
testcase_23 AC 66 ms
71,404 KB
testcase_24 AC 77 ms
75,944 KB
testcase_25 AC 101 ms
95,248 KB
testcase_26 AC 116 ms
105,292 KB
testcase_27 AC 67 ms
71,324 KB
testcase_28 AC 109 ms
98,928 KB
testcase_29 AC 82 ms
78,908 KB
testcase_30 AC 100 ms
95,904 KB
testcase_31 AC 82 ms
79,512 KB
testcase_32 AC 78 ms
77,208 KB
testcase_33 AC 80 ms
77,700 KB
testcase_34 AC 80 ms
77,616 KB
testcase_35 AC 99 ms
91,360 KB
testcase_36 AC 80 ms
77,896 KB
testcase_37 AC 96 ms
90,464 KB
testcase_38 AC 81 ms
77,476 KB
testcase_39 AC 100 ms
93,168 KB
testcase_40 AC 98 ms
90,640 KB
testcase_41 AC 99 ms
92,772 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
S = input()
X = [[0] * 3 for _ in range(3)]
for i, c in enumerate(list(S)):
    if c == "c":
        X[i % 3][0] += 1
    if c == "o":
        X[(i - 1) % 3][1] += 1
    if c == "n":
        X[(i - 2) % 3][2] += 1
ans = 0
usable = 3 * N
for i in range(3):
    tmp = min(min(X[i]), usable // 3)
    ans += tmp
    usable = max(usable - 3 * tmp - 1, 0)
print(ans)
0