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.
Problems
B"Currently, XXOC's rap is a string consisting of zeroes, ones, and question marks. Unfortunately, haters gonna hate. They will write x angry comments for every occurrence of subsequence 01 and y angry comments for every occurrence of subsequence 10. You should replace all the question marks with 0 or 1 in such a way that the number of angry comments would be as small as possible. String b is a subsequence of string a , if it can be obtained by removing some characters from a . Two occurrences of a subsequence are considered distinct if sets of positions of remaining characters are distinct. The first line contains string s -- XXOC's rap ( 1 <= |s| <= q 10^5 ). The second line contains two integers x and y -- the number of angry comments XXOC will recieve for every occurrence of 01 and 10 accordingly ( 0 <= q x, y <= q 10^6 ). Output a single integer -- the minimum number of angry comments. In the first example one of the optimum ways to replace is 001. Then there will be 2 subsequences 01 and 0 subsequences 10. Total number of angry comments will be equal to 2 cdot 2 + 0 cdot 3 = 4 . In the second example one of the optimum ways to replace is 11111. Then there will be 0 subsequences 01 and 0 subsequences 10. Total number of angry comments will be equal to 0 cdot 13 + 0 cdot 37 = 0 . In the third example one of the optimum ways to replace is 1100. Then there will be 0 subsequences 01 and 4 subsequences 10. Total number of angry comments will be equal to 0 cdot 239 + 4 cdot 7 = 28 . In the fourth example one of the optimum ways to replace is 01101001. Then there will be 8 subsequences 01 and 8 subsequences 10. Total number of angry comments will be equal to 8 cdot 5 + 8 cdot 7 = 96 . "... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
101929783 |
GSHgsh |
D |
Dec. 21, 2020, 4:47 a.m. |
OK |
GNU C++11 |
TESTS |
47 |
46 |
204800 |
|
|
101913560 |
mostyka |
D |
Dec. 20, 2020, 7:18 p.m. |
OK |
GNU C++11 |
TESTS |
47 |
46 |
2662400 |
|
|
101924738 |
felipe.fcw |
D |
Dec. 21, 2020, 2:12 a.m. |
OK |
GNU C++14 |
TESTS |
47 |
46 |
716800 |
|
|
101926748 |
sam721 |
D |
Dec. 21, 2020, 3:27 a.m. |
OK |
GNU C++17 |
TESTS |
47 |
31 |
204800 |
|
|
101925826 |
dhkang01 |
D |
Dec. 21, 2020, 2:57 a.m. |
OK |
GNU C++17 |
TESTS |
47 |
31 |
307200 |
|
|
101878186 |
almogwald |
D |
Dec. 20, 2020, 3:36 p.m. |
OK |
GNU C++17 |
TESTS |
47 |
31 |
307200 |
|
|
101912358 |
vlvovch |
D |
Dec. 20, 2020, 6:58 p.m. |
OK |
GNU C++17 |
TESTS |
47 |
31 |
1126400 |
|
|
101887590 |
IIeJlMeHb |
D |
Dec. 20, 2020, 4:07 p.m. |
OK |
GNU C++17 |
TESTS |
47 |
31 |
2252800 |
|
|
101920698 |
MaTb3aa |
D |
Dec. 20, 2020, 10:37 p.m. |
OK |
GNU C++17 |
TESTS |
47 |
31 |
2662400 |
|
|
101914314 |
Manas_Gupta_813 |
D |
Dec. 20, 2020, 7:32 p.m. |
OK |
GNU C++17 |
TESTS |
47 |
46 |
307200 |
|
|
101910138 |
spaceleo |
D |
Dec. 20, 2020, 6:26 p.m. |
OK |
GNU C++17 |
TESTS |
47 |
46 |
1843200 |
|
|
101927489 |
vjudge3 |
D |
Dec. 21, 2020, 3:49 a.m. |
OK |
GNU C++17 |
TESTS |
47 |
46 |
3481600 |
|
|
101912375 |
zeus_orz1 |
D |
Dec. 20, 2020, 6:58 p.m. |
OK |
GNU C++17 |
TESTS |
47 |
46 |
3481600 |
|
|
101885942 |
Honey_Badger |
D |
Dec. 20, 2020, 4:02 p.m. |
OK |
GNU C++17 (64) |
TESTS |
47 |
31 |
4505600 |
|
|
101914510 |
tech_DeD |
D |
Dec. 20, 2020, 7:36 p.m. |
OK |
GNU C++17 (64) |
TESTS |
47 |
46 |
2457600 |
|
|
101920405 |
2020akadaver |
D |
Dec. 20, 2020, 10:22 p.m. |
OK |
Java 8 |
TESTS |
47 |
124 |
0 |
|
|
101919661 |
Scotty_pwnz |
D |
Dec. 20, 2020, 9:51 p.m. |
OK |
Kotlin |
TESTS |
47 |
187 |
7372800 |
|
|
101888799 |
serg3000 |
D |
Dec. 20, 2020, 4:11 p.m. |
OK |
MS C++ 2017 |
TESTS |
47 |
31 |
1843200 |
|
|
101913797 |
xDonaldDuckFTWx |
D |
Dec. 20, 2020, 7:22 p.m. |
OK |
PyPy 3 |
TESTS |
47 |
623 |
9523200 |
|
|
remove filters
Back to search problems