結果
| 問題 |
No.2076 Concon Substrings (ConVersion)
|
| コンテスト | |
| ユーザー |
gew1fw
|
| 提出日時 | 2025-06-12 13:22:39 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 783 bytes |
| コンパイル時間 | 171 ms |
| コンパイル使用メモリ | 82,600 KB |
| 実行使用メモリ | 77,000 KB |
| 最終ジャッジ日時 | 2025-06-12 13:25:57 |
| 合計ジャッジ時間 | 3,326 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 22 WA * 6 |
ソースコード
import bisect
n, A, B = map(int, input().split())
S = input().strip()
runs = []
i = 0
while i <= len(S) - 3:
if S[i] == 'c' and S[i+1] == 'o' and S[i+2] == 'n':
cnt = 0
while i <= len(S) - 3 and S[i] == 'c' and S[i+1] == 'o' and S[i+2] == 'n':
cnt += 1
i += 3
runs.append(cnt)
else:
i += 1
runs.sort()
count = 0
step = 1
current_runs = runs.copy()
while True:
if step % 2 == 1:
X = A
else:
X = B
idx = bisect.bisect_left(current_runs, X)
if idx < len(current_runs):
run = current_runs.pop(idx)
remaining = run - X
if remaining > 0:
bisect.insort(current_runs, remaining)
count += 1
step += 1
else:
break
print(count)
gew1fw