結果
| 問題 |
No.2076 Concon Substrings (ConVersion)
|
| コンテスト | |
| ユーザー |
taiga0629kyopro
|
| 提出日時 | 2022-09-16 22:45:18 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 916 bytes |
| コンパイル時間 | 307 ms |
| コンパイル使用メモリ | 82,372 KB |
| 実行使用メモリ | 67,312 KB |
| 最終ジャッジ日時 | 2024-12-21 22:04:36 |
| 合計ジャッジ時間 | 3,002 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 12 WA * 16 |
ソースコード
n,a,b=map(int,input().split())
s=["#"]+list(input())
x=[]
l=1
nod=["o","n","c"]
while l<=n:
if s[l]!="c":l+=1
else:
r=l
while r<n:
d=(r-l)%3
if s[r+1]==nod[d]:
r+=1
else:
break
num=(r-l+1)//3
if num>0:x.append(num)
l=r+1
n=len(x)
if n==0:
print(0)
exit()
ans=0
for i in range(n):
num=x[i]//(a+b)
ans+=2*num
x[i]-=num*(a+b)
if a==b:
for i in range(n):
ans+=x[i]//a
print(ans)
elif a>b:
B=0
AB=0
for i in range(n):
if x[i]>=a:AB+=1
elif x[i]>=b:B+=1
if AB>=B:
ans+=AB+B
else:
ans+=AB*2
print(ans)
else:
A=0
AB=0
for i in range(n):
if x[i]>=b:AB+=1
elif x[i]>=a:A+=1
if AB>=A:
ans+=AB+A
elif AB+1==A:
ans+=AB+A
else:
ans+=2*AB+1
print(ans)
taiga0629kyopro