結果

問題 No.2076 Concon Substrings (ConVersion)
ユーザー とりゐとりゐ
提出日時 2022-09-16 22:37:59
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 652 bytes
コンパイル時間 1,272 ms
コンパイル使用メモリ 86,780 KB
実行使用メモリ 87,260 KB
最終ジャッジ日時 2023-08-23 16:13:37
合計ジャッジ時間 11,889 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
71,300 KB
testcase_01 AC 66 ms
71,260 KB
testcase_02 AC 69 ms
71,328 KB
testcase_03 AC 68 ms
71,380 KB
testcase_04 AC 69 ms
71,324 KB
testcase_05 AC 87 ms
76,596 KB
testcase_06 AC 78 ms
76,056 KB
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 AC 67 ms
71,248 KB
testcase_11 AC 67 ms
71,200 KB
testcase_12 AC 67 ms
71,148 KB
testcase_13 AC 67 ms
71,352 KB
testcase_14 AC 66 ms
71,220 KB
testcase_15 RE -
testcase_16 AC 525 ms
80,700 KB
testcase_17 AC 292 ms
78,972 KB
testcase_18 RE -
testcase_19 AC 202 ms
79,776 KB
testcase_20 RE -
testcase_21 AC 67 ms
71,152 KB
testcase_22 AC 162 ms
78,196 KB
testcase_23 AC 101 ms
77,072 KB
testcase_24 AC 111 ms
77,536 KB
testcase_25 AC 118 ms
78,008 KB
testcase_26 AC 106 ms
77,304 KB
testcase_27 RE -
testcase_28 AC 119 ms
77,560 KB
testcase_29 AC 152 ms
78,080 KB
testcase_30 AC 161 ms
78,656 KB
testcase_31 AC 78 ms
76,256 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,a,b=map(int,input().split())
s=input()

c=[]
for i in s:
  c.append(i)
  if len(c)>=3 and c[-3]+c[-2]+c[-1]=='con':
    c.pop()
    c.pop()
    c.pop()
    c.append('!')

c.append('a')
d=[]
tmp=0
for i in c:
  if i=='!':
    tmp+=1
  else:
    if tmp!=0:
      d.append(tmp)
    tmp=0

m=n//3+10
dp=[-10**9]*m
dp[0]=0
mx=0
for i in d:
  ndp=dp.copy()
  tmp=0
  while True:
    c1=tmp
    c2=(i-a*tmp)//b
    if c2<0:
      break
    for j in range(mx+1):
      ndp[j+c1]=max(ndp[j+c1],dp[j]+c2)
    tmp+=1
  mx+=c1
  dp=ndp

ans=0
#print(dp)
for i in range(1,m):
  if dp[i]>=i-1:
    ans=max(2*i-1,ans)
  if dp[i]>=i:
    ans=max(ans,2*i)

print(ans)
0