結果

問題 No.2076 Concon Substrings (ConVersion)
ユーザー 👑 p-adicp-adic
提出日時 2023-06-11 19:22:46
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 2,391 ms / 5,000 ms
コード長 302 bytes
コンパイル時間 426 ms
コンパイル使用メモリ 87,204 KB
実行使用メモリ 258,188 KB
最終ジャッジ日時 2023-08-31 02:02:48
合計ジャッジ時間 17,672 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,144 KB
testcase_01 AC 72 ms
70,988 KB
testcase_02 AC 73 ms
71,316 KB
testcase_03 AC 72 ms
71,140 KB
testcase_04 AC 74 ms
71,012 KB
testcase_05 AC 670 ms
77,384 KB
testcase_06 AC 79 ms
76,624 KB
testcase_07 AC 2,052 ms
87,272 KB
testcase_08 AC 2,391 ms
258,188 KB
testcase_09 AC 2,372 ms
87,044 KB
testcase_10 AC 75 ms
71,160 KB
testcase_11 AC 75 ms
71,028 KB
testcase_12 AC 73 ms
71,324 KB
testcase_13 AC 73 ms
71,024 KB
testcase_14 AC 74 ms
71,260 KB
testcase_15 AC 817 ms
77,868 KB
testcase_16 AC 1,231 ms
80,064 KB
testcase_17 AC 335 ms
78,160 KB
testcase_18 AC 2,029 ms
86,596 KB
testcase_19 AC 217 ms
78,360 KB
testcase_20 AC 1,250 ms
78,300 KB
testcase_21 AC 72 ms
71,264 KB
testcase_22 AC 193 ms
77,560 KB
testcase_23 AC 107 ms
77,612 KB
testcase_24 AC 107 ms
77,408 KB
testcase_25 AC 109 ms
77,548 KB
testcase_26 AC 121 ms
77,144 KB
testcase_27 AC 139 ms
77,484 KB
testcase_28 AC 119 ms
77,584 KB
testcase_29 AC 170 ms
77,968 KB
testcase_30 AC 140 ms
78,296 KB
testcase_31 AC 78 ms
75,636 KB
権限があれば一括ダウンロードができます

ソースコード

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
	else:X,c=X+[c//3],s=="c"
D=[0]+[-N]*N
L=1
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],(x-A*j)//B+D[i-j])
print(max([[0,i+min(i,D[i])][D[i]>i-2]for i in R(L)]))
0