MemSQL Start[c]UP 3.0 - Round 2 (onsite finalists)

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
865 MemSQL Start[c]UP 3.0 - Round 2 (onsite finalists) FINISHED False 10800 269700885 Sept. 30, 2017, 5:05 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 81 ) F Egg Roulette PROGRAMMING bitmasks brute force divide and conquer math meet-in-the-middle 3300

The game of Egg Roulette is played between two players. Initially 2 R raw eggs and 2 C cooked eggs are placed randomly into a carton. The shells are left on so there is no way to distinguish a raw egg from a cooked egg. One at a time, a player will select an egg, and then smash the egg on his/her forehead. If the egg was cooked, not much happens, but if the egg was raw, it will make quite the mess. This continues until one player has broken R raw eggs, at which point that player is declared the loser and the other player wins. The order in which players take turns can be described as a string of ' A ' and ' B ' characters, where the i -th character tells which player should choose the i -th egg. Traditionally, players take turns going one after the other. That is, they follow the ordering " ABABAB... ". This isn't very fair though, because the second player will win more often than the first. We'd like you to find a better ordering for the players to take their turns. Let's define the unfairness of an ordering as the absolute difference between the first player's win probability and the second player's win probability. We're interested in orderings that minimize the unfairness. We only consider an ordering valid if it contains the same number of ' A 's as ' B 's. You will also be given a string S of length 2( R + C ) containing only ' A ', ' B ', and ' ? ' characters. An ordering is said to match S if it only differs from S in positions where S contains a ' ? '. Of the valid orderings that minimize unfairness, how many match S ? The first line of input will contain integers R and C (1 ≤ R , C ≤ 20, R + C ≤ 30) . The second line of input will contain the string S of length 2( R + C ) consisting only of characters ' A ', ' B ', ' ? '. Print the number of valid orderings that minimize unfairness and match S . In the first test case, the minimum unfairness is 0 , and the orderings that achieve it are " ABBA " and " BAAB ", neither of which match S . Note that

Tutorials

MemSQL Start[c]UP 3.0 Round 2 Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
35575577 027-21714-ERALY-8 F Feb. 22, 2018, 2:29 p.m. OK GNU C++ TESTS 52 15 7475200 3300
32674262 sadiaanjum F Nov. 26, 2017, 2:51 p.m. OK GNU C++ TESTS 52 15 7475200 3300
30914233 scott_wu F Oct. 1, 2017, 4:43 p.m. OK GNU C++ TESTS 52 46 5120000 3300
30948087 krijgertje F Oct. 2, 2017, 4:21 p.m. OK GNU C++11 TESTS 52 15 614400 3300
31471007 zhamaliddinkalzhan F Oct. 18, 2017, 6:53 a.m. OK GNU C++11 TESTS 52 30 7475200 3300
57872986 lopare F July 28, 2019, 3:14 a.m. OK GNU C++11 TESTS 52 31 512000 3300
57768920 py_ultron F July 25, 2019, 10:44 p.m. OK GNU C++11 TESTS 52 31 512000 3300
34303095 zhouyuyang F Jan. 19, 2018, 1:03 p.m. OK GNU C++11 TESTS 52 31 2560000 3300
40979607 ReaLNero1 F July 30, 2018, 5:09 p.m. OK GNU C++11 TESTS 52 31 5427200 3300
31891306 varajey F Oct. 30, 2017, 11:20 a.m. OK GNU C++11 TESTS 52 31 5427200 3300
34535572 riverwalk7 F Jan. 25, 2018, 4:42 a.m. OK GNU C++14 TESTS 52 15 7475200 3300
53716347 Alexvov4871 F May 3, 2019, 7:14 p.m. OK GNU C++14 TESTS 52 31 5529600 3300
30987983 Los_Angelos_Laycurse F Oct. 4, 2017, 9:09 a.m. OK GNU C++14 TESTS 52 31 46182400 3300
47490922 Shayan.P F Dec. 25, 2018, 12:04 p.m. OK GNU C++17 TESTS 52 2339 260608000 3300

remove filters

Back to search problems