結果

問題 No.2076 Concon Substrings (ConVersion)
ユーザー taiga0629kyoprotaiga0629kyopro
提出日時 2022-09-16 22:59:15
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 3,176 ms / 5,000 ms
コード長 781 bytes
コンパイル時間 280 ms
コンパイル使用メモリ 86,820 KB
実行使用メモリ 177,388 KB
最終ジャッジ日時 2023-08-23 17:03:16
合計ジャッジ時間 20,441 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,324 KB
testcase_01 AC 72 ms
71,232 KB
testcase_02 AC 72 ms
71,072 KB
testcase_03 AC 72 ms
71,344 KB
testcase_04 AC 71 ms
71,320 KB
testcase_05 AC 86 ms
77,416 KB
testcase_06 AC 84 ms
77,264 KB
testcase_07 AC 2,849 ms
176,812 KB
testcase_08 AC 1,914 ms
152,164 KB
testcase_09 AC 2,843 ms
177,388 KB
testcase_10 AC 75 ms
71,212 KB
testcase_11 AC 74 ms
71,644 KB
testcase_12 AC 75 ms
71,552 KB
testcase_13 AC 76 ms
71,376 KB
testcase_14 AC 76 ms
71,372 KB
testcase_15 AC 1,101 ms
83,720 KB
testcase_16 AC 922 ms
103,524 KB
testcase_17 AC 530 ms
92,224 KB
testcase_18 AC 2,604 ms
138,456 KB
testcase_19 AC 296 ms
94,052 KB
testcase_20 AC 3,176 ms
108,472 KB
testcase_21 AC 71 ms
71,372 KB
testcase_22 AC 273 ms
83,396 KB
testcase_23 AC 120 ms
78,560 KB
testcase_24 AC 130 ms
80,356 KB
testcase_25 AC 137 ms
80,820 KB
testcase_26 AC 133 ms
78,236 KB
testcase_27 AC 165 ms
77,632 KB
testcase_28 AC 150 ms
80,724 KB
testcase_29 AC 234 ms
83,568 KB
testcase_30 AC 207 ms
86,740 KB
testcase_31 AC 78 ms
76,004 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