結果

問題 No.2076 Concon Substrings (ConVersion)
ユーザー chineristACchineristAC
提出日時 2022-09-16 22:19:07
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 1,097 bytes
コンパイル時間 952 ms
コンパイル使用メモリ 87,272 KB
実行使用メモリ 260,740 KB
最終ジャッジ日時 2023-08-23 16:00:08
合計ジャッジ時間 34,929 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 105 ms
74,532 KB
testcase_01 AC 107 ms
74,336 KB
testcase_02 AC 107 ms
74,652 KB
testcase_03 AC 111 ms
74,480 KB
testcase_04 AC 110 ms
74,036 KB
testcase_05 AC 129 ms
79,684 KB
testcase_06 AC 113 ms
79,508 KB
testcase_07 TLE -
testcase_08 AC 3,952 ms
260,224 KB
testcase_09 TLE -
testcase_10 AC 112 ms
74,632 KB
testcase_11 AC 109 ms
74,496 KB
testcase_12 AC 110 ms
74,484 KB
testcase_13 AC 107 ms
74,344 KB
testcase_14 AC 109 ms
74,432 KB
testcase_15 AC 1,334 ms
124,232 KB
testcase_16 AC 1,863 ms
222,004 KB
testcase_17 AC 940 ms
202,332 KB
testcase_18 AC 3,992 ms
233,680 KB
testcase_19 AC 1,041 ms
260,320 KB
testcase_20 AC 2,742 ms
175,096 KB
testcase_21 AC 110 ms
74,612 KB
testcase_22 AC 581 ms
177,704 KB
testcase_23 AC 214 ms
82,112 KB
testcase_24 AC 283 ms
83,692 KB
testcase_25 AC 465 ms
260,428 KB
testcase_26 AC 218 ms
81,964 KB
testcase_27 AC 234 ms
81,772 KB
testcase_28 AC 450 ms
260,392 KB
testcase_29 AC 597 ms
222,384 KB
testcase_30 AC 664 ms
260,168 KB
testcase_31 AC 118 ms
79,524 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys,random,bisect
from collections import deque,defaultdict,Counter
from heapq import heapify,heappop,heappush
from itertools import cycle, permutations
from math import log,gcd

input = lambda :sys.stdin.readline().rstrip()
mi = lambda :map(int,input().split())
li = lambda :list(mi())

N,X,Y = mi()
S = input()

A = []
i = 0
while i < N:
    if S[i:i+3]=="con":
        a = 1
        j = i+3
        while j+2 < len(S):
            if S[j:j+3]=="con":
                a += 1
                j += 3
            else:
                break
        A.append(a)
        i = j
    else:
        i += 1

res = 0
dp = [-1] * ((N//3)*2+10)
dp[0] = 0
for a in A:
    ndp = [-1] * ((N//3)*2)
    for s in range(-N//3,N//3+1):
        if dp[s] == -1:
            continue
        t = dp[s]
        for k in range(a//X+1):
            x = k
            y = (a-k*X)//Y
            ndp[s+x-y] = max(ndp[s+x-y],t+x+y)
    dp = ndp

for s in range(-N//3,2):
    if dp[s]!=-1:
        if s <= 0:
            tmp = dp[s] + s
        else:
            tmp = dp[s]
        res = max(res,tmp)

print(res)




0