結果

問題 No.2076 Concon Substrings (ConVersion)
ユーザー taiga0629kyoprotaiga0629kyopro
提出日時 2022-09-16 22:56:57
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 776 bytes
コンパイル時間 392 ms
コンパイル使用メモリ 87,052 KB
実行使用メモリ 85,280 KB
最終ジャッジ日時 2023-08-23 16:26:20
合計ジャッジ時間 6,745 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
71,252 KB
testcase_01 AC 68 ms
71,436 KB
testcase_02 AC 69 ms
71,248 KB
testcase_03 AC 70 ms
71,148 KB
testcase_04 AC 73 ms
71,204 KB
testcase_05 RE -
testcase_06 AC 76 ms
76,984 KB
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 AC 68 ms
71,360 KB
testcase_11 AC 70 ms
71,452 KB
testcase_12 AC 69 ms
71,192 KB
testcase_13 AC 69 ms
71,456 KB
testcase_14 AC 70 ms
71,028 KB
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 AC 69 ms
71,448 KB
testcase_22 RE -
testcase_23 RE -
testcase_24 AC 101 ms
78,428 KB
testcase_25 AC 100 ms
78,824 KB
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
testcase_31 RE -
権限があれば一括ダウンロードができます

ソースコード

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()

dp=[-2**60]*(n//3+10)

dp[0]=0
for i in range(n):
    newdp=[-2**60]*(n//3+10)
    for j in range(len(dp)):
        if dp[j]<0:break
        for k in range(10**9):
            if a*k>x[i]:break
            newdp[j+k]=max(newdp[j+k],dp[j]+(x[i]-a*k)//b)
    dp=newdp[:]
ans=0
for A in range(len(dp)):
    if A>dp[A]:
        ans=max(ans,2*dp[A]+1)
    else:
        ans=max(ans,2*A)
print(ans)

0