結果

問題 No.2073 Concon Substrings (Swap Version)
ユーザー roarisroaris
提出日時 2022-09-16 22:39:22
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 642 bytes
コンパイル時間 268 ms
コンパイル使用メモリ 87,144 KB
実行使用メモリ 79,204 KB
最終ジャッジ日時 2023-08-23 16:14:35
合計ジャッジ時間 6,444 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 87 ms
71,544 KB
testcase_01 AC 88 ms
71,604 KB
testcase_02 AC 87 ms
71,276 KB
testcase_03 AC 89 ms
71,700 KB
testcase_04 AC 87 ms
71,784 KB
testcase_05 AC 110 ms
78,828 KB
testcase_06 AC 114 ms
78,804 KB
testcase_07 AC 90 ms
71,540 KB
testcase_08 AC 107 ms
77,984 KB
testcase_09 AC 109 ms
78,456 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 89 ms
71,664 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 90 ms
71,696 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
権限があれば一括ダウンロードができます

ソースコード

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
    
    now += 1

print(ans)
0