結果

問題 No.2073 Concon Substrings (Swap Version)
ユーザー roarisroaris
提出日時 2022-09-16 22:41:48
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 122 ms / 2,000 ms
コード長 616 bytes
コンパイル時間 567 ms
コンパイル使用メモリ 87,224 KB
実行使用メモリ 78,904 KB
最終ジャッジ日時 2023-08-23 16:16:33
合計ジャッジ時間 6,854 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 88 ms
71,656 KB
testcase_01 AC 85 ms
71,580 KB
testcase_02 AC 87 ms
71,468 KB
testcase_03 AC 88 ms
71,484 KB
testcase_04 AC 87 ms
71,600 KB
testcase_05 AC 122 ms
78,904 KB
testcase_06 AC 112 ms
78,800 KB
testcase_07 AC 89 ms
71,592 KB
testcase_08 AC 106 ms
77,992 KB
testcase_09 AC 106 ms
78,400 KB
testcase_10 AC 115 ms
78,760 KB
testcase_11 AC 117 ms
78,664 KB
testcase_12 AC 88 ms
71,576 KB
testcase_13 AC 103 ms
77,492 KB
testcase_14 AC 115 ms
78,732 KB
testcase_15 AC 105 ms
77,108 KB
testcase_16 AC 108 ms
78,608 KB
testcase_17 AC 89 ms
71,348 KB
testcase_18 AC 98 ms
77,152 KB
testcase_19 AC 105 ms
78,664 KB
testcase_20 AC 105 ms
78,096 KB
testcase_21 AC 102 ms
77,868 KB
testcase_22 AC 107 ms
78,788 KB
testcase_23 AC 89 ms
71,684 KB
testcase_24 AC 100 ms
76,972 KB
testcase_25 AC 105 ms
78,160 KB
testcase_26 AC 109 ms
78,744 KB
testcase_27 AC 86 ms
71,680 KB
testcase_28 AC 107 ms
78,192 KB
testcase_29 AC 101 ms
77,144 KB
testcase_30 AC 107 ms
78,216 KB
testcase_31 AC 110 ms
76,904 KB
testcase_32 AC 103 ms
77,308 KB
testcase_33 AC 101 ms
77,412 KB
testcase_34 AC 100 ms
77,352 KB
testcase_35 AC 104 ms
78,184 KB
testcase_36 AC 102 ms
77,168 KB
testcase_37 AC 106 ms
77,852 KB
testcase_38 AC 104 ms
77,376 KB
testcase_39 AC 107 ms
77,820 KB
testcase_40 AC 115 ms
77,812 KB
testcase_41 AC 106 ms
78,004 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
from collections import *

N = int(input())
S = input()[:-1]
c = [0, 0, 0]
o = [0, 0, 0]
n = [0, 0, 0]

for i in range(3*N):
    if S[i]=='c':
        c[i%3] += 1
    elif S[i]=='o':
        o[i%3] += 1
    elif S[i]=='n':
        n[i%3] += 1

ans = 0
now = 0

for _ in range(min(c[0], o[1], n[2])):
    if now+3<=3*N:
        now += 3
        ans += 1
    
now += 1

for _ in range(min(c[1], o[2], n[0])):
    if now+3<=3*N:
        now += 3
        ans += 1
    
now += 1

for _ in range(min(c[2], o[0], n[1])):
    if now+3<=3*N:
        now += 3
        ans += 1

print(ans)
0