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 |
---|---|---|---|---|---|---|
1852 | Codeforces Round 887 (Div. 1) | FINISHED | False | 9000 | 41700299 | July 23, 2023, 2:35 p.m. |
Solved$ |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
---|---|---|---|---|---|---|
( 482 ) | D | Miriany and Matchstick | PROGRAMMING | constructive algorithms dp greedy |
B'Miriany 's matchstick is a 2 x n grid that needs to be filled with characters A or B. He has already filled in the first row of the grid and would like you to fill in the second row. You must do so in a way such that the number of adjacent pairs of cells with different characters ^ dagger is equal to k . If it is impossible, report so. ^ dagger An adjacent pair of cells with different characters is a pair of cells (r_1, c_1) and (r_2, c_2) ( 1 <= r_1, r_2 <= 2 , 1 <= c_1, c_2 <= n ) such that |r_1 - r_2| + |c_1 - c_2| = 1 and the characters in (r_1, c_1) and (r_2, c_2) are different. The first line consists of an integer t , the number of test cases ( 1 <= q t <= q 1000 ). The description of the test cases follows. The first line of each test case has two integers, n and k ( 1 <= q n <= q 2 cdot 10^5, 0 <= q k <= q 3 cdot n ) xe2 x80 x93 the number of columns of the matchstick, and the number of adjacent pairs of cells with different characters required. The following line contains string s of n characters ( s_i is either A or B) xe2 x80 x93 Miriany 's top row of the matchstick. It is guaranteed that the sum of n over all test cases does not exceed 2 cdot 10^5 . For each test case, if there is no way to fill the second row with the number of adjacent pairs of cells with different characters equals k , output "NO". Otherwise, output "YES". Then, print n characters that a valid bottom row for Miriany 's matchstick consists of. If there are several answers, output any of them. In the first test case, it can be proved that there exists no possible way to fill in row 2 of the grid such that k = 1 . For the second test case, BABB is one possible answer. The grid below is the result of filling in BABB as the second row. The pairs of different characters are shown below in red: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- '... |
Codeforces Round 887 (Div 1, Div 2) Tutorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
---|---|---|---|---|---|---|---|---|---|---|---|
215238896 | PEIMUDA | D | July 23, 2023, 4:17 p.m. | OK | GNU C++14 | TESTS | 52 | 31 | 6963200 | ||
215244333 | _lbw_ | D | July 23, 2023, 4:38 p.m. | OK | GNU C++14 | TESTS | 52 | 62 | 40550400 | ||
215241833 | lexiyvv | D | July 23, 2023, 4:28 p.m. | OK | GNU C++14 | TESTS | 52 | 78 | 4812800 | ||
215257568 | omeganot | D | July 23, 2023, 6:05 p.m. | OK | GNU C++14 | TESTS | 52 | 139 | 22220800 | ||
215254458 | SPatrik | D | July 23, 2023, 5:46 p.m. | OK | GNU C++17 | TESTS | 52 | 31 | 7168000 | ||
215251546 | foammm | D | July 23, 2023, 5:04 p.m. | OK | GNU C++17 | TESTS | 52 | 31 | 74137600 | ||
215241752 | tokusakurai | D | July 23, 2023, 4:28 p.m. | OK | GNU C++17 | TESTS | 52 | 46 | 8908800 | ||
215261915 | liympanda | D | July 23, 2023, 6:44 p.m. | OK | GNU C++17 | TESTS | 52 | 93 | 16588800 | ||
215289875 | Licha06 | D | July 24, 2023, 2:25 a.m. | OK | GNU C++17 | TESTS | 52 | 93 | 34099200 | ||
215290472 | zas111lll | D | July 24, 2023, 2:32 a.m. | OK | GNU C++17 | TESTS | 52 | 171 | 15360000 | ||
215245029 | yuto1115 | D | July 23, 2023, 4:41 p.m. | OK | GNU C++17 | TESTS | 52 | 217 | 17510400 | ||
215242725 | alireza_kaviani | D | July 23, 2023, 4:32 p.m. | OK | GNU C++17 | TESTS | 52 | 265 | 69939200 | ||
215251536 | Morphymorphymorphy | D | July 23, 2023, 5:04 p.m. | OK | GNU C++17 | TESTS | 52 | 280 | 58675200 | ||
215244331 | krismaz | D | July 23, 2023, 4:38 p.m. | OK | GNU C++17 | TESTS | 52 | 498 | 13824000 | ||
215248140 | kotatsugame | D | July 23, 2023, 4:53 p.m. | OK | GNU C++17 (64) | TESTS | 52 | 15 | 512000 | ||
215258421 | PurpleCrayon | D | July 23, 2023, 6:12 p.m. | OK | GNU C++17 (64) | TESTS | 52 | 31 | 921600 | ||
215218775 | amiya | D | July 23, 2023, 3:19 p.m. | OK | GNU C++17 (64) | TESTS | 52 | 31 | 7065600 | ||
215215857 | MAOooOAM | D | July 23, 2023, 3:12 p.m. | OK | GNU C++17 (64) | TESTS | 52 | 46 | 6963200 | ||
215249944 | Xellos | D | July 23, 2023, 4:59 p.m. | OK | GNU C++17 (64) | TESTS | 52 | 62 | 5529600 | ||
215232390 | ainta | D | July 23, 2023, 3:56 p.m. | OK | GNU C++17 (64) | TESTS | 52 | 62 | 12390400 | ||
215224092 | EternalAlexander | D | July 23, 2023, 3:32 p.m. | OK | GNU C++17 (64) | TESTS | 52 | 62 | 24678400 | ||
215228097 | stevenkplus | D | July 23, 2023, 3:43 p.m. | OK | GNU C++17 (64) | TESTS | 52 | 77 | 17817600 | ||
215242347 | hitonanode | D | July 23, 2023, 4:30 p.m. | OK | GNU C++17 (64) | TESTS | 52 | 109 | 2560000 | ||
215250174 | Geothermal | D | July 23, 2023, 5 p.m. | OK | GNU C++17 (64) | TESTS | 52 | 109 | 16793600 | ||
215260173 | Suiji_SUI | D | July 23, 2023, 6:27 p.m. | OK | GNU C++20 (64) | TESTS | 52 | 15 | 512000 | ||
215258407 | Suiji_SUI | D | July 23, 2023, 6:12 p.m. | OK | GNU C++20 (64) | TESTS | 52 | 15 | 512000 | ||
215255141 | null_awe | D | July 23, 2023, 5:49 p.m. | OK | GNU C++20 (64) | TESTS | 52 | 15 | 3174400 | ||
215261156 | Misono_Mika | D | July 23, 2023, 6:36 p.m. | OK | GNU C++20 (64) | TESTS | 52 | 31 | 512000 | ||
215259895 | Suiji_SUI | D | July 23, 2023, 6:25 p.m. | OK | GNU C++20 (64) | TESTS | 52 | 31 | 512000 | ||
215301755 | maxplus | D | July 24, 2023, 4:59 a.m. | OK | GNU C++20 (64) | TESTS | 52 | 31 | 5632000 | ||
215244853 | fallleaves07 | D | July 23, 2023, 4:40 p.m. | OK | GNU C++20 (64) | TESTS | 52 | 31 | 6963200 | ||
215236182 | jeroenodb | D | July 23, 2023, 4:08 p.m. | OK | GNU C++20 (64) | TESTS | 52 | 31 | 6963200 | ||
215269971 | _LeMur_ | D | July 23, 2023, 8:19 p.m. | OK | GNU C++20 (64) | TESTS | 52 | 31 | 7168000 | ||
215226731 | maspy | D | July 23, 2023, 3:39 p.m. | OK | GNU C++20 (64) | TESTS | 52 | 31 | 8089600 | ||
215255314 | conqueror_of_tourist | D | July 23, 2023, 5:50 p.m. | OK | PyPy 3-64 | TESTS | 52 | 327 | 32358400 | ||
215255475 | conqueror_of_tourist | D | July 23, 2023, 5:51 p.m. | OK | PyPy 3-64 | TESTS | 52 | 452 | 59289600 | ||
215226580 | conqueror_of_tourist | D | July 23, 2023, 3:38 p.m. | OK | PyPy 3-64 | TESTS | 52 | 530 | 58777600 |
Back to search problems