結果

問題 No.2076 Concon Substrings (ConVersion)
ユーザー taiga0629kyoprotaiga0629kyopro
提出日時 2022-09-16 22:59:15
言語 PyPy3
(7.3.8)
結果
AC  
実行時間 3,181 ms / 5,000 ms
コード長 781 bytes
コンパイル時間 915 ms
使用メモリ 181,976 KB
最終ジャッジ日時 2023-01-11 09:02:18
合計ジャッジ時間 20,046 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 77 ms
75,772 KB
testcase_01 AC 75 ms
75,812 KB
testcase_02 AC 75 ms
75,836 KB
testcase_03 AC 73 ms
75,816 KB
testcase_04 AC 74 ms
75,532 KB
testcase_05 AC 90 ms
82,024 KB
testcase_06 AC 84 ms
81,636 KB
testcase_07 AC 2,694 ms
181,976 KB
testcase_08 AC 1,793 ms
153,516 KB
testcase_09 AC 2,667 ms
181,716 KB
testcase_10 AC 77 ms
75,740 KB
testcase_11 AC 77 ms
75,744 KB
testcase_12 AC 77 ms
75,800 KB
testcase_13 AC 76 ms
75,520 KB
testcase_14 AC 76 ms
75,668 KB
testcase_15 AC 1,050 ms
88,148 KB
testcase_16 AC 893 ms
106,116 KB
testcase_17 AC 516 ms
96,212 KB
testcase_18 AC 2,460 ms
141,768 KB
testcase_19 AC 273 ms
98,240 KB
testcase_20 AC 3,181 ms
110,320 KB
testcase_21 AC 75 ms
75,812 KB
testcase_22 AC 268 ms
87,520 KB
testcase_23 AC 125 ms
82,872 KB
testcase_24 AC 129 ms
84,168 KB
testcase_25 AC 133 ms
85,836 KB
testcase_26 AC 134 ms
82,072 KB
testcase_27 AC 173 ms
82,140 KB
testcase_28 AC 151 ms
85,280 KB
testcase_29 AC 229 ms
88,100 KB
testcase_30 AC 188 ms
90,508 KB
testcase_31 AC 83 ms
80,764 KB
権限があれば一括ダウンロードができます

ソースコード

diff #


n,a,b=map(int,input().split())
N=n
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