結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,288 KB
testcase_01 AC 69 ms
71,328 KB
testcase_02 AC 80 ms
71,136 KB
testcase_03 AC 74 ms
71,412 KB
testcase_04 AC 69 ms
71,224 KB
testcase_05 WA -
testcase_06 AC 76 ms
76,992 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 73 ms
71,324 KB
testcase_11 AC 69 ms
71,332 KB
testcase_12 AC 69 ms
71,124 KB
testcase_13 AC 70 ms
71,404 KB
testcase_14 AC 72 ms
71,340 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 927 ms
81,208 KB
testcase_19 AC 179 ms
80,200 KB
testcase_20 AC 480 ms
80,028 KB
testcase_21 AC 71 ms
71,372 KB
testcase_22 AC 158 ms
79,288 KB
testcase_23 WA -
testcase_24 AC 105 ms
78,556 KB
testcase_25 AC 105 ms
78,668 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 121 ms
78,716 KB
testcase_29 AC 160 ms
79,224 KB
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()

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
            if j+k>=len(newdp):continue
            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