結果

問題 No.2076 Concon Substrings (ConVersion)
ユーザー taiga0629kyoprotaiga0629kyopro
提出日時 2022-09-16 22:45:18
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 916 bytes
コンパイル時間 496 ms
コンパイル使用メモリ 87,216 KB
実行使用メモリ 78,040 KB
最終ジャッジ日時 2023-08-23 16:18:53
合計ジャッジ時間 4,365 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,356 KB
testcase_01 AC 75 ms
71,392 KB
testcase_02 AC 71 ms
71,192 KB
testcase_03 AC 72 ms
71,116 KB
testcase_04 AC 71 ms
71,308 KB
testcase_05 AC 78 ms
76,808 KB
testcase_06 AC 77 ms
76,896 KB
testcase_07 AC 87 ms
77,452 KB
testcase_08 AC 86 ms
77,448 KB
testcase_09 AC 87 ms
77,492 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 74 ms
71,464 KB
testcase_13 AC 72 ms
71,116 KB
testcase_14 AC 73 ms
71,376 KB
testcase_15 AC 83 ms
77,264 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 87 ms
77,404 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 72 ms
71,068 KB
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 -
権限があれば一括ダウンロードができます

ソースコード

diff #


n,a,b=map(int,input().split())
s=["#"]+list(input())
x=[]
l=1
nod=["o","n","c"]
while l<=n:
    if s[l]!="c":l+=1
    else:
        r=l
        while r<n:
            d=(r-l)%3
            if s[r+1]==nod[d]:
                r+=1
            else:
                break
        num=(r-l+1)//3
        if num>0:x.append(num)
        l=r+1
n=len(x)
if n==0:
    print(0)
    exit()
ans=0
for i in range(n):
    num=x[i]//(a+b)
    ans+=2*num
    x[i]-=num*(a+b)
if a==b:
    for i in range(n):
        ans+=x[i]//a
    print(ans)
elif a>b:
    B=0
    AB=0
    for i in range(n):
        if x[i]>=a:AB+=1
        elif x[i]>=b:B+=1
    if AB>=B:
        ans+=AB+B
    else:
        ans+=AB*2
    print(ans)
else:
    A=0
    AB=0
    for i in range(n):
        if x[i]>=b:AB+=1
        elif x[i]>=a:A+=1
    if AB>=A:
        ans+=AB+A
    elif AB+1==A:
        ans+=AB+A
    else:
        ans+=2*AB+1
    print(ans)

0