結果
| 問題 | No.2076 Concon Substrings (ConVersion) |
| コンテスト | |
| ユーザー |
とりゐ
|
| 提出日時 | 2022-09-16 22:37:59 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 652 bytes |
| 記録 | |
| コンパイル時間 | 835 ms |
| コンパイル使用メモリ | 82,304 KB |
| 実行使用メモリ | 84,224 KB |
| 最終ジャッジ日時 | 2024-12-21 21:55:21 |
| 合計ジャッジ時間 | 10,405 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 21 RE * 7 |
ソースコード
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)
とりゐ