結果

問題 No.2076 Concon Substrings (ConVersion)
ユーザー 👑 p-adic
提出日時 2023-06-11 17:42:42
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 318 bytes
コンパイル時間 312 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 79,360 KB
最終ジャッジ日時 2025-01-03 04:00:47
合計ジャッジ時間 15,470 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3 WA * 1
other AC * 13 WA * 13 RE * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

I,R=input,range
N,A,B=map(int,I().split())
S=I()+'0'
X=[]
c=0
w="con"
for s in S:
	if s==w[c%3]:c+=1
	elif c//3:X,c=X+[c//3],0
D=[0]+[-1]*N
L=0
for x in X:
	L+=x//A
	for i in R(L,-1,-1):
		for j in R(min(x//A,i)+1):D[i]=max(D[i],[-1,(x-A*j)//B+D[i-j]][D[i-j]>=0])
print(max([[0,i+min(i,D[i])][D[i]>i-2]for i in R(L)]))
0