結果
問題 |
No.2076 Concon Substrings (ConVersion)
|
ユーザー |
![]() |
提出日時 | 2025-06-12 18:38:11 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 783 bytes |
コンパイル時間 | 182 ms |
コンパイル使用メモリ | 82,480 KB |
実行使用メモリ | 76,616 KB |
最終ジャッジ日時 | 2025-06-12 18:38:16 |
合計ジャッジ時間 | 2,858 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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)