Solutions are presented as using the least memory and the fastest execution time. It also takes the top 10 most recent solutions from each language. If you want to limit to a specific index, click the "Solved" button and go to that problem.
ContestId |
Name |
Phase |
Frozen |
Duration (Seconds) |
Relative Time |
Start Time |
|---|---|---|---|---|---|---|
| 2172 | 2025 ICPC Asia Taichung Regional Contest (Unrated, Online Mirror, ICPC Rules, Preferably Teams) | FINISHED | False | 18000 | 13147823 | Nov. 16, 2025, 1:50 a.m. |
Solved |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
|---|---|---|---|---|---|---|
| ( 791 ) | L | Maximum Color Segment | PROGRAMMING | dp |
You are given a rope (n) units long, where each unit is painted either red or black. The rope can be represented as a string of length (n) consisting of characters R (red) and B (black). You are also given two integers (m) and (k). You may perform the following operation at most (m) times (possibly, zero times): Choose any contiguous substring(^{\text{∗}}) of the rope of length exactly (k). Flip the color of every unit in the substring: each R becomes B , and each B becomes R . For example, consider the rope RRRRBRRR with (k = 4). If you choose the (3)-rd to (6)-th characters ( RR RRBR RR ), then after flipping, the rope becomes RR BBRB RR . Define the number of color segments as the smallest number of contiguous segments into which the rope can be divided so that each segment consists of units of a single color. For instance, the rope RRBRRRBB has (4) color segments: RR , B , RRR , and BB . Your task is to determine the maximum possible number of color segments after performing at most (m) operations. (^{\text{∗}})A string (t) is a substring of a string (s) if (t) can be obtained from (s) by the deletion of several (possibly, zero or all) characters from the beginning and several (possibly, zero or all) characters from the end. The first line contains three integers (n), (m), and (k), representing the length of the rope, the maximum number of operations allowed, and the length of each operation's flip window, respectively. The second line contains a string of length (n) consisting only of the characters R and B , representing the initial content of the rope. (1 \le n \le 3000) (0 \le m \le 3000) (1 \le k \le n) Output an integer in a single line, representing the maximum possible number of color segments after performing at most (m) operations. |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 349205592 | johnny8337 mo_onrabbit2 as_dfsdf | L | Nov. 16, 2025, 4:45 a.m. | OK | C++17 (GCC 7-32) | TESTS | 42 | 61 | 8089600 | ||
| 349363531 | VaHiX | L | Nov. 17, 2025, 2:29 a.m. | OK | C++17 (GCC 7-32) | TESTS | 42 | 77 | 0 | ||
| 349207705 | nukkua zoryn | L | Nov. 16, 2025, 5:14 a.m. | OK | C++17 (GCC 7-32) | TESTS | 42 | 77 | 0 | ||
| 349374150 | daridius | L | Nov. 17, 2025, 4:53 a.m. | OK | C++17 (GCC 7-32) | TESTS | 42 | 139 | 68403200 | ||
| 349206232 | higgzboson thirddottyboi ShahJahan19 | L | Nov. 16, 2025, 4:54 a.m. | OK | C++17 (GCC 7-32) | TESTS | 42 | 140 | 0 | ||
| 349202360 | YipChip chllo777 Woxuanyi | L | Nov. 16, 2025, 4:02 a.m. | OK | C++17 (GCC 7-32) | TESTS | 42 | 140 | 72704000 | ||
| 349224451 | Namine | L | Nov. 16, 2025, 7:54 a.m. | OK | C++17 (GCC 7-32) | TESTS | 42 | 186 | 35328000 | ||
| 349217401 | iloveMT | L | Nov. 16, 2025, 6:48 a.m. | OK | C++17 (GCC 7-32) | TESTS | 42 | 202 | 307200 | ||
| 349238379 | Mingyee | L | Nov. 16, 2025, 10:08 a.m. | OK | C++17 (GCC 7-32) | TESTS | 42 | 265 | 0 | ||
| 349242014 | loser_lhd wjiay Lysea | L | Nov. 16, 2025, 10:43 a.m. | OK | C++17 (GCC 7-32) | TESTS | 42 | 359 | 72601600 | ||
| 349206341 | tabr | L | Nov. 16, 2025, 4:56 a.m. | OK | C++20 (GCC 13-64) | TESTS | 42 | 62 | 0 | ||
| 349208813 | tw20000807 | L | Nov. 16, 2025, 5:26 a.m. | OK | C++20 (GCC 13-64) | TESTS | 42 | 62 | 102400 | ||
| 349200275 | kotatsugame | L | Nov. 16, 2025, 3:39 a.m. | OK | C++20 (GCC 13-64) | TESTS | 42 | 62 | 102400 | ||
| 349220792 | 1121Jiang | L | Nov. 16, 2025, 7:21 a.m. | OK | C++20 (GCC 13-64) | TESTS | 42 | 62 | 204800 | ||
| 349220713 | 1121Jiang | L | Nov. 16, 2025, 7:20 a.m. | OK | C++20 (GCC 13-64) | TESTS | 42 | 62 | 204800 | ||
| 349196340 | Pika | L | Nov. 16, 2025, 2:51 a.m. | OK | C++20 (GCC 13-64) | TESTS | 42 | 77 | 0 | ||
| 349205014 | NguyenDangQuan _Fake4Fun ilovemymind | L | Nov. 16, 2025, 4:37 a.m. | OK | C++20 (GCC 13-64) | TESTS | 42 | 77 | 102400 | ||
| 349204121 | HuaJun limanjun feeder1 | L | Nov. 16, 2025, 4:25 a.m. | OK | C++20 (GCC 13-64) | TESTS | 42 | 77 | 102400 | ||
| 349216872 | aaronkim00 ssamt parkky | L | Nov. 16, 2025, 6:44 a.m. | OK | C++20 (GCC 13-64) | TESTS | 42 | 77 | 6860800 | ||
| 349223089 | Mango2011 | L | Nov. 16, 2025, 7:42 a.m. | OK | C++20 (GCC 13-64) | TESTS | 42 | 93 | 108646400 | ||
| 349226478 | ogenus | L | Nov. 16, 2025, 8:15 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 42 | 46 | 36249600 | ||
| 349197311 | kizen leinad2 platter | L | Nov. 16, 2025, 3:04 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 42 | 46 | 36249600 | ||
| 349212129 | TyroWhizz | L | Nov. 16, 2025, 6:01 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 42 | 62 | 0 | ||
| 349208318 | zer0-star comavius kenken714 | L | Nov. 16, 2025, 5:21 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 42 | 62 | 102400 | ||
| 349204900 | 415411 | L | Nov. 16, 2025, 4:35 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 42 | 62 | 102400 | ||
| 349195142 | qwerasdfzxcl imeimi Numbering | L | Nov. 16, 2025, 2:34 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 42 | 62 | 102400 | ||
| 349256720 | ogenus | L | Nov. 16, 2025, 12:27 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 42 | 62 | 36249600 | ||
| 349227510 | virtual_self. | L | Nov. 16, 2025, 8:25 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 42 | 77 | 0 | ||
| 349221179 | ILoveHuTaoZzz | L | Nov. 16, 2025, 7:25 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 42 | 77 | 0 | ||
| 349218634 | ponjuice | L | Nov. 16, 2025, 7 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 42 | 77 | 0 |
Back to search problems