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 |
---|---|---|---|---|---|---|
1733 | Codeforces Round 821 (Div. 2) | FINISHED | False | 7200 | 68225099 | Sept. 19, 2022, 2:35 p.m. |
Solved$ |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
---|---|---|---|---|---|---|
( 4256 ) | D2 | Zero-One (Hard Version) | PROGRAMMING | dp greedy |
B"This is the hard version of this problem. In this version, n <= 5000 holds, and this version has no restriction between x and y . You can make hacks only if both versions of the problem are solved. You are given two binary strings a and b , both of length n . You can do the following operation any number of times (possibly zero). You have to find the minimum cost needed to make a equal to b or say there is no way to do so. The first line contains one integer t ( 1 <= t <= 1000 ) -- the number of test cases. Each test case consists of three lines. The first line of each test case contains three integers n , x , and y ( 5 <= n <= 5000 , 1 <= x, y <= 10^9 ) -- the length of the strings, and the costs per operation. The second line of each test case contains the string a of length n . The string only consists of digits 0 and 1 . The third line of each test case contains the string b of length n . The string only consists of digits 0 and 1 . It is guaranteed that the sum of n over all test cases doesn't exceed 5000 . For each test case, if there is no way to make a equal to b , print -1 . Otherwise, print the minimum cost needed to make a equal to b . In the first test case, selecting indices 2 and 3 costs 8 , which is the minimum. In the second test case, we can perform the following operations. The total cost is 10 . In the third test case, we cannot make a equal to b using any number of operations. In the fourth test case, we can perform the following operations. The total cost is 6 . In the fifth test case, we can perform the following operations. The total cost is 7 . In the sixth test case, we don't have to perform any operation. "... |
Codeforces Round #821 (Div. 2) Editorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
---|---|---|---|---|---|---|---|---|---|---|---|
172775556 | Tdyx | D2 | Sept. 20, 2022, 2:02 a.m. | OK | C# 8 | TESTS | 15 | 140 | 307200 | ||
172777152 | Write_Hape_Code | D2 | Sept. 20, 2022, 2:34 a.m. | OK | GNU C++14 | TESTS | 15 | 0 | 307200 | ||
172777650 | Contna | D2 | Sept. 20, 2022, 2:43 a.m. | OK | GNU C++14 | TESTS | 15 | 15 | 102400 | ||
172776579 | QQH | D2 | Sept. 20, 2022, 2:23 a.m. | OK | GNU C++14 | TESTS | 15 | 15 | 102400 | ||
172775097 | Kzos_017 | D2 | Sept. 20, 2022, 1:53 a.m. | OK | GNU C++14 | TESTS | 15 | 15 | 102400 | ||
172770477 | sckrt | D2 | Sept. 20, 2022, 12:10 a.m. | OK | GNU C++14 | TESTS | 15 | 15 | 102400 | ||
172756975 | Deft_t_t | D2 | Sept. 19, 2022, 7:17 p.m. | OK | GNU C++14 | TESTS | 15 | 15 | 102400 | ||
172756820 | Deft_t_t | D2 | Sept. 19, 2022, 7:15 p.m. | OK | GNU C++14 | TESTS | 15 | 15 | 102400 | ||
172754345 | Deft_t_t | D2 | Sept. 19, 2022, 6:47 p.m. | OK | GNU C++14 | TESTS | 15 | 15 | 102400 | ||
172752519 | Deft_t_t | D2 | Sept. 19, 2022, 6:27 p.m. | OK | GNU C++14 | TESTS | 15 | 15 | 102400 | ||
172744311 | Bob_Wang | D2 | Sept. 19, 2022, 5:20 p.m. | OK | GNU C++14 | TESTS | 15 | 15 | 102400 | ||
172784982 | Hizzl | D2 | Sept. 20, 2022, 4:55 a.m. | OK | GNU C++17 | TESTS | 15 | 0 | 204800 | ||
172780097 | lss_baby | D2 | Sept. 20, 2022, 3:28 a.m. | OK | GNU C++17 | TESTS | 15 | 0 | 204800 | ||
172755662 | roet | D2 | Sept. 19, 2022, 7:01 p.m. | OK | GNU C++17 | TESTS | 15 | 0 | 204800 | ||
172761449 | jeff252 | D2 | Sept. 19, 2022, 8:18 p.m. | OK | GNU C++17 | TESTS | 15 | 0 | 12185600 | ||
172781663 | wfd_zmz | D2 | Sept. 20, 2022, 3:57 a.m. | OK | GNU C++17 | TESTS | 15 | 15 | 102400 | ||
172779937 | nyaaaa | D2 | Sept. 20, 2022, 3:26 a.m. | OK | GNU C++17 | TESTS | 15 | 15 | 102400 | ||
172779390 | yu_xuan | D2 | Sept. 20, 2022, 3:16 a.m. | OK | GNU C++17 | TESTS | 15 | 15 | 102400 | ||
172775910 | wa_233 | D2 | Sept. 20, 2022, 2:09 a.m. | OK | GNU C++17 | TESTS | 15 | 15 | 102400 | ||
172775093 | micromilo | D2 | Sept. 20, 2022, 1:53 a.m. | OK | GNU C++17 | TESTS | 15 | 15 | 102400 | ||
172771849 | zhongzhou | D2 | Sept. 20, 2022, 12:44 a.m. | OK | GNU C++17 | TESTS | 15 | 15 | 102400 | ||
172780524 | NuclearWinter | D2 | Sept. 20, 2022, 3:36 a.m. | OK | GNU C++17 (64) | TESTS | 15 | 0 | 102400 | ||
172771613 | kongfang89 | D2 | Sept. 20, 2022, 12:40 a.m. | OK | GNU C++17 (64) | TESTS | 15 | 0 | 102400 | ||
172771713 | FangYifan | D2 | Sept. 20, 2022, 12:41 a.m. | OK | GNU C++17 (64) | TESTS | 15 | 0 | 3686400 | ||
172789300 | yuuuuuuu09 | D2 | Sept. 20, 2022, 5:56 a.m. | OK | GNU C++17 (64) | TESTS | 15 | 15 | 102400 | ||
172789040 | yaoveil | D2 | Sept. 20, 2022, 5:52 a.m. | OK | GNU C++17 (64) | TESTS | 15 | 15 | 102400 | ||
172788785 | yaoveil | D2 | Sept. 20, 2022, 5:49 a.m. | OK | GNU C++17 (64) | TESTS | 15 | 15 | 102400 | ||
172753318 | KevinyWu | D2 | Sept. 19, 2022, 6:36 p.m. | OK | GNU C++17 (64) | TESTS | 15 | 15 | 102400 | ||
172750976 | Geothermal | D2 | Sept. 19, 2022, 6:13 p.m. | OK | GNU C++17 (64) | TESTS | 15 | 15 | 102400 | ||
172749127 | drdilyor | D2 | Sept. 19, 2022, 5:57 p.m. | OK | GNU C++17 (64) | TESTS | 15 | 15 | 102400 | ||
172747339 | zjs22 | D2 | Sept. 19, 2022, 5:42 p.m. | OK | GNU C++17 (64) | TESTS | 15 | 15 | 102400 |
Back to search problems