diff_sorted_id
stringclasses 105
values | problem_statement
stringlengths 778
1.74k
| problem_type
stringclasses 11
values | problem_category
stringclasses 5
values | relative_diff_score
stringclasses 35
values | opt_solution
stringlengths 24
474
| opt_solution_cost
stringlengths 1
4
| opt_solution_compute_t
stringlengths 14
20
| solution_depth
stringclasses 40
values | max_successor_states
stringclasses 51
values | num_vars_per_state
stringclasses 47
values | is_feasible_args
stringlengths 43
1.24k
| is_correct_args
stringlengths 43
1.26k
| A*_args
stringlengths 46
1.27k
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
19 | We have a map of cities, each represented by a letter, and they are connected by one-way roads. The adjacency matrix below shows the connections between the cities. Each row and column represents a city, and a '1' signifies a direct road from the city of the row to the city of the column. The travel time between any two directly connected cities is the same. Currently, we are located in city 'E'. Our task is to visit city Y and city T excatly twice. Determine the quickest route that allows us to visit both these destination cities, ensuring that we stop at the two destinations twice on our path. The sequence in which we visit the destination cities is not important. However, apart from T and Y, we can only visit each city once on our path. Provide the solution as a list of the city names on our path, including the start, in Python syntax.
J X U I R T Y B M D E
J 0 0 0 1 1 0 0 0 1 1 0
X 0 0 0 0 1 1 0 0 0 0 0
U 1 1 0 0 0 1 0 1 0 0 1
I 0 0 1 0 0 0 0 0 0 0 0
R 0 0 0 1 0 0 1 0 1 0 0
T 1 0 0 1 0 0 0 1 0 0 0
Y 0 0 0 1 0 1 0 0 0 1 0
B 0 1 0 0 1 0 0 0 0 0 1
M 0 0 0 1 0 0 1 0 0 0 0
D 0 1 0 0 1 0 0 0 0 0 1
E 1 1 0 1 0 0 0 0 1 0 0
| city_directed_graph | pathfinding | 11 | ["E", "M", "Y", "T", "B", "R", "Y", "T"] | 8 | 0.022693395614624023 | 8 | 11 | 14 | [[[0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0], [0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0], [1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1], [0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0], [1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0], [0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0], [0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1], [0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0], [0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1], [1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0]], ["J", "X", "U", "I", "R", "T", "Y", "B", "M", "D", "E"], "Y", "T"] | [[[0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0], [0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0], [1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1], [0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0], [1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0], [0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0], [0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1], [0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0], [0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1], [1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0]], ["J", "X", "U", "I", "R", "T", "Y", "B", "M", "D", "E"], "E", "Y", "T"] | ["[[0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0], [0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0], [1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1], [0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0], [1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0], [0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0], [0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1], [0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0], [0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1], [1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0]]", "['J', 'X', 'U', 'I', 'R', 'T', 'Y', 'B', 'M', 'D', 'E']", "['E']", "['Y', 'T']"] |
19 | In the 'taxed coin exchange' problem, you are required to choose a subset of coins from this list [9, 20, 4, 23, 10, 11, 8, 6, 20, 8, 20, 12, 15, 20, 18, 16, 19, 21, 5, 6, 4, 5, 14, 5, 4, 18, 22, 7, 8, 15, 5, 15, 8, 19, 14, 12, 2, 5, 5, 15, 2, 6, 10, 18, 14, 13, 8, 10, 21, 14, 5, 18, 16, 6, 11], such that the sum of the chosen coins adds up to 243. Each coin in the list is unique and can only be used once. Also coins carry a tax value. The tax values for each coin is {20: 3, 9: 2, 23: 1, 10: 3, 5: 4, 21: 14, 22: 5, 18: 7, 16: 4, 13: 5, 2: 1, 8: 2, 19: 16, 7: 3, 6: 6, 11: 3, 14: 8, 4: 2, 12: 7, 15: 14}, where the tax for coins of the same value is the same. Also, if the coin chosen is smaller than the previous one, it must have an even value, otherwise, if the coin is larger than or equal to the previous coin chosen, it must have an odd value. The objective is to determine which subset of coins should be selected to minimize the total tax paid. The solution should be presented as a list of numbers, representing the value of the coins chosen in order, with the first coins chosen being in index 0, formatted in Python syntax. | coin_exchange | subset_sum | 33 | [20, 23, 22, 20, 16, 8, 11, 10, 8, 11, 10, 8, 13, 10, 8, 4, 2, 9, 8, 4, 2, 7, 4, 5] | 63 | 0.05074810981750488 | 24 | 55 | 55 | [[9, 20, 4, 23, 10, 11, 8, 6, 20, 8, 20, 12, 15, 20, 18, 16, 19, 21, 5, 6, 4, 5, 14, 5, 4, 18, 22, 7, 8, 15, 5, 15, 8, 19, 14, 12, 2, 5, 5, 15, 2, 6, 10, 18, 14, 13, 8, 10, 21, 14, 5, 18, 16, 6, 11]] | [[9, 20, 4, 23, 10, 11, 8, 6, 20, 8, 20, 12, 15, 20, 18, 16, 19, 21, 5, 6, 4, 5, 14, 5, 4, 18, 22, 7, 8, 15, 5, 15, 8, 19, 14, 12, 2, 5, 5, 15, 2, 6, 10, 18, 14, 13, 8, 10, 21, 14, 5, 18, 16, 6, 11], {"20": 3, "9": 2, "23": 1, "10": 3, "5": 4, "21": 14, "22": 5, "18": 7, "16": 4, "13": 5, "2": 1, "8": 2, "19": 16, "7": 3, "6": 6, "11": 3, "14": 8, "4": 2, "12": 7, "15": 14}, 243] | ["[9, 20, 4, 23, 10, 11, 8, 6, 20, 8, 20, 12, 15, 20, 18, 16, 19, 21, 5, 6, 4, 5, 14, 5, 4, 18, 22, 7, 8, 15, 5, 15, 8, 19, 14, 12, 2, 5, 5, 15, 2, 6, 10, 18, 14, 13, 8, 10, 21, 14, 5, 18, 16, 6, 11]", "{20: 3, 9: 2, 23: 1, 10: 3, 5: 4, 21: 14, 22: 5, 18: 7, 16: 4, 13: 5, 2: 1, 8: 2, 19: 16, 7: 3, 6: 6, 11: 3, 14: 8, 4: 2, 12: 7, 15: 14}", "243"] |
19 | The game of 'Sort It' begins with 3 tubes, each filled with 4 balls of different colors. The goal is to sort the balls by color, with each tube containing balls of only one color. Only one ball can be moved at a time, taken from the top of one tube and placed on top of another. The capacity of each tube (maximum number of balls we can fit in each tube) is 6 balls. It is not allowed to place a ball in a tube that already has 6 balls. The solution should be a list of tuples, each containing, first, the index of the tube from which a ball is taken and, second, the index of the tube to which it is moved, indexing from 0. Given the initial state of the tubes, represented by the lists below (with the leftmost item being the color of the topmost ball in each tube), what is the shortest list of move tuples that will result in all the balls being correctly sorted? [['Blue', 'Green', 'Green', 'Red'], ['Red', 'Blue', 'Green', 'Red'], ['Blue', 'Red', 'Green', 'Blue']] | color_sorting | sorting | 7 | [[0, 1], [0, 2], [0, 2], [0, 1], [2, 0], [2, 0], [1, 0], [2, 1], [2, 0], [2, 0], [1, 2], [1, 2], [1, 0], [1, 2], [1, 2], [0, 1], [0, 2], [0, 1], [0, 1], [2, 0], [2, 0]] | 21 | 4.620145320892334 | 21 | 6 | 12 | [[["Blue", "Green", "Green", "Red"], ["Red", "Blue", "Green", "Red"], ["Blue", "Red", "Green", "Blue"]], 6] | [[["Blue", "Green", "Green", "Red"], ["Red", "Blue", "Green", "Red"], ["Blue", "Red", "Green", "Blue"]], 6] | ["[['Blue', 'Green', 'Green', 'Red'], ['Red', 'Blue', 'Green', 'Red'], ['Blue', 'Red', 'Green', 'Blue']]", "6"] |
19 | We have a 3x3 numerical grid, with numbers ranging from 48 to 91 (48 included in the range but 91 is not included). The numbers in each row and column must be strictly increasing or decreasing. This means that either first > second > third or first < second < third in each row and column. If a grid cell is marked with an 'x', the number in that position is hidden. The objective is to replace the 'x's with unique integers from the given range, ensuring that each number only appears once in the grid. The replacements must maintain the consecutive order in each row and column. Additionally, the sum of the numbers in the topmost row plus the numbers in the rightmost column plus the numbers in the diagonal connecting the top-left corner of the grid to its bottom-right corner should be minimized. The solution should be given as a list of tuples in Python syntax. Each tuple should represent the replacement of a number with an 'x' number and contain three elements: the row index of the 'x', the column index of the 'x' (both starting from 0), and the value of the number that replaces the 'x'. The initial state of the grid is as follows:
Grid:
[['x' 'x' '85']
['58' 'x' '84']
['x' '74' '59']] | consecutive_grid | underdetermined_system | 7 | [[0, 0, 48], [0, 1, 49], [1, 1, 60], [2, 0, 75]] | 577 | 0.17565202713012695 | 4 | 43 | 9 | ["[['', '', '85'], ['58', '', '84'], ['', '74', '59']]", 48, 91] | ["[['', '', '85'], ['58', '', '84'], ['', '74', '59']]", 48, 91] | ["[['', '', '85'], ['58', '', '84'], ['', '74', '59']]", "48", "91"] |
19 | In the magic square problem, a 3x3 grid is filled with unique integers ranging from 50 to 84. Some numbers are already given, while others are unknown and represented as 'x'. Sum of column 1 (counting from 0) must be 234, and sum of row 1 must be 201. Also, the sum of the numbers in the diagonal from the top right to the bottom left corner of the grid should equal 213. The goal is to find unique integers (ie each number can be in the final grid only once) in the given range to replace with ‘x’s in the grid below such that the sum of the specified rows, columns, and diagonal equals the given amounts and the sum of all of the numbers in the grid is as low as possible. The solution should be provided as a list of tuples in Python syntax. Each tuple should contain three numbers for each 'x' position: the row index, the column index (both starting from 0), and the value of the unique integer replaced with 'x' at that position.
Grid:
[['64' '78' 'x']
['x' 'x' 'x']
['x' 'x' 'x']] | magic_square | underdetermined_system | 6 | [[0, 2, 51], [1, 0, 52], [1, 1, 83], [1, 2, 66], [2, 0, 79], [2, 1, 73], [2, 2, 50]] | 596 | 7.28009295463562 | 7 | 29 | 9 | ["[['64', '78', ''], ['', '', ''], ['', '', '']]", 3, 50, 84] | ["[['64', '78', ''], ['', '', ''], ['', '', '']]", 50, 84, [1, 2], [1, 2], [234], [201], 213] | ["[['64', '78', ''], ['', '', ''], ['', '', '']]", "50", "84", "[None, 234, None]", "[None, 201, None]", "213"] |
19 | In 'Restricted Sorting', there are 6 stacks each with a capacity of 4 blocks, with 3 stacks filled with blocks of varying shades and the remaining are empty. The challenge is to sort the blocks by shade such that if a stack is not empty, it is stacked with 3 blocks of a single shade. The player can only transfer one block at a time from the top of a stack to an empty stack or to a stack that has only blocks of that shade, without exceeding the stacks’ capacity. Transferring blocks to certain stacks is more expensive than others. The cost of moving one block to the top of each stack is: {0: 2, 1: 4, 2: 6, 3: 6, 4: 6, 5: 7}, where the keys are the index of each stack, indexing from 0. The cost of moving a block is always at least 1. The solution should be a list of tuples, each containing, first, the index of the stack from which a block is picked up from and, second, the index of the stack to which it is transferred, indexing from 0. Given the initial state of the stacks, represented by the lists below (with the leftmost item being the shade of the topmost block in each stack)(and the first stack being the stack at index 0), what is the list of transfer pairs (reported in python syntax) with the least possible cost, that will result in all the blocks being correctly sorted? [[], [], ['Green', 'Blue', 'Green', 'Yellow'], [], ['Red', 'Red', 'Yellow', 'Blue'], ['Green', 'Red', 'Blue', 'Yellow']] | restricted_sorting | sorting | 1 | [[5, 0], [2, 0], [2, 1], [2, 0], [5, 3], [5, 1], [4, 3], [4, 3], [4, 2], [5, 2], [4, 1]] | 48 | 0.03397560119628906 | 11 | 30 | 12 | [[[], [], ["Green", "Blue", "Green", "Yellow"], [], ["Red", "Red", "Yellow", "Blue"], ["Green", "Red", "Blue", "Yellow"]], 4, {"0": 2, "1": 4, "2": 6, "3": 6, "4": 6, "5": 7}] | [[[], [], ["Green", "Blue", "Green", "Yellow"], [], ["Red", "Red", "Yellow", "Blue"], ["Green", "Red", "Blue", "Yellow"]], 4, {"0": 2, "1": 4, "2": 6, "3": 6, "4": 6, "5": 7}, 3] | ["[[], [], ['Green', 'Blue', 'Green', 'Yellow'], [], ['Red', 'Red', 'Yellow', 'Blue'], ['Green', 'Red', 'Blue', 'Yellow']]", "{0: 2, 1: 4, 2: 6, 3: 6, 4: 6, 5: 7}", "4", "3"] |
19 | Using the provided matrix map of a city, where numbers represent travel time in minutes (all numbers are positive integers) and 'x' marks closed workshops, find the quickest route for Ben to travel from his current workshop at index (5, 0) to his destination workshop at index (3, 9), indexing from 0. Ben's car can move north, south, east, or west from a given crossroad, provided there's no x in that direction. Also, there are 3 districts in the city with district 1 covering rows 0 to 3, district 2 covering rows 4 to 5, and district 3 covering rows 6 to 9. Ben has to visit at least 1 workshop in each district on his path to the destination. The roads are bidirectional. The answer should be a list of tuples (in Python syntax) indicating the index of workshops on Ben's path. The start and end workshops must be included in the path.
[x 16 15 14 2 12 3 x 7 7]
[11 x x x 4 10 5 x x x]
[12 x 3 x x 19 x 13 x x]
[16 15 13 x 12 x x 1 x 7]
[2 6 x 5 x 14 7 x 8 18]
[19 17 2 11 8 17 12 8 9 14]
[11 1 10 11 x x 19 6 2 18]
[7 x 10 15 x x x x 18 17]
[x 6 x x x 5 x 7 12 20]
[x x 2 15 x 17 x x 10 11] | traffic | pathfinding | 2 | [[5, 0], [6, 0], [6, 1], [6, 2], [5, 2], [5, 3], [5, 4], [5, 5], [5, 6], [5, 7], [5, 8], [4, 8], [4, 9], [3, 9]] | 122 | 0.027219295501708984 | 14 | 4 | 4 | [[["x", "16", "15", "14", "2", "12", "3", "x", "7", "7"], ["11", "x", "x", "x", "4", "10", "5", "x", "x", "x"], ["12", "x", "3", "x", "x", "19", "x", "13", "x", "x"], ["16", "15", "13", "x", "12", "x", "x", "1", "x", "7"], ["2", "6", "x", "5", "x", "14", "7", "x", "8", "18"], ["19", "17", "2", "11", "8", "17", "12", "8", "9", "14"], ["11", "1", "10", "11", "x", "x", "19", "6", "2", "18"], ["7", "x", "10", "15", "x", "x", "x", "x", "18", "17"], ["x", "6", "x", "x", "x", "5", "x", "7", "12", "20"], ["x", "x", "2", "15", "x", "17", "x", "x", "10", "11"]]] | [[["x", "16", "15", "14", "2", "12", "3", "x", "7", "7"], ["11", "x", "x", "x", "4", "10", "5", "x", "x", "x"], ["12", "x", "3", "x", "x", "19", "x", "13", "x", "x"], ["16", "15", "13", "x", "12", "x", "x", "1", "x", "7"], ["2", "6", "x", "5", "x", "14", "7", "x", "8", "18"], ["19", "17", "2", "11", "8", "17", "12", "8", "9", "14"], ["11", "1", "10", "11", "x", "x", "19", "6", "2", "18"], ["7", "x", "10", "15", "x", "x", "x", "x", "18", "17"], ["x", "6", "x", "x", "x", "5", "x", "7", "12", "20"], ["x", "x", "2", "15", "x", "17", "x", "x", "10", "11"]], [5, 0], [3, 9], 3, 5] | ["[['x', '16', '15', '14', '2', '12', '3', 'x', '7', '7'], ['11', 'x', 'x', 'x', '4', '10', '5', 'x', 'x', 'x'], ['12', 'x', '3', 'x', 'x', '19', 'x', '13', 'x', 'x'], ['16', '15', '13', 'x', '12', 'x', 'x', '1', 'x', '7'], ['2', '6', 'x', '5', 'x', '14', '7', 'x', '8', '18'], ['19', '17', '2', '11', '8', '17', '12', '8', '9', '14'], ['11', '1', '10', '11', 'x', 'x', '19', '6', '2', '18'], ['7', 'x', '10', '15', 'x', 'x', 'x', 'x', '18', '17'], ['x', '6', 'x', 'x', 'x', '5', 'x', '7', '12', '20'], ['x', 'x', '2', '15', 'x', '17', 'x', 'x', '10', '11']]", "(5, 0)", "(3, 9)", "3", "5"] |
19 | Alex is at a trampoline park with a grid of mini trampolines, arranged in a square of 10x10. Some trampolines are broken and unusable. A map of the park is provided below, with 1 indicating a broken trampoline and 0 indicating a functional one. Alex can jump to any of the eight adjacent trampolines, as long as they are not broken. However, Alex must make excatly 3 diagonal jumps, no more, no less, on his path to his destination. He is currently on the trampoline at position (1, 9) (positions are counted from 0, left to right, top to bottom) and wants to reach the trampoline at position (7, 1). What is the shortest sequence of trampolines he should jump on to reach his destination (including the first and final trampolines)? The answer should be a list of tuples, in Python syntax, indicating the row and column of each trampoline Alex jumps on.
1 0 1 1 0 0 0 0 0 1
0 0 0 0 0 1 0 0 0 0
0 1 1 0 0 1 0 0 0 1
0 0 1 0 1 1 0 0 1 1
1 0 1 1 1 0 1 0 1 1
1 0 1 1 1 1 1 1 1 1
0 0 0 1 1 0 0 1 1 1
1 0 1 1 1 0 1 1 1 0
1 1 1 1 1 1 0 1 1 0
1 1 1 0 1 0 1 0 1 1 | trampoline_matrix | pathfinding | 10 | [[1, 9], [1, 8], [1, 7], [1, 6], [0, 5], [0, 4], [1, 4], [1, 3], [1, 2], [1, 1], [2, 0], [3, 0], [4, 1], [5, 1], [6, 1], [7, 1]] | 16 | 0.029511690139770508 | 16 | 8 | 2 | ["[[1, 0, 1, 1, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 1, 0, 0, 0, 0], [0, 1, 1, 0, 0, 1, 0, 0, 0, 1], [0, 0, 1, 0, 1, 1, 0, 0, 1, 1], [1, 0, 1, 1, 1, 0, 1, 0, 1, 1], [1, 0, 1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 1, 1, 0, 0, 1, 1, 1], [1, 0, 1, 1, 1, 0, 1, 1, 1, 0], [1, 1, 1, 1, 1, 1, 0, 1, 1, 0], [1, 1, 1, 0, 1, 0, 1, 0, 1, 1]]", 3] | ["[[1, 0, 1, 1, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 1, 0, 0, 0, 0], [0, 1, 1, 0, 0, 1, 0, 0, 0, 1], [0, 0, 1, 0, 1, 1, 0, 0, 1, 1], [1, 0, 1, 1, 1, 0, 1, 0, 1, 1], [1, 0, 1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 1, 1, 0, 0, 1, 1, 1], [1, 0, 1, 1, 1, 0, 1, 1, 1, 0], [1, 1, 1, 1, 1, 1, 0, 1, 1, 0], [1, 1, 1, 0, 1, 0, 1, 0, 1, 1]]", [1, 9], [7, 1], 3] | ["[[1, 0, 1, 1, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 1, 0, 0, 0, 0], [0, 1, 1, 0, 0, 1, 0, 0, 0, 1], [0, 0, 1, 0, 1, 1, 0, 0, 1, 1], [1, 0, 1, 1, 1, 0, 1, 0, 1, 1], [1, 0, 1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 1, 1, 0, 0, 1, 1, 1], [1, 0, 1, 1, 1, 0, 1, 1, 1, 0], [1, 1, 1, 1, 1, 1, 0, 1, 1, 0], [1, 1, 1, 0, 1, 0, 1, 0, 1, 1]]", "(1, 9)", "(7, 1)", "3"] |
19 | Given 7 labeled water jugs with capacities 21, 62, 98, 143, 61, 110, 140, 40 liters, we aim to fill 3 unlabeled buckets, numbered 1 to 3 and arranged in a line in ascending order, with 280, 338, 353 liters of water respectively. The amount of water in each unlabeled bucket can not at any point in time exceed the amount of water in the bucket placed after it. Jugs can only be filled to the top and emptied completely, and the unlabeled buckets cannot be overfilled. An action, represented as a tuple ('+', X, Y) or ('-', X, Y), involves adding to or removing water from the unlabeled bucket numbered Y, using the jug with capacity X. Determine the shortest sequence of actions needed to fill the buckets as specified, and present the solution as a list of action tuples in Python syntax. | water_jug | subset_sum | 5 | [["+", 110, 3], ["+", 140, 3], ["-", 40, 3], ["+", 143, 3], ["+", 140, 2], ["+", 140, 2], ["-", 40, 2], ["+", 98, 2], ["+", 140, 1], ["+", 140, 1]] | 10 | 0.0442960262298584 | 10 | 48 | 3 | [[21, 62, 98, 143, 61, 110, 140, 40], [280, 338, 353]] | [[21, 62, 98, 143, 61, 110, 140, 40], [280, 338, 353]] | ["[21, 62, 98, 143, 61, 110, 140, 40]", "[280, 338, 353]"] |
20 | In the 8-puzzle game, you are given a grid with numbered square tiles arranged randomly and one tile missing. The goal is to arrange the tiles in descending order by sliding them into the empty space. The tiles can move in 4 directions: left, right, up, and down. Given the initial state of the puzzle below, where the empty spot is represented as “_”, provide the shortest list of tiles that need to be swapped with the empty spot to achieve the goal state. The goal state is when all tiles are in descending order, with the largest number in the top left corner, and the empty spot is in the bottom right corner. The solution should be a list of numbers in Python format, where each number represents the number on the tile that the empty spot is swapped with at each turn. Initial state of the puzzle: [[46, 50, 97], [92, 49, 99], [91, 25, '_']] | 8_puzzle | puzzle | 5 | [99, 49, 92, 91, 25, 99, 49, 92, 91, 46, 50, 91, 99, 25, 46, 50, 91, 99, 50, 91, 99, 97, 92, 49] | 24 | 0.10476183891296387 | 24 | 4 | 9 | [[[46, 50, 97], [92, 49, 99], [91, 25, "_"]]] | [[[46, 50, 97], [92, 49, 99], [91, 25, "_"]]] | ["[[46, 50, 97], [92, 49, 99], [91, 25, '_']]"] |
20 | In the game 'Sort the Chars', we are given a table of n by m dimensions. This table contains n words, each with m characters, except for the first word which has m - 1 characters. Each character is written on a separate tile. The objective of the game is to rearrange the characters such that row i spells the i-th word in the list, with the blank tile ('_') placed in the top left corner of the board in the end. We can rearrange the tiles by swapping the blank space with any of its 4 diagonal neighboring tiles. Given the list of words and initial state of the board below, where the black space is represented as '_', what is the shortest list of swap actions (reported in python syntax) that can sort the board into the given list of target words? The list must only include the 4 diagonal swap directions: up-right, down-right, up-left, or down-left, representing the direction in ehich the blank space was swpped in. Target words: snog, trema, mosur, awiwi The initial board: [['r', 's', 'w', 'o', 'g'], ['t', 'n', 'e', 'm', 'a'], ['m', 'o', '_', 'u', 's'], ['a', 'w', 'i', 'r', 'i']] | 8_puzzle_words | puzzle | 2 | ["down-left", "up-left", "up-right", "up-right", "down-right", "down-right", "down-left", "up-left", "up-left", "down-left", "down-right", "up-right", "up-right", "up-left", "down-left", "up-left"] | 16 | 0.2547872066497803 | 16 | 4 | 20 | [[["r", "s", "w", "o", "g"], ["t", "n", "e", "m", "a"], ["m", "o", "_", "u", "s"], ["a", "w", "i", "r", "i"]]] | [[["r", "s", "w", "o", "g"], ["t", "n", "e", "m", "a"], ["m", "o", "_", "u", "s"], ["a", "w", "i", "r", "i"]], ["snog", "trema", "mosur", "awiwi"]] | ["[['r', 's', 'w', 'o', 'g'], ['t', 'n', 'e', 'm', 'a'], ['m', 'o', '_', 'u', 's'], ['a', 'w', 'i', 'r', 'i']]", "['snog', 'trema', 'mosur', 'awiwi']"] |
20 | We have a map of cities, each represented by a letter, and they are connected by one-way roads. The adjacency matrix below shows the connections between the cities. Each row and column represents a city, and a '1' signifies a direct road from the city of the row to the city of the column. The travel time between any two directly connected cities is the same. Currently, we are located in city 'F'. Our task is to visit city N and city I excatly twice. Determine the quickest route that allows us to visit both these destination cities, ensuring that we stop at the two destinations twice on our path. The sequence in which we visit the destination cities is not important. However, apart from I and N, we can only visit each city once on our path. Provide the solution as a list of the city names on our path, including the start, in Python syntax.
F I Y R X Q M S C D N
F 0 0 0 0 0 0 0 0 0 1 0
I 0 0 0 1 0 0 0 0 0 0 0
Y 0 0 0 0 0 0 0 0 0 0 1
R 1 0 0 0 0 0 1 0 0 1 0
X 0 0 0 1 0 1 0 0 0 0 0
Q 0 1 0 0 0 0 1 0 0 0 0
M 1 0 0 1 1 0 0 0 0 0 1
S 1 1 0 0 1 1 0 0 0 0 0
C 0 1 1 1 0 0 0 1 0 0 0
D 0 0 1 0 1 0 1 0 0 0 0
N 0 0 0 0 1 0 0 0 1 0 0
| city_directed_graph | pathfinding | 11 | ["F", "D", "Y", "N", "C", "I", "R", "M", "N", "X", "Q", "I"] | 12 | 0.029342174530029297 | 12 | 11 | 14 | [[[0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0], [0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0], [0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0], [1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1], [1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0], [0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0], [0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0]], ["F", "I", "Y", "R", "X", "Q", "M", "S", "C", "D", "N"], "N", "I"] | [[[0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0], [0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0], [0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0], [1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1], [1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0], [0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0], [0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0]], ["F", "I", "Y", "R", "X", "Q", "M", "S", "C", "D", "N"], "F", "N", "I"] | ["[[0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0], [0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0], [0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0], [1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1], [1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0], [0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0], [0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0]]", "['F', 'I', 'Y', 'R', 'X', 'Q', 'M', 'S', 'C', 'D', 'N']", "['F']", "['N', 'I']"] |
20 | In the 'taxed coin exchange' problem, you are required to choose a subset of coins from this list [12, 15, 3, 24, 10, 18, 10, 20, 21, 17, 9, 8, 2, 11, 5, 5, 3, 8, 6, 12, 20, 22, 4, 5, 17, 5, 14, 10, 15, 8, 9, 22, 4, 7, 15, 16, 4, 2, 5, 9, 24, 23, 3, 7, 20, 9, 12, 10, 4, 4, 8, 24, 11, 20, 2, 15], such that the sum of the chosen coins adds up to 246. Each coin in the list is unique and can only be used once. Also coins carry a tax value. The tax values for each coin is {20: 14, 15: 15, 6: 1, 14: 1, 7: 2, 18: 5, 2: 1, 16: 5, 21: 9, 3: 3, 12: 3, 17: 10, 22: 4, 10: 9, 4: 3, 11: 1, 5: 1, 23: 13, 24: 4, 9: 9, 8: 4}, where the tax for coins of the same value is the same. Also, if the coin chosen is smaller than the previous one, it must have an even value, otherwise, if the coin is larger than or equal to the previous coin chosen, it must have an odd value. The objective is to determine which subset of coins should be selected to minimize the total tax paid. The solution should be presented as a list of numbers, representing the value of the coins chosen in order, with the first coins chosen being in index 0, formatted in Python syntax. | coin_exchange | subset_sum | 34 | [24, 22, 2, 5, 11, 2, 5, 11, 2, 5, 5, 5, 7, 6, 21, 16, 14, 12, 23, 22, 18, 8] | 65 | 0.05625104904174805 | 22 | 56 | 56 | [[12, 15, 3, 24, 10, 18, 10, 20, 21, 17, 9, 8, 2, 11, 5, 5, 3, 8, 6, 12, 20, 22, 4, 5, 17, 5, 14, 10, 15, 8, 9, 22, 4, 7, 15, 16, 4, 2, 5, 9, 24, 23, 3, 7, 20, 9, 12, 10, 4, 4, 8, 24, 11, 20, 2, 15]] | [[12, 15, 3, 24, 10, 18, 10, 20, 21, 17, 9, 8, 2, 11, 5, 5, 3, 8, 6, 12, 20, 22, 4, 5, 17, 5, 14, 10, 15, 8, 9, 22, 4, 7, 15, 16, 4, 2, 5, 9, 24, 23, 3, 7, 20, 9, 12, 10, 4, 4, 8, 24, 11, 20, 2, 15], {"20": 14, "15": 15, "6": 1, "14": 1, "7": 2, "18": 5, "2": 1, "16": 5, "21": 9, "3": 3, "12": 3, "17": 10, "22": 4, "10": 9, "4": 3, "11": 1, "5": 1, "23": 13, "24": 4, "9": 9, "8": 4}, 246] | ["[12, 15, 3, 24, 10, 18, 10, 20, 21, 17, 9, 8, 2, 11, 5, 5, 3, 8, 6, 12, 20, 22, 4, 5, 17, 5, 14, 10, 15, 8, 9, 22, 4, 7, 15, 16, 4, 2, 5, 9, 24, 23, 3, 7, 20, 9, 12, 10, 4, 4, 8, 24, 11, 20, 2, 15]", "{20: 14, 15: 15, 6: 1, 14: 1, 7: 2, 18: 5, 2: 1, 16: 5, 21: 9, 3: 3, 12: 3, 17: 10, 22: 4, 10: 9, 4: 3, 11: 1, 5: 1, 23: 13, 24: 4, 9: 9, 8: 4}", "246"] |
20 | The game of 'Sort It' begins with 3 tubes, each filled with 4 balls of different colors. The goal is to sort the balls by color, with each tube containing balls of only one color. Only one ball can be moved at a time, taken from the top of one tube and placed on top of another. The capacity of each tube (maximum number of balls we can fit in each tube) is 6 balls. It is not allowed to place a ball in a tube that already has 6 balls. The solution should be a list of tuples, each containing, first, the index of the tube from which a ball is taken and, second, the index of the tube to which it is moved, indexing from 0. Given the initial state of the tubes, represented by the lists below (with the leftmost item being the color of the topmost ball in each tube), what is the shortest list of move tuples that will result in all the balls being correctly sorted? [['Red', 'Red', 'Green', 'Blue'], ['Green', 'Green', 'Red', 'Green'], ['Blue', 'Blue', 'Red', 'Blue']] | color_sorting | sorting | 7 | [[1, 2], [1, 2], [1, 0], [2, 1], [2, 1], [2, 1], [2, 1], [2, 0], [2, 1], [0, 2], [0, 2], [0, 2], [0, 2], [0, 2], [1, 0], [1, 0], [1, 0], [2, 1]] | 18 | 1.1464557647705078 | 18 | 6 | 12 | [[["Red", "Red", "Green", "Blue"], ["Green", "Green", "Red", "Green"], ["Blue", "Blue", "Red", "Blue"]], 6] | [[["Red", "Red", "Green", "Blue"], ["Green", "Green", "Red", "Green"], ["Blue", "Blue", "Red", "Blue"]], 6] | ["[['Red', 'Red', 'Green', 'Blue'], ['Green', 'Green', 'Red', 'Green'], ['Blue', 'Blue', 'Red', 'Blue']]", "6"] |
20 | We have a 3x3 numerical grid, with numbers ranging from 48 to 91 (48 included in the range but 91 is not included). The numbers in each row and column must be strictly increasing or decreasing. This means that either first > second > third or first < second < third in each row and column. If a grid cell is marked with an 'x', the number in that position is hidden. The objective is to replace the 'x's with unique integers from the given range, ensuring that each number only appears once in the grid. The replacements must maintain the consecutive order in each row and column. Additionally, the sum of the numbers in the topmost row plus the numbers in the rightmost column plus the numbers in the diagonal connecting the top-left corner of the grid to its bottom-right corner should be minimized. The solution should be given as a list of tuples in Python syntax. Each tuple should represent the replacement of a number with an 'x' number and contain three elements: the row index of the 'x', the column index of the 'x' (both starting from 0), and the value of the number that replaces the 'x'. The initial state of the grid is as follows:
Grid:
[['80' 'x' 'x']
['56' 'x' '64']
['51' 'x' '76']] | consecutive_grid | underdetermined_system | 7 | [[0, 1, 49], [0, 2, 48], [1, 1, 57], [2, 1, 58]] | 578 | 0.17241978645324707 | 4 | 43 | 9 | ["[['80', '', ''], ['56', '', '64'], ['51', '', '76']]", 48, 91] | ["[['80', '', ''], ['56', '', '64'], ['51', '', '76']]", 48, 91] | ["[['80', '', ''], ['56', '', '64'], ['51', '', '76']]", "48", "91"] |
20 | In the magic square problem, a 3x3 grid is filled with unique integers ranging from 50 to 84. Some numbers are already given, while others are unknown and represented as 'x'. Sum of column 1 (counting from 0) must be 233, and sum of row 1 must be 207. Also, the sum of the numbers in the diagonal from the top right to the bottom left corner of the grid should equal 185. The goal is to find unique integers (ie each number can be in the final grid only once) in the given range to replace with ‘x’s in the grid below such that the sum of the specified rows, columns, and diagonal equals the given amounts and the sum of all of the numbers in the grid is as low as possible. The solution should be provided as a list of tuples in Python syntax. Each tuple should contain three numbers for each 'x' position: the row index, the column index (both starting from 0), and the value of the unique integer replaced with 'x' at that position.
Grid:
[['62' '82' 'x']
['x' 'x' 'x']
['x' 'x' 'x']] | magic_square | underdetermined_system | 6 | [[0, 2, 50], [1, 0, 53], [1, 1, 83], [1, 2, 71], [2, 0, 52], [2, 1, 68], [2, 2, 51]] | 572 | 3.969967842102051 | 7 | 29 | 9 | ["[['62', '82', ''], ['', '', ''], ['', '', '']]", 3, 50, 84] | ["[['62', '82', ''], ['', '', ''], ['', '', '']]", 50, 84, [1, 2], [1, 2], [233], [207], 185] | ["[['62', '82', ''], ['', '', ''], ['', '', '']]", "50", "84", "[None, 233, None]", "[None, 207, None]", "185"] |
20 | In 'Restricted Sorting', there are 6 stacks each with a capacity of 4 blocks, with 3 stacks filled with blocks of varying shades and the remaining are empty. The challenge is to sort the blocks by shade such that if a stack is not empty, it is stacked with 3 blocks of a single shade. The player can only transfer one block at a time from the top of a stack to an empty stack or to a stack that has only blocks of that shade, without exceeding the stacks’ capacity. Transferring blocks to certain stacks is more expensive than others. The cost of moving one block to the top of each stack is: {0: 4, 1: 2, 2: 5, 3: 2, 4: 4, 5: 1}, where the keys are the index of each stack, indexing from 0. The cost of moving a block is always at least 1. The solution should be a list of tuples, each containing, first, the index of the stack from which a block is picked up from and, second, the index of the stack to which it is transferred, indexing from 0. Given the initial state of the stacks, represented by the lists below (with the leftmost item being the shade of the topmost block in each stack)(and the first stack being the stack at index 0), what is the list of transfer pairs (reported in python syntax) with the least possible cost, that will result in all the blocks being correctly sorted? [[], ['Green', 'Red', 'Yellow', 'Blue'], [], ['Red', 'Blue', 'Yellow', 'Green'], ['Red', 'Yellow', 'Blue', 'Green'], []] | restricted_sorting | sorting | 1 | [[1, 2], [1, 0], [3, 0], [4, 0], [1, 5], [3, 1], [4, 5], [4, 1], [3, 5], [2, 3], [4, 3]] | 28 | 0.036955833435058594 | 11 | 30 | 12 | [[[], ["Green", "Red", "Yellow", "Blue"], [], ["Red", "Blue", "Yellow", "Green"], ["Red", "Yellow", "Blue", "Green"], []], 4, {"0": 4, "1": 2, "2": 5, "3": 2, "4": 4, "5": 1}] | [[[], ["Green", "Red", "Yellow", "Blue"], [], ["Red", "Blue", "Yellow", "Green"], ["Red", "Yellow", "Blue", "Green"], []], 4, {"0": 4, "1": 2, "2": 5, "3": 2, "4": 4, "5": 1}, 3] | ["[[], ['Green', 'Red', 'Yellow', 'Blue'], [], ['Red', 'Blue', 'Yellow', 'Green'], ['Red', 'Yellow', 'Blue', 'Green'], []]", "{0: 4, 1: 2, 2: 5, 3: 2, 4: 4, 5: 1}", "4", "3"] |
20 | Using the provided matrix map of a city, where numbers represent travel time in minutes (all numbers are positive integers) and 'x' marks closed workshops, find the quickest route for Ben to travel from his current workshop at index (6, 0) to his destination workshop at index (4, 9), indexing from 0. Ben's car can move north, south, east, or west from a given crossroad, provided there's no x in that direction. Also, there are 3 districts in the city with district 1 covering rows 0 to 3, district 2 covering rows 4 to 5, and district 3 covering rows 6 to 9. Ben has to visit at least 1 workshop in each district on his path to the destination. The roads are bidirectional. The answer should be a list of tuples (in Python syntax) indicating the index of workshops on Ben's path. The start and end workshops must be included in the path.
[19 x 7 x 12 x 15 5 19 14]
[17 x 3 5 7 x x x 17 20]
[x 11 15 8 x 16 4 x 1 1]
[x 8 19 4 3 3 3 17 8 15]
[13 10 17 17 6 1 x 8 13 20]
[20 x x x x 4 18 4 17 x]
[5 x x 10 x x 14 2 5 x]
[7 x 4 x x x 15 x x x]
[18 x 18 x 4 x x x 17 x]
[x x x x x x x 13 x x] | traffic | pathfinding | 2 | [[6, 0], [5, 0], [4, 0], [4, 1], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6], [3, 7], [3, 8], [4, 8], [4, 9]] | 141 | 0.029550790786743164 | 14 | 4 | 4 | [[["19", "x", "7", "x", "12", "x", "15", "5", "19", "14"], ["17", "x", "3", "5", "7", "x", "x", "x", "17", "20"], ["x", "11", "15", "8", "x", "16", "4", "x", "1", "1"], ["x", "8", "19", "4", "3", "3", "3", "17", "8", "15"], ["13", "10", "17", "17", "6", "1", "x", "8", "13", "20"], ["20", "x", "x", "x", "x", "4", "18", "4", "17", "x"], ["5", "x", "x", "10", "x", "x", "14", "2", "5", "x"], ["7", "x", "4", "x", "x", "x", "15", "x", "x", "x"], ["18", "x", "18", "x", "4", "x", "x", "x", "17", "x"], ["x", "x", "x", "x", "x", "x", "x", "13", "x", "x"]]] | [[["19", "x", "7", "x", "12", "x", "15", "5", "19", "14"], ["17", "x", "3", "5", "7", "x", "x", "x", "17", "20"], ["x", "11", "15", "8", "x", "16", "4", "x", "1", "1"], ["x", "8", "19", "4", "3", "3", "3", "17", "8", "15"], ["13", "10", "17", "17", "6", "1", "x", "8", "13", "20"], ["20", "x", "x", "x", "x", "4", "18", "4", "17", "x"], ["5", "x", "x", "10", "x", "x", "14", "2", "5", "x"], ["7", "x", "4", "x", "x", "x", "15", "x", "x", "x"], ["18", "x", "18", "x", "4", "x", "x", "x", "17", "x"], ["x", "x", "x", "x", "x", "x", "x", "13", "x", "x"]], [6, 0], [4, 9], 3, 5] | ["[['19', 'x', '7', 'x', '12', 'x', '15', '5', '19', '14'], ['17', 'x', '3', '5', '7', 'x', 'x', 'x', '17', '20'], ['x', '11', '15', '8', 'x', '16', '4', 'x', '1', '1'], ['x', '8', '19', '4', '3', '3', '3', '17', '8', '15'], ['13', '10', '17', '17', '6', '1', 'x', '8', '13', '20'], ['20', 'x', 'x', 'x', 'x', '4', '18', '4', '17', 'x'], ['5', 'x', 'x', '10', 'x', 'x', '14', '2', '5', 'x'], ['7', 'x', '4', 'x', 'x', 'x', '15', 'x', 'x', 'x'], ['18', 'x', '18', 'x', '4', 'x', 'x', 'x', '17', 'x'], ['x', 'x', 'x', 'x', 'x', 'x', 'x', '13', 'x', 'x']]", "(6, 0)", "(4, 9)", "3", "5"] |
20 | Alex is at a trampoline park with a grid of mini trampolines, arranged in a square of 10x10. Some trampolines are broken and unusable. A map of the park is provided below, with 1 indicating a broken trampoline and 0 indicating a functional one. Alex can jump to any of the eight adjacent trampolines, as long as they are not broken. However, Alex must make excatly 3 diagonal jumps, no more, no less, on his path to his destination. He is currently on the trampoline at position (0, 0) (positions are counted from 0, left to right, top to bottom) and wants to reach the trampoline at position (7, 6). What is the shortest sequence of trampolines he should jump on to reach his destination (including the first and final trampolines)? The answer should be a list of tuples, in Python syntax, indicating the row and column of each trampoline Alex jumps on.
0 0 1 1 1 1 0 1 1 0
1 0 1 1 1 1 0 1 0 0
0 0 0 1 1 0 0 1 1 1
1 0 1 1 1 0 0 0 1 1
0 0 1 1 1 1 0 0 1 1
0 0 0 1 1 0 0 0 1 1
0 0 0 0 1 0 0 0 1 1
0 0 0 0 0 0 0 0 1 1
1 0 1 0 0 0 0 1 0 0
0 0 1 0 1 1 1 1 1 1 | trampoline_matrix | pathfinding | 10 | [[0, 0], [0, 1], [1, 1], [2, 1], [3, 1], [4, 1], [5, 2], [6, 3], [7, 4], [7, 5], [7, 6]] | 11 | 0.03641462326049805 | 11 | 8 | 2 | ["[[0, 0, 1, 1, 1, 1, 0, 1, 1, 0], [1, 0, 1, 1, 1, 1, 0, 1, 0, 0], [0, 0, 0, 1, 1, 0, 0, 1, 1, 1], [1, 0, 1, 1, 1, 0, 0, 0, 1, 1], [0, 0, 1, 1, 1, 1, 0, 0, 1, 1], [0, 0, 0, 1, 1, 0, 0, 0, 1, 1], [0, 0, 0, 0, 1, 0, 0, 0, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 1, 1], [1, 0, 1, 0, 0, 0, 0, 1, 0, 0], [0, 0, 1, 0, 1, 1, 1, 1, 1, 1]]", 3] | ["[[0, 0, 1, 1, 1, 1, 0, 1, 1, 0], [1, 0, 1, 1, 1, 1, 0, 1, 0, 0], [0, 0, 0, 1, 1, 0, 0, 1, 1, 1], [1, 0, 1, 1, 1, 0, 0, 0, 1, 1], [0, 0, 1, 1, 1, 1, 0, 0, 1, 1], [0, 0, 0, 1, 1, 0, 0, 0, 1, 1], [0, 0, 0, 0, 1, 0, 0, 0, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 1, 1], [1, 0, 1, 0, 0, 0, 0, 1, 0, 0], [0, 0, 1, 0, 1, 1, 1, 1, 1, 1]]", [0, 0], [7, 6], 3] | ["[[0, 0, 1, 1, 1, 1, 0, 1, 1, 0], [1, 0, 1, 1, 1, 1, 0, 1, 0, 0], [0, 0, 0, 1, 1, 0, 0, 1, 1, 1], [1, 0, 1, 1, 1, 0, 0, 0, 1, 1], [0, 0, 1, 1, 1, 1, 0, 0, 1, 1], [0, 0, 0, 1, 1, 0, 0, 0, 1, 1], [0, 0, 0, 0, 1, 0, 0, 0, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 1, 1], [1, 0, 1, 0, 0, 0, 0, 1, 0, 0], [0, 0, 1, 0, 1, 1, 1, 1, 1, 1]]", "(0, 0)", "(7, 6)", "3"] |
20 | Given 7 labeled water jugs with capacities 76, 48, 35, 94, 93, 115, 16, 53 liters, we aim to fill 3 unlabeled buckets, numbered 1 to 3 and arranged in a line in ascending order, with 247, 261, 273 liters of water respectively. The amount of water in each unlabeled bucket can not at any point in time exceed the amount of water in the bucket placed after it. Jugs can only be filled to the top and emptied completely, and the unlabeled buckets cannot be overfilled. An action, represented as a tuple ('+', X, Y) or ('-', X, Y), involves adding to or removing water from the unlabeled bucket numbered Y, using the jug with capacity X. Determine the shortest sequence of actions needed to fill the buckets as specified, and present the solution as a list of action tuples in Python syntax. | water_jug | subset_sum | 5 | [["+", 48, 3], ["+", 94, 3], ["+", 16, 3], ["+", 115, 3], ["+", 93, 2], ["+", 115, 2], ["+", 53, 2], ["+", 76, 1], ["+", 93, 1], ["-", 16, 1], ["+", 94, 1]] | 11 | 0.03790163993835449 | 11 | 48 | 3 | [[76, 48, 35, 94, 93, 115, 16, 53], [247, 261, 273]] | [[76, 48, 35, 94, 93, 115, 16, 53], [247, 261, 273]] | ["[76, 48, 35, 94, 93, 115, 16, 53]", "[247, 261, 273]"] |
21 | In the 8-puzzle game, you are given a grid with numbered square tiles arranged randomly and one tile missing. The goal is to arrange the tiles in descending order by sliding them into the empty space. The tiles can move in 4 directions: left, right, up, and down. Given the initial state of the puzzle below, where the empty spot is represented as “_”, provide the shortest list of tiles that need to be swapped with the empty spot to achieve the goal state. The goal state is when all tiles are in descending order, with the largest number in the top left corner, and the empty spot is in the bottom right corner. The solution should be a list of numbers in Python format, where each number represents the number on the tile that the empty spot is swapped with at each turn. Initial state of the puzzle: [[25, 71, 58], [61, 94, 53], [50, 18, '_']] | 8_puzzle | puzzle | 5 | [53, 94, 61, 25, 71, 58, 94, 61, 18, 50, 25, 71, 58, 94, 61, 53, 50, 18, 71, 58, 94, 71, 53, 50] | 24 | 0.061148881912231445 | 24 | 4 | 9 | [[[25, 71, 58], [61, 94, 53], [50, 18, "_"]]] | [[[25, 71, 58], [61, 94, 53], [50, 18, "_"]]] | ["[[25, 71, 58], [61, 94, 53], [50, 18, '_']]"] |
21 | In the game 'Sort the Chars', we are given a table of n by m dimensions. This table contains n words, each with m characters, except for the first word which has m - 1 characters. Each character is written on a separate tile. The objective of the game is to rearrange the characters such that row i spells the i-th word in the list, with the blank tile ('_') placed in the top left corner of the board in the end. We can rearrange the tiles by swapping the blank space with any of its 4 diagonal neighboring tiles. Given the list of words and initial state of the board below, where the black space is represented as '_', what is the shortest list of swap actions (reported in python syntax) that can sort the board into the given list of target words? The list must only include the 4 diagonal swap directions: up-right, down-right, up-left, or down-left, representing the direction in ehich the blank space was swpped in. Target words: poss, smoke, casel, hiram The initial board: [['m', 'p', 'l', 's', 's'], ['s', 'a', 'o', 's', 'e'], ['c', 'a', '_', 'e', 'k'], ['h', 'i', 'r', 'o', 'm']] | 8_puzzle_words | puzzle | 2 | ["up-left", "up-right", "down-right", "down-left", "down-right", "up-right", "up-left", "down-left", "up-left", "up-right", "down-right", "down-left", "down-right", "up-right", "up-left", "down-left", "up-left", "up-left"] | 18 | 0.25868940353393555 | 18 | 4 | 20 | [[["m", "p", "l", "s", "s"], ["s", "a", "o", "s", "e"], ["c", "a", "_", "e", "k"], ["h", "i", "r", "o", "m"]]] | [[["m", "p", "l", "s", "s"], ["s", "a", "o", "s", "e"], ["c", "a", "_", "e", "k"], ["h", "i", "r", "o", "m"]], ["poss", "smoke", "casel", "hiram"]] | ["[['m', 'p', 'l', 's', 's'], ['s', 'a', 'o', 's', 'e'], ['c', 'a', '_', 'e', 'k'], ['h', 'i', 'r', 'o', 'm']]", "['poss', 'smoke', 'casel', 'hiram']"] |
21 | We have a map of cities, each represented by a letter, and they are connected by one-way roads. The adjacency matrix below shows the connections between the cities. Each row and column represents a city, and a '1' signifies a direct road from the city of the row to the city of the column. The travel time between any two directly connected cities is the same. Currently, we are located in city 'Y'. Our task is to visit city I and city Q excatly twice. Determine the quickest route that allows us to visit both these destination cities, ensuring that we stop at the two destinations twice on our path. The sequence in which we visit the destination cities is not important. However, apart from Q and I, we can only visit each city once on our path. Provide the solution as a list of the city names on our path, including the start, in Python syntax.
I K D M Y H C R V W Q
I 0 0 0 1 0 1 1 0 1 0 0
K 0 0 0 1 0 0 0 0 0 0 0
D 0 0 0 0 0 0 0 1 0 1 0
M 1 0 0 0 0 0 0 0 0 0 0
Y 0 1 1 0 0 0 0 0 0 0 0
H 0 1 1 1 0 0 1 0 1 0 1
C 0 1 0 1 1 1 0 0 1 0 0
R 0 0 0 1 0 0 0 0 1 0 1
V 0 0 0 0 1 0 0 1 0 0 0
W 1 0 0 1 1 0 0 0 0 0 0
Q 0 1 1 0 1 0 1 1 0 1 0
| city_directed_graph | pathfinding | 11 | ["Y", "K", "M", "I", "H", "Q", "R", "Q", "W", "I"] | 10 | 0.020466327667236328 | 10 | 11 | 14 | [[[0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0], [0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 0, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 0], [0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1], [0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0], [1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0], [0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0]], ["I", "K", "D", "M", "Y", "H", "C", "R", "V", "W", "Q"], "I", "Q"] | [[[0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0], [0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 0, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 0], [0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1], [0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0], [1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0], [0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0]], ["I", "K", "D", "M", "Y", "H", "C", "R", "V", "W", "Q"], "Y", "I", "Q"] | ["[[0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0], [0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 0, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 0], [0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1], [0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0], [1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0], [0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0]]", "['I', 'K', 'D', 'M', 'Y', 'H', 'C', 'R', 'V', 'W', 'Q']", "['Y']", "['I', 'Q']"] |
21 | In the 'taxed coin exchange' problem, you are required to choose a subset of coins from this list [17, 19, 5, 17, 13, 2, 12, 4, 4, 15, 19, 7, 18, 15, 4, 6, 9, 2, 4, 11, 21, 17, 20, 4, 8, 2, 19, 16, 2, 12, 8, 16, 18, 3, 18, 13, 3, 15, 7, 18, 4, 14, 3, 5, 8, 7, 19, 9, 17, 5, 17, 6, 3, 5, 15], such that the sum of the chosen coins adds up to 210. Each coin in the list is unique and can only be used once. Also coins carry a tax value. The tax values for each coin is {9: 9, 6: 1, 13: 4, 2: 1, 16: 3, 14: 4, 19: 16, 20: 2, 15: 3, 7: 3, 18: 14, 17: 15, 4: 2, 5: 5, 8: 8, 21: 10, 12: 11, 11: 7, 3: 2}, where the tax for coins of the same value is the same. Also, if the coin chosen is smaller than the previous one, it must have an even value, otherwise, if the coin is larger than or equal to the previous coin chosen, it must have an odd value. The objective is to determine which subset of coins should be selected to minimize the total tax paid. The solution should be presented as a list of numbers, representing the value of the coins chosen in order, with the first coins chosen being in index 0, formatted in Python syntax. | coin_exchange | subset_sum | 35 | [20, 16, 6, 15, 15, 15, 15, 14, 6, 4, 13, 13, 4, 21, 16, 4, 2, 7, 4] | 56 | 0.052184104919433594 | 19 | 55 | 55 | [[17, 19, 5, 17, 13, 2, 12, 4, 4, 15, 19, 7, 18, 15, 4, 6, 9, 2, 4, 11, 21, 17, 20, 4, 8, 2, 19, 16, 2, 12, 8, 16, 18, 3, 18, 13, 3, 15, 7, 18, 4, 14, 3, 5, 8, 7, 19, 9, 17, 5, 17, 6, 3, 5, 15]] | [[17, 19, 5, 17, 13, 2, 12, 4, 4, 15, 19, 7, 18, 15, 4, 6, 9, 2, 4, 11, 21, 17, 20, 4, 8, 2, 19, 16, 2, 12, 8, 16, 18, 3, 18, 13, 3, 15, 7, 18, 4, 14, 3, 5, 8, 7, 19, 9, 17, 5, 17, 6, 3, 5, 15], {"9": 9, "6": 1, "13": 4, "2": 1, "16": 3, "14": 4, "19": 16, "20": 2, "15": 3, "7": 3, "18": 14, "17": 15, "4": 2, "5": 5, "8": 8, "21": 10, "12": 11, "11": 7, "3": 2}, 210] | ["[17, 19, 5, 17, 13, 2, 12, 4, 4, 15, 19, 7, 18, 15, 4, 6, 9, 2, 4, 11, 21, 17, 20, 4, 8, 2, 19, 16, 2, 12, 8, 16, 18, 3, 18, 13, 3, 15, 7, 18, 4, 14, 3, 5, 8, 7, 19, 9, 17, 5, 17, 6, 3, 5, 15]", "{9: 9, 6: 1, 13: 4, 2: 1, 16: 3, 14: 4, 19: 16, 20: 2, 15: 3, 7: 3, 18: 14, 17: 15, 4: 2, 5: 5, 8: 8, 21: 10, 12: 11, 11: 7, 3: 2}", "210"] |
21 | The game of 'Sort It' begins with 3 tubes, each filled with 4 balls of different colors. The goal is to sort the balls by color, with each tube containing balls of only one color. Only one ball can be moved at a time, taken from the top of one tube and placed on top of another. The capacity of each tube (maximum number of balls we can fit in each tube) is 6 balls. It is not allowed to place a ball in a tube that already has 6 balls. The solution should be a list of tuples, each containing, first, the index of the tube from which a ball is taken and, second, the index of the tube to which it is moved, indexing from 0. Given the initial state of the tubes, represented by the lists below (with the leftmost item being the color of the topmost ball in each tube), what is the shortest list of move tuples that will result in all the balls being correctly sorted? [['Green', 'Red', 'Blue', 'Green'], ['Red', 'Blue', 'Red', 'Blue'], ['Red', 'Blue', 'Green', 'Green']] | color_sorting | sorting | 7 | [[1, 2], [0, 1], [0, 2], [0, 1], [0, 1], [2, 0], [2, 0], [2, 0], [2, 0], [1, 2], [1, 0], [1, 2], [1, 0], [1, 2], [0, 1], [0, 1], [0, 1], [2, 0]] | 18 | 1.3162987232208252 | 18 | 6 | 12 | [[["Green", "Red", "Blue", "Green"], ["Red", "Blue", "Red", "Blue"], ["Red", "Blue", "Green", "Green"]], 6] | [[["Green", "Red", "Blue", "Green"], ["Red", "Blue", "Red", "Blue"], ["Red", "Blue", "Green", "Green"]], 6] | ["[['Green', 'Red', 'Blue', 'Green'], ['Red', 'Blue', 'Red', 'Blue'], ['Red', 'Blue', 'Green', 'Green']]", "6"] |
21 | We have a 3x3 numerical grid, with numbers ranging from 15 to 58 (15 included in the range but 58 is not included). The numbers in each row and column must be strictly increasing or decreasing. This means that either first > second > third or first < second < third in each row and column. If a grid cell is marked with an 'x', the number in that position is hidden. The objective is to replace the 'x's with unique integers from the given range, ensuring that each number only appears once in the grid. The replacements must maintain the consecutive order in each row and column. Additionally, the sum of the numbers in the topmost row plus the numbers in the rightmost column plus the numbers in the diagonal connecting the top-left corner of the grid to its bottom-right corner should be minimized. The solution should be given as a list of tuples in Python syntax. Each tuple should represent the replacement of a number with an 'x' number and contain three elements: the row index of the 'x', the column index of the 'x' (both starting from 0), and the value of the number that replaces the 'x'. The initial state of the grid is as follows:
Grid:
[['30' 'x' 'x']
['28' '33' '43']
['x' 'x' '51']] | consecutive_grid | underdetermined_system | 7 | [[0, 1, 16], [0, 2, 15], [2, 0, 17], [2, 1, 34]] | 284 | 0.16371726989746094 | 4 | 43 | 9 | ["[['30', '', ''], ['28', '33', '43'], ['', '', '51']]", 15, 58] | ["[['30', '', ''], ['28', '33', '43'], ['', '', '51']]", 15, 58] | ["[['30', '', ''], ['28', '33', '43'], ['', '', '51']]", "15", "58"] |
21 | In the magic square problem, a 3x3 grid is filled with unique integers ranging from 50 to 84. Some numbers are already given, while others are unknown and represented as 'x'. Sum of column 1 (counting from 0) must be 212, and sum of row 1 must be 193. Also, the sum of the numbers in the diagonal from the top right to the bottom left corner of the grid should equal 217. The goal is to find unique integers (ie each number can be in the final grid only once) in the given range to replace with ‘x’s in the grid below such that the sum of the specified rows, columns, and diagonal equals the given amounts and the sum of all of the numbers in the grid is as low as possible. The solution should be provided as a list of tuples in Python syntax. Each tuple should contain three numbers for each 'x' position: the row index, the column index (both starting from 0), and the value of the unique integer replaced with 'x' at that position.
Grid:
[['x' 'x' '62']
['x' 'x' 'x']
['x' 'x' '56']] | magic_square | underdetermined_system | 7 | [[0, 0, 50], [0, 1, 51], [1, 0, 52], [1, 1, 83], [1, 2, 58], [2, 0, 72], [2, 1, 78]] | 562 | 155.01593708992004 | 7 | 29 | 9 | ["[['', '', '62'], ['', '', ''], ['', '', '56']]", 3, 50, 84] | ["[['', '', '62'], ['', '', ''], ['', '', '56']]", 50, 84, [1, 2], [1, 2], [212], [193], 217] | ["[['', '', '62'], ['', '', ''], ['', '', '56']]", "50", "84", "[None, 212, None]", "[None, 193, None]", "217"] |
21 | In 'Restricted Sorting', there are 6 stacks each with a capacity of 4 blocks, with 3 stacks filled with blocks of varying shades and the remaining are empty. The challenge is to sort the blocks by shade such that if a stack is not empty, it is stacked with 3 blocks of a single shade. The player can only transfer one block at a time from the top of a stack to an empty stack or to a stack that has only blocks of that shade, without exceeding the stacks’ capacity. Transferring blocks to certain stacks is more expensive than others. The cost of moving one block to the top of each stack is: {0: 4, 1: 5, 2: 3, 3: 3, 4: 3, 5: 5}, where the keys are the index of each stack, indexing from 0. The cost of moving a block is always at least 1. The solution should be a list of tuples, each containing, first, the index of the stack from which a block is picked up from and, second, the index of the stack to which it is transferred, indexing from 0. Given the initial state of the stacks, represented by the lists below (with the leftmost item being the shade of the topmost block in each stack)(and the first stack being the stack at index 0), what is the list of transfer pairs (reported in python syntax) with the least possible cost, that will result in all the blocks being correctly sorted? [['Red', 'Yellow', 'Blue', 'Yellow'], [], [], ['Green', 'Blue', 'Green', 'Red'], [], ['Yellow', 'Red', 'Green', 'Blue']] | restricted_sorting | sorting | 1 | [[0, 2], [5, 4], [5, 2], [5, 1], [0, 4], [0, 5], [3, 1], [3, 5], [3, 1], [0, 4], [3, 2]] | 43 | 0.025786161422729492 | 11 | 30 | 12 | [[["Red", "Yellow", "Blue", "Yellow"], [], [], ["Green", "Blue", "Green", "Red"], [], ["Yellow", "Red", "Green", "Blue"]], 4, {"0": 4, "1": 5, "2": 3, "3": 3, "4": 3, "5": 5}] | [[["Red", "Yellow", "Blue", "Yellow"], [], [], ["Green", "Blue", "Green", "Red"], [], ["Yellow", "Red", "Green", "Blue"]], 4, {"0": 4, "1": 5, "2": 3, "3": 3, "4": 3, "5": 5}, 3] | ["[['Red', 'Yellow', 'Blue', 'Yellow'], [], [], ['Green', 'Blue', 'Green', 'Red'], [], ['Yellow', 'Red', 'Green', 'Blue']]", "{0: 4, 1: 5, 2: 3, 3: 3, 4: 3, 5: 5}", "4", "3"] |
21 | Using the provided matrix map of a city, where numbers represent travel time in minutes (all numbers are positive integers) and 'x' marks closed workshops, find the quickest route for Ben to travel from his current workshop at index (1, 9) to his destination workshop at index (6, 3), indexing from 0. Ben's car can move north, south, east, or west from a given crossroad, provided there's no x in that direction. Also, there are 3 districts in the city with district 1 covering rows 0 to 1, district 2 covering rows 2 to 6, and district 3 covering rows 7 to 9. Ben has to visit at least 1 workshop in each district on his path to the destination. The roads are bidirectional. The answer should be a list of tuples (in Python syntax) indicating the index of workshops on Ben's path. The start and end workshops must be included in the path.
[15 4 9 10 19 x 12 4 x 15]
[12 19 11 x x x x 7 6 3]
[4 x 8 x x 19 x 11 1 6]
[x x 5 x x x 12 6 6 x]
[x 14 x x 14 11 2 9 6 14]
[8 8 5 17 7 x 1 2 x 6]
[18 x x 15 x 15 4 x x 7]
[19 x 10 18 14 x 14 9 8 6]
[19 x 14 x 10 8 15 x 15 x]
[12 1 x 5 3 3 x x x x] | traffic | pathfinding | 2 | [[1, 9], [1, 8], [2, 8], [3, 8], [3, 7], [4, 7], [4, 6], [5, 6], [6, 6], [7, 6], [6, 6], [5, 6], [4, 6], [4, 5], [4, 4], [5, 4], [5, 3], [6, 3]] | 120 | 0.022410869598388672 | 18 | 4 | 4 | [[["15", "4", "9", "10", "19", "x", "12", "4", "x", "15"], ["12", "19", "11", "x", "x", "x", "x", "7", "6", "3"], ["4", "x", "8", "x", "x", "19", "x", "11", "1", "6"], ["x", "x", "5", "x", "x", "x", "12", "6", "6", "x"], ["x", "14", "x", "x", "14", "11", "2", "9", "6", "14"], ["8", "8", "5", "17", "7", "x", "1", "2", "x", "6"], ["18", "x", "x", "15", "x", "15", "4", "x", "x", "7"], ["19", "x", "10", "18", "14", "x", "14", "9", "8", "6"], ["19", "x", "14", "x", "10", "8", "15", "x", "15", "x"], ["12", "1", "x", "5", "3", "3", "x", "x", "x", "x"]]] | [[["15", "4", "9", "10", "19", "x", "12", "4", "x", "15"], ["12", "19", "11", "x", "x", "x", "x", "7", "6", "3"], ["4", "x", "8", "x", "x", "19", "x", "11", "1", "6"], ["x", "x", "5", "x", "x", "x", "12", "6", "6", "x"], ["x", "14", "x", "x", "14", "11", "2", "9", "6", "14"], ["8", "8", "5", "17", "7", "x", "1", "2", "x", "6"], ["18", "x", "x", "15", "x", "15", "4", "x", "x", "7"], ["19", "x", "10", "18", "14", "x", "14", "9", "8", "6"], ["19", "x", "14", "x", "10", "8", "15", "x", "15", "x"], ["12", "1", "x", "5", "3", "3", "x", "x", "x", "x"]], [1, 9], [6, 3], 1, 6] | ["[['15', '4', '9', '10', '19', 'x', '12', '4', 'x', '15'], ['12', '19', '11', 'x', 'x', 'x', 'x', '7', '6', '3'], ['4', 'x', '8', 'x', 'x', '19', 'x', '11', '1', '6'], ['x', 'x', '5', 'x', 'x', 'x', '12', '6', '6', 'x'], ['x', '14', 'x', 'x', '14', '11', '2', '9', '6', '14'], ['8', '8', '5', '17', '7', 'x', '1', '2', 'x', '6'], ['18', 'x', 'x', '15', 'x', '15', '4', 'x', 'x', '7'], ['19', 'x', '10', '18', '14', 'x', '14', '9', '8', '6'], ['19', 'x', '14', 'x', '10', '8', '15', 'x', '15', 'x'], ['12', '1', 'x', '5', '3', '3', 'x', 'x', 'x', 'x']]", "(1, 9)", "(6, 3)", "1", "6"] |
21 | Alex is at a trampoline park with a grid of mini trampolines, arranged in a square of 10x10. Some trampolines are broken and unusable. A map of the park is provided below, with 1 indicating a broken trampoline and 0 indicating a functional one. Alex can jump to any of the eight adjacent trampolines, as long as they are not broken. However, Alex must make excatly 3 diagonal jumps, no more, no less, on his path to his destination. He is currently on the trampoline at position (1, 9) (positions are counted from 0, left to right, top to bottom) and wants to reach the trampoline at position (5, 0). What is the shortest sequence of trampolines he should jump on to reach his destination (including the first and final trampolines)? The answer should be a list of tuples, in Python syntax, indicating the row and column of each trampoline Alex jumps on.
0 1 0 0 0 1 1 0 1 0
0 0 0 1 0 1 1 0 0 0
1 1 1 0 0 1 1 0 0 1
1 0 0 0 0 0 0 0 0 1
1 1 1 0 0 0 0 0 0 1
0 0 0 0 1 0 0 1 1 1
0 0 1 1 0 1 1 1 1 0
0 0 1 1 1 1 0 0 1 0
1 0 1 1 1 1 1 0 1 1
1 1 1 0 0 1 1 1 1 1 | trampoline_matrix | pathfinding | 10 | [[1, 9], [1, 8], [2, 7], [3, 6], [3, 5], [3, 4], [3, 3], [4, 3], [5, 2], [5, 1], [5, 0]] | 11 | 0.029159069061279297 | 11 | 8 | 2 | ["[[0, 1, 0, 0, 0, 1, 1, 0, 1, 0], [0, 0, 0, 1, 0, 1, 1, 0, 0, 0], [1, 1, 1, 0, 0, 1, 1, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 1, 0, 0, 1, 1, 1], [0, 0, 1, 1, 0, 1, 1, 1, 1, 0], [0, 0, 1, 1, 1, 1, 0, 0, 1, 0], [1, 0, 1, 1, 1, 1, 1, 0, 1, 1], [1, 1, 1, 0, 0, 1, 1, 1, 1, 1]]", 3] | ["[[0, 1, 0, 0, 0, 1, 1, 0, 1, 0], [0, 0, 0, 1, 0, 1, 1, 0, 0, 0], [1, 1, 1, 0, 0, 1, 1, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 1, 0, 0, 1, 1, 1], [0, 0, 1, 1, 0, 1, 1, 1, 1, 0], [0, 0, 1, 1, 1, 1, 0, 0, 1, 0], [1, 0, 1, 1, 1, 1, 1, 0, 1, 1], [1, 1, 1, 0, 0, 1, 1, 1, 1, 1]]", [1, 9], [5, 0], 3] | ["[[0, 1, 0, 0, 0, 1, 1, 0, 1, 0], [0, 0, 0, 1, 0, 1, 1, 0, 0, 0], [1, 1, 1, 0, 0, 1, 1, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 1, 0, 0, 1, 1, 1], [0, 0, 1, 1, 0, 1, 1, 1, 1, 0], [0, 0, 1, 1, 1, 1, 0, 0, 1, 0], [1, 0, 1, 1, 1, 1, 1, 0, 1, 1], [1, 1, 1, 0, 0, 1, 1, 1, 1, 1]]", "(1, 9)", "(5, 0)", "3"] |
21 | Given 7 labeled water jugs with capacities 52, 131, 82, 132, 117, 65 liters, we aim to fill 3 unlabeled buckets, numbered 1 to 3 and arranged in a line in ascending order, with 357, 384, 522 liters of water respectively. The amount of water in each unlabeled bucket can not at any point in time exceed the amount of water in the bucket placed after it. Jugs can only be filled to the top and emptied completely, and the unlabeled buckets cannot be overfilled. An action, represented as a tuple ('+', X, Y) or ('-', X, Y), involves adding to or removing water from the unlabeled bucket numbered Y, using the jug with capacity X. Determine the shortest sequence of actions needed to fill the buckets as specified, and present the solution as a list of action tuples in Python syntax. | water_jug | subset_sum | 5 | [["+", 117, 3], ["+", 117, 3], ["+", 52, 3], ["+", 52, 3], ["+", 52, 3], ["+", 132, 3], ["+", 82, 2], ["+", 131, 2], ["+", 52, 2], ["+", 52, 2], ["-", 65, 2], ["+", 132, 2], ["+", 65, 1], ["+", 131, 1], ["+", 131, 1], ["-", 52, 1], ["+", 82, 1]] | 17 | 0.047934532165527344 | 17 | 36 | 3 | [[52, 131, 82, 132, 117, 65], [357, 384, 522]] | [[52, 131, 82, 132, 117, 65], [357, 384, 522]] | ["[52, 131, 82, 132, 117, 65]", "[357, 384, 522]"] |
22 | In the 8-puzzle game, you are given a grid with numbered square tiles arranged randomly and one tile missing. The goal is to arrange the tiles in descending order by sliding them into the empty space. The tiles can move in 4 directions: left, right, up, and down. Given the initial state of the puzzle below, where the empty spot is represented as “_”, provide the shortest list of tiles that need to be swapped with the empty spot to achieve the goal state. The goal state is when all tiles are in descending order, with the largest number in the top left corner, and the empty spot is in the bottom right corner. The solution should be a list of numbers in Python format, where each number represents the number on the tile that the empty spot is swapped with at each turn. Initial state of the puzzle: [[81, 25, '_'], [19, 56, 14], [61, 41, 39]] | 8_puzzle | puzzle | 5 | [25, 56, 41, 61, 19, 41, 61, 39, 14, 25, 56, 61, 39, 14] | 14 | 0.019939899444580078 | 14 | 4 | 9 | [[[81, 25, "_"], [19, 56, 14], [61, 41, 39]]] | [[[81, 25, "_"], [19, 56, 14], [61, 41, 39]]] | ["[[81, 25, '_'], [19, 56, 14], [61, 41, 39]]"] |
22 | In the game 'Sort the Chars', we are given a table of n by m dimensions. This table contains n words, each with m characters, except for the first word which has m - 1 characters. Each character is written on a separate tile. The objective of the game is to rearrange the characters such that row i spells the i-th word in the list, with the blank tile ('_') placed in the top left corner of the board in the end. We can rearrange the tiles by swapping the blank space with any of its 4 diagonal neighboring tiles. Given the list of words and initial state of the board below, where the black space is represented as '_', what is the shortest list of swap actions (reported in python syntax) that can sort the board into the given list of target words? The list must only include the 4 diagonal swap directions: up-right, down-right, up-left, or down-left, representing the direction in ehich the blank space was swpped in. Target words: jehu, wormy, linty, ilial The initial board: [['o', 'j', '_', 'h', 'u'], ['w', 'l', 'r', 'e', 'y'], ['n', 'i', 'l', 't', 'a'], ['i', 'y', 'i', 'm', 'l']] | 8_puzzle_words | puzzle | 2 | ["down-left", "down-right", "down-left", "up-left", "up-right", "up-right", "down-right", "down-left", "down-right", "up-right", "up-left", "down-left", "down-left", "up-left", "up-right", "up-left"] | 16 | 0.13087821006774902 | 16 | 4 | 20 | [[["o", "j", "_", "h", "u"], ["w", "l", "r", "e", "y"], ["n", "i", "l", "t", "a"], ["i", "y", "i", "m", "l"]]] | [[["o", "j", "_", "h", "u"], ["w", "l", "r", "e", "y"], ["n", "i", "l", "t", "a"], ["i", "y", "i", "m", "l"]], ["jehu", "wormy", "linty", "ilial"]] | ["[['o', 'j', '_', 'h', 'u'], ['w', 'l', 'r', 'e', 'y'], ['n', 'i', 'l', 't', 'a'], ['i', 'y', 'i', 'm', 'l']]", "['jehu', 'wormy', 'linty', 'ilial']"] |
22 | We have a map of cities, each represented by a letter, and they are connected by one-way roads. The adjacency matrix below shows the connections between the cities. Each row and column represents a city, and a '1' signifies a direct road from the city of the row to the city of the column. The travel time between any two directly connected cities is the same. Currently, we are located in city 'X'. Our task is to visit city E and city T excatly twice. Determine the quickest route that allows us to visit both these destination cities, ensuring that we stop at the two destinations twice on our path. The sequence in which we visit the destination cities is not important. However, apart from T and E, we can only visit each city once on our path. Provide the solution as a list of the city names on our path, including the start, in Python syntax.
X M U N T V Z S F E J
X 0 0 1 1 0 0 1 1 0 0 0
M 0 0 1 1 1 0 0 1 0 0 0
U 0 0 0 1 0 0 0 1 0 0 0
N 1 0 0 0 0 0 0 1 1 0 0
T 1 0 1 1 0 0 0 0 0 1 0
V 1 1 1 1 1 0 1 1 0 1 0
Z 0 1 0 0 0 1 0 0 1 0 0
S 0 0 0 0 0 0 0 0 1 1 0
F 0 0 0 0 0 0 0 0 0 1 0
E 0 0 1 0 0 0 1 1 1 0 1
J 0 1 1 0 0 0 0 0 0 0 0
| city_directed_graph | pathfinding | 11 | ["X", "Z", "V", "T", "E", "J", "M", "T", "E"] | 9 | 0.029807567596435547 | 9 | 11 | 14 | [[[0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0], [0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0], [1, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0], [1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 0], [0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0], [0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 1], [0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0]], ["X", "M", "U", "N", "T", "V", "Z", "S", "F", "E", "J"], "E", "T"] | [[[0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0], [0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0], [1, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0], [1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 0], [0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0], [0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 1], [0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0]], ["X", "M", "U", "N", "T", "V", "Z", "S", "F", "E", "J"], "X", "E", "T"] | ["[[0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0], [0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0], [1, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0], [1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 0], [0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0], [0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 1], [0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0]]", "['X', 'M', 'U', 'N', 'T', 'V', 'Z', 'S', 'F', 'E', 'J']", "['X']", "['E', 'T']"] |
22 | In the 'taxed coin exchange' problem, you are required to choose a subset of coins from this list [10, 2, 5, 22, 15, 3, 4, 66, 3, 11, 21, 16, 69, 2, 19, 20, 9, 24, 24, 20, 12, 13, 21, 7, 7, 23, 25, 10], such that the sum of the chosen coins adds up to 268. Each coin in the list is unique and can only be used once. Also coins carry a tax value. The tax values for each coin is {66: 17, 9: 3, 15: 10, 7: 6, 3: 3, 13: 7, 11: 10, 25: 14, 22: 18, 24: 17, 12: 6, 23: 18, 2: 2, 10: 5, 19: 10, 20: 19, 5: 4, 16: 1, 21: 20, 69: 14, 4: 4}, where the tax for coins of the same value is the same. Also, if the coin chosen is smaller than the previous one, it must have an even value, otherwise, if the coin is larger than or equal to the previous coin chosen, it must have an odd value. The objective is to determine which subset of coins should be selected to minimize the total tax paid. The solution should be presented as a list of numbers, representing the value of the coins chosen in order, with the first coins chosen being in index 0, formatted in Python syntax. | coin_exchange | subset_sum | 15 | [9, 13, 10, 69, 66, 16, 10, 19, 25, 12, 15, 4] | 96 | 0.04047846794128418 | 12 | 28 | 28 | [[10, 2, 5, 22, 15, 3, 4, 66, 3, 11, 21, 16, 69, 2, 19, 20, 9, 24, 24, 20, 12, 13, 21, 7, 7, 23, 25, 10]] | [[10, 2, 5, 22, 15, 3, 4, 66, 3, 11, 21, 16, 69, 2, 19, 20, 9, 24, 24, 20, 12, 13, 21, 7, 7, 23, 25, 10], {"66": 17, "9": 3, "15": 10, "7": 6, "3": 3, "13": 7, "11": 10, "25": 14, "22": 18, "24": 17, "12": 6, "23": 18, "2": 2, "10": 5, "19": 10, "20": 19, "5": 4, "16": 1, "21": 20, "69": 14, "4": 4}, 268] | ["[10, 2, 5, 22, 15, 3, 4, 66, 3, 11, 21, 16, 69, 2, 19, 20, 9, 24, 24, 20, 12, 13, 21, 7, 7, 23, 25, 10]", "{66: 17, 9: 3, 15: 10, 7: 6, 3: 3, 13: 7, 11: 10, 25: 14, 22: 18, 24: 17, 12: 6, 23: 18, 2: 2, 10: 5, 19: 10, 20: 19, 5: 4, 16: 1, 21: 20, 69: 14, 4: 4}", "268"] |
22 | The game of 'Sort It' begins with 3 tubes, each filled with 4 balls of different colors. The goal is to sort the balls by color, with each tube containing balls of only one color. Only one ball can be moved at a time, taken from the top of one tube and placed on top of another. The capacity of each tube (maximum number of balls we can fit in each tube) is 6 balls. It is not allowed to place a ball in a tube that already has 6 balls. The solution should be a list of tuples, each containing, first, the index of the tube from which a ball is taken and, second, the index of the tube to which it is moved, indexing from 0. Given the initial state of the tubes, represented by the lists below (with the leftmost item being the color of the topmost ball in each tube), what is the shortest list of move tuples that will result in all the balls being correctly sorted? [['Blue', 'Red', 'Blue', 'Green'], ['Red', 'Blue', 'Green', 'Red'], ['Blue', 'Green', 'Green', 'Red']] | color_sorting | sorting | 7 | [[0, 2], [1, 0], [1, 2], [1, 0], [1, 0], [2, 1], [2, 1], [2, 1], [2, 1], [2, 1], [0, 2], [0, 1], [0, 2], [0, 2], [0, 2], [1, 0], [1, 0], [1, 0], [2, 1]] | 19 | 2.2448041439056396 | 19 | 6 | 12 | [[["Blue", "Red", "Blue", "Green"], ["Red", "Blue", "Green", "Red"], ["Blue", "Green", "Green", "Red"]], 6] | [[["Blue", "Red", "Blue", "Green"], ["Red", "Blue", "Green", "Red"], ["Blue", "Green", "Green", "Red"]], 6] | ["[['Blue', 'Red', 'Blue', 'Green'], ['Red', 'Blue', 'Green', 'Red'], ['Blue', 'Green', 'Green', 'Red']]", "6"] |
22 | We have a 3x3 numerical grid, with numbers ranging from 13 to 56 (13 included in the range but 56 is not included). The numbers in each row and column must be strictly increasing or decreasing. This means that either first > second > third or first < second < third in each row and column. If a grid cell is marked with an 'x', the number in that position is hidden. The objective is to replace the 'x's with unique integers from the given range, ensuring that each number only appears once in the grid. The replacements must maintain the consecutive order in each row and column. Additionally, the sum of the numbers in the topmost row plus the numbers in the rightmost column plus the numbers in the diagonal connecting the top-left corner of the grid to its bottom-right corner should be minimized. The solution should be given as a list of tuples in Python syntax. Each tuple should represent the replacement of a number with an 'x' number and contain three elements: the row index of the 'x', the column index of the 'x' (both starting from 0), and the value of the number that replaces the 'x'. The initial state of the grid is as follows:
Grid:
[['16' 'x' 'x']
['28' '34' 'x']
['x' '46' 'x']] | consecutive_grid | underdetermined_system | 8 | [[0, 1, 14], [0, 2, 13], [1, 2, 35], [2, 0, 47], [2, 2, 36]] | 213 | 7.270275831222534 | 5 | 43 | 9 | ["[['16', '', ''], ['28', '34', ''], ['', '46', '']]", 13, 56] | ["[['16', '', ''], ['28', '34', ''], ['', '46', '']]", 13, 56] | ["[['16', '', ''], ['28', '34', ''], ['', '46', '']]", "13", "56"] |
22 | In the magic square problem, a 3x3 grid is filled with unique integers ranging from 12 to 46. Some numbers are already given, while others are unknown and represented as 'x'. Sum of column 1 (counting from 0) must be 120, and sum of row 1 must be 105. Also, the sum of the numbers in the diagonal from the top right to the bottom left corner of the grid should equal 99. The goal is to find unique integers (ie each number can be in the final grid only once) in the given range to replace with ‘x’s in the grid below such that the sum of the specified rows, columns, and diagonal equals the given amounts and the sum of all of the numbers in the grid is as low as possible. The solution should be provided as a list of tuples in Python syntax. Each tuple should contain three numbers for each 'x' position: the row index, the column index (both starting from 0), and the value of the unique integer replaced with 'x' at that position.
Grid:
[['x' 'x' 'x']
['x' 'x' 'x']
['x' '43' 'x']] | magic_square | underdetermined_system | 7 | [[0, 0, 12], [0, 1, 32], [0, 2, 14], [1, 0, 16], [1, 1, 45], [1, 2, 44], [2, 0, 40], [2, 2, 13]] | 259 | 92.43742489814758 | 8 | 29 | 9 | ["[['', '', ''], ['', '', ''], ['', '43', '']]", 3, 12, 46] | ["[['', '', ''], ['', '', ''], ['', '43', '']]", 12, 46, [1, 2], [1, 2], [120], [105], 99] | ["[['', '', ''], ['', '', ''], ['', '43', '']]", "12", "46", "[None, 120, None]", "[None, 105, None]", "99"] |
22 | In 'Restricted Sorting', there are 6 stacks each with a capacity of 4 blocks, with 3 stacks filled with blocks of varying shades and the remaining are empty. The challenge is to sort the blocks by shade such that if a stack is not empty, it is stacked with 3 blocks of a single shade. The player can only transfer one block at a time from the top of a stack to an empty stack or to a stack that has only blocks of that shade, without exceeding the stacks’ capacity. Transferring blocks to certain stacks is more expensive than others. The cost of moving one block to the top of each stack is: {0: 1, 1: 4, 2: 2, 3: 7, 4: 6, 5: 6}, where the keys are the index of each stack, indexing from 0. The cost of moving a block is always at least 1. The solution should be a list of tuples, each containing, first, the index of the stack from which a block is picked up from and, second, the index of the stack to which it is transferred, indexing from 0. Given the initial state of the stacks, represented by the lists below (with the leftmost item being the shade of the topmost block in each stack)(and the first stack being the stack at index 0), what is the list of transfer pairs (reported in python syntax) with the least possible cost, that will result in all the blocks being correctly sorted? [[], ['Blue', 'Yellow', 'Blue', 'Yellow'], [], [], ['Red', 'Blue', 'Yellow', 'Green'], ['Green', 'Green', 'Red', 'Red']] | restricted_sorting | sorting | 1 | [[5, 3], [5, 3], [4, 5], [1, 2], [4, 2], [1, 0], [1, 2], [4, 1], [0, 1], [3, 0], [3, 0], [4, 0]] | 38 | 0.09250640869140625 | 12 | 30 | 12 | [[[], ["Blue", "Yellow", "Blue", "Yellow"], [], [], ["Red", "Blue", "Yellow", "Green"], ["Green", "Green", "Red", "Red"]], 4, {"0": 1, "1": 4, "2": 2, "3": 7, "4": 6, "5": 6}] | [[[], ["Blue", "Yellow", "Blue", "Yellow"], [], [], ["Red", "Blue", "Yellow", "Green"], ["Green", "Green", "Red", "Red"]], 4, {"0": 1, "1": 4, "2": 2, "3": 7, "4": 6, "5": 6}, 3] | ["[[], ['Blue', 'Yellow', 'Blue', 'Yellow'], [], [], ['Red', 'Blue', 'Yellow', 'Green'], ['Green', 'Green', 'Red', 'Red']]", "{0: 1, 1: 4, 2: 2, 3: 7, 4: 6, 5: 6}", "4", "3"] |
22 | Using the provided matrix map of a city, where numbers represent travel time in minutes (all numbers are positive integers) and 'x' marks closed workshops, find the quickest route for Ben to travel from his current workshop at index (1, 0) to his destination workshop at index (5, 7), indexing from 0. Ben's car can move north, south, east, or west from a given crossroad, provided there's no x in that direction. Also, there are 3 districts in the city with district 1 covering rows 0 to 1, district 2 covering rows 2 to 4, and district 3 covering rows 5 to 9. Ben has to visit at least 1 workshop in each district on his path to the destination. The roads are bidirectional. The answer should be a list of tuples (in Python syntax) indicating the index of workshops on Ben's path. The start and end workshops must be included in the path.
[2 2 3 x 2 10 x 8 6 x]
[6 11 x x x x x 16 x 7]
[17 17 7 12 13 15 5 6 10 13]
[1 15 13 3 x x x 14 x 9]
[14 x x 6 15 2 12 18 x 18]
[11 19 1 19 10 8 x 14 x x]
[11 x x x 3 x x 7 x 2]
[16 12 x x x 5 x x 10 x]
[x 11 x 2 12 x 8 x 8 x]
[x x 16 x x x 16 x 16 12] | traffic | pathfinding | 2 | [[1, 0], [2, 0], [3, 0], [3, 1], [3, 2], [3, 3], [4, 3], [4, 4], [4, 5], [4, 6], [4, 7], [5, 7]] | 116 | 0.020702600479125977 | 12 | 4 | 4 | [[["2", "2", "3", "x", "2", "10", "x", "8", "6", "x"], ["6", "11", "x", "x", "x", "x", "x", "16", "x", "7"], ["17", "17", "7", "12", "13", "15", "5", "6", "10", "13"], ["1", "15", "13", "3", "x", "x", "x", "14", "x", "9"], ["14", "x", "x", "6", "15", "2", "12", "18", "x", "18"], ["11", "19", "1", "19", "10", "8", "x", "14", "x", "x"], ["11", "x", "x", "x", "3", "x", "x", "7", "x", "2"], ["16", "12", "x", "x", "x", "5", "x", "x", "10", "x"], ["x", "11", "x", "2", "12", "x", "8", "x", "8", "x"], ["x", "x", "16", "x", "x", "x", "16", "x", "16", "12"]]] | [[["2", "2", "3", "x", "2", "10", "x", "8", "6", "x"], ["6", "11", "x", "x", "x", "x", "x", "16", "x", "7"], ["17", "17", "7", "12", "13", "15", "5", "6", "10", "13"], ["1", "15", "13", "3", "x", "x", "x", "14", "x", "9"], ["14", "x", "x", "6", "15", "2", "12", "18", "x", "18"], ["11", "19", "1", "19", "10", "8", "x", "14", "x", "x"], ["11", "x", "x", "x", "3", "x", "x", "7", "x", "2"], ["16", "12", "x", "x", "x", "5", "x", "x", "10", "x"], ["x", "11", "x", "2", "12", "x", "8", "x", "8", "x"], ["x", "x", "16", "x", "x", "x", "16", "x", "16", "12"]], [1, 0], [5, 7], 1, 4] | ["[['2', '2', '3', 'x', '2', '10', 'x', '8', '6', 'x'], ['6', '11', 'x', 'x', 'x', 'x', 'x', '16', 'x', '7'], ['17', '17', '7', '12', '13', '15', '5', '6', '10', '13'], ['1', '15', '13', '3', 'x', 'x', 'x', '14', 'x', '9'], ['14', 'x', 'x', '6', '15', '2', '12', '18', 'x', '18'], ['11', '19', '1', '19', '10', '8', 'x', '14', 'x', 'x'], ['11', 'x', 'x', 'x', '3', 'x', 'x', '7', 'x', '2'], ['16', '12', 'x', 'x', 'x', '5', 'x', 'x', '10', 'x'], ['x', '11', 'x', '2', '12', 'x', '8', 'x', '8', 'x'], ['x', 'x', '16', 'x', 'x', 'x', '16', 'x', '16', '12']]", "(1, 0)", "(5, 7)", "1", "4"] |
22 | Alex is at a trampoline park with a grid of mini trampolines, arranged in a square of 10x10. Some trampolines are broken and unusable. A map of the park is provided below, with 1 indicating a broken trampoline and 0 indicating a functional one. Alex can jump to any of the eight adjacent trampolines, as long as they are not broken. However, Alex must make excatly 3 diagonal jumps, no more, no less, on his path to his destination. He is currently on the trampoline at position (8, 1) (positions are counted from 0, left to right, top to bottom) and wants to reach the trampoline at position (1, 9). What is the shortest sequence of trampolines he should jump on to reach his destination (including the first and final trampolines)? The answer should be a list of tuples, in Python syntax, indicating the row and column of each trampoline Alex jumps on.
1 0 0 1 0 0 0 1 0 0
1 0 1 0 0 1 0 1 1 0
1 1 1 0 1 1 1 0 1 0
1 1 1 0 0 1 0 0 1 0
0 1 1 0 0 1 0 1 0 0
1 1 1 0 1 0 0 0 1 0
0 1 0 1 0 1 0 0 0 0
0 1 1 1 0 1 0 0 0 0
0 0 1 0 0 1 0 0 1 0
1 1 0 0 0 0 0 1 1 0 | trampoline_matrix | pathfinding | 10 | [[8, 1], [9, 2], [9, 3], [8, 3], [8, 4], [7, 4], [6, 4], [5, 5], [5, 6], [5, 7], [4, 8], [4, 9], [3, 9], [2, 9], [1, 9]] | 15 | 0.02926492691040039 | 15 | 8 | 2 | ["[[1, 0, 0, 1, 0, 0, 0, 1, 0, 0], [1, 0, 1, 0, 0, 1, 0, 1, 1, 0], [1, 1, 1, 0, 1, 1, 1, 0, 1, 0], [1, 1, 1, 0, 0, 1, 0, 0, 1, 0], [0, 1, 1, 0, 0, 1, 0, 1, 0, 0], [1, 1, 1, 0, 1, 0, 0, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 0, 0, 0], [0, 1, 1, 1, 0, 1, 0, 0, 0, 0], [0, 0, 1, 0, 0, 1, 0, 0, 1, 0], [1, 1, 0, 0, 0, 0, 0, 1, 1, 0]]", 3] | ["[[1, 0, 0, 1, 0, 0, 0, 1, 0, 0], [1, 0, 1, 0, 0, 1, 0, 1, 1, 0], [1, 1, 1, 0, 1, 1, 1, 0, 1, 0], [1, 1, 1, 0, 0, 1, 0, 0, 1, 0], [0, 1, 1, 0, 0, 1, 0, 1, 0, 0], [1, 1, 1, 0, 1, 0, 0, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 0, 0, 0], [0, 1, 1, 1, 0, 1, 0, 0, 0, 0], [0, 0, 1, 0, 0, 1, 0, 0, 1, 0], [1, 1, 0, 0, 0, 0, 0, 1, 1, 0]]", [8, 1], [1, 9], 3] | ["[[1, 0, 0, 1, 0, 0, 0, 1, 0, 0], [1, 0, 1, 0, 0, 1, 0, 1, 1, 0], [1, 1, 1, 0, 1, 1, 1, 0, 1, 0], [1, 1, 1, 0, 0, 1, 0, 0, 1, 0], [0, 1, 1, 0, 0, 1, 0, 1, 0, 0], [1, 1, 1, 0, 1, 0, 0, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 0, 0, 0], [0, 1, 1, 1, 0, 1, 0, 0, 0, 0], [0, 0, 1, 0, 0, 1, 0, 0, 1, 0], [1, 1, 0, 0, 0, 0, 0, 1, 1, 0]]", "(8, 1)", "(1, 9)", "3"] |
22 | Given 7 labeled water jugs with capacities 16, 124, 57, 40, 99, 45, 72, 98 liters, we aim to fill 3 unlabeled buckets, numbered 1 to 3 and arranged in a line in ascending order, with 263, 341, 360 liters of water respectively. The amount of water in each unlabeled bucket can not at any point in time exceed the amount of water in the bucket placed after it. Jugs can only be filled to the top and emptied completely, and the unlabeled buckets cannot be overfilled. An action, represented as a tuple ('+', X, Y) or ('-', X, Y), involves adding to or removing water from the unlabeled bucket numbered Y, using the jug with capacity X. Determine the shortest sequence of actions needed to fill the buckets as specified, and present the solution as a list of action tuples in Python syntax. | water_jug | subset_sum | 5 | [["+", 98, 3], ["+", 124, 3], ["+", 40, 3], ["+", 98, 3], ["+", 45, 2], ["+", 98, 2], ["+", 99, 2], ["+", 99, 2], ["+", 40, 1], ["+", 99, 1], ["+", 124, 1]] | 11 | 0.04340982437133789 | 11 | 48 | 3 | [[16, 124, 57, 40, 99, 45, 72, 98], [263, 341, 360]] | [[16, 124, 57, 40, 99, 45, 72, 98], [263, 341, 360]] | ["[16, 124, 57, 40, 99, 45, 72, 98]", "[263, 341, 360]"] |
23 | In the 8-puzzle game, you are given a grid with numbered square tiles arranged randomly and one tile missing. The goal is to arrange the tiles in descending order by sliding them into the empty space. The tiles can move in 4 directions: left, right, up, and down. Given the initial state of the puzzle below, where the empty spot is represented as “_”, provide the shortest list of tiles that need to be swapped with the empty spot to achieve the goal state. The goal state is when all tiles are in descending order, with the largest number in the top left corner, and the empty spot is in the bottom right corner. The solution should be a list of numbers in Python format, where each number represents the number on the tile that the empty spot is swapped with at each turn. Initial state of the puzzle: [[62, 43, 28], [59, 34, 53], [29, 76, '_']] | 8_puzzle | puzzle | 5 | [53, 28, 43, 34, 59, 29, 76, 53, 28, 43, 34, 59, 29, 76, 53, 29, 43, 34, 59, 62, 76, 53, 29, 28] | 24 | 0.11378741264343262 | 24 | 4 | 9 | [[[62, 43, 28], [59, 34, 53], [29, 76, "_"]]] | [[[62, 43, 28], [59, 34, 53], [29, 76, "_"]]] | ["[[62, 43, 28], [59, 34, 53], [29, 76, '_']]"] |
23 | In the game 'Sort the Chars', we are given a table of n by m dimensions. This table contains n words, each with m characters, except for the first word which has m - 1 characters. Each character is written on a separate tile. The objective of the game is to rearrange the characters such that row i spells the i-th word in the list, with the blank tile ('_') placed in the top left corner of the board in the end. We can rearrange the tiles by swapping the blank space with any of its 4 diagonal neighboring tiles. Given the list of words and initial state of the board below, where the black space is represented as '_', what is the shortest list of swap actions (reported in python syntax) that can sort the board into the given list of target words? The list must only include the 4 diagonal swap directions: up-right, down-right, up-left, or down-left, representing the direction in ehich the blank space was swpped in. Target words: song, amish, hiper, agley The initial board: [['m', 's', '_', 'n', 'g'], ['a', 'o', 'i', 'e', 'h'], ['h', 'i', 'p', 'e', 's'], ['a', 'g', 'l', 'r', 'y']] | 8_puzzle_words | puzzle | 2 | ["down-left", "down-right", "up-right", "down-right", "down-left", "up-left", "up-left", "up-left"] | 8 | 0.1897449493408203 | 8 | 4 | 20 | [[["m", "s", "_", "n", "g"], ["a", "o", "i", "e", "h"], ["h", "i", "p", "e", "s"], ["a", "g", "l", "r", "y"]]] | [[["m", "s", "_", "n", "g"], ["a", "o", "i", "e", "h"], ["h", "i", "p", "e", "s"], ["a", "g", "l", "r", "y"]], ["song", "amish", "hiper", "agley"]] | ["[['m', 's', '_', 'n', 'g'], ['a', 'o', 'i', 'e', 'h'], ['h', 'i', 'p', 'e', 's'], ['a', 'g', 'l', 'r', 'y']]", "['song', 'amish', 'hiper', 'agley']"] |
23 | We have a map of cities, each represented by a letter, and they are connected by one-way roads. The adjacency matrix below shows the connections between the cities. Each row and column represents a city, and a '1' signifies a direct road from the city of the row to the city of the column. The travel time between any two directly connected cities is the same. Currently, we are located in city 'K'. Our task is to visit city P and city N excatly twice. Determine the quickest route that allows us to visit both these destination cities, ensuring that we stop at the two destinations twice on our path. The sequence in which we visit the destination cities is not important. However, apart from N and P, we can only visit each city once on our path. Provide the solution as a list of the city names on our path, including the start, in Python syntax.
N W X P J E L M I K Q
N 0 0 1 0 0 1 0 1 0 0 0
W 1 0 0 1 1 0 0 0 0 0 0
X 0 1 0 1 0 1 0 0 0 1 1
P 1 1 0 0 1 0 0 0 0 0 1
J 0 0 1 0 0 1 0 0 0 0 0
E 1 1 0 0 0 0 0 0 0 0 0
L 1 0 0 0 0 0 0 0 0 0 1
M 1 1 0 0 0 1 0 0 0 0 0
I 0 0 1 0 1 0 1 1 0 0 0
K 0 0 0 0 0 1 0 0 1 0 0
Q 1 1 0 0 0 0 1 0 1 0 0
| city_directed_graph | pathfinding | 11 | ["K", "E", "N", "X", "P", "W", "P", "N"] | 8 | 0.02664780616760254 | 8 | 11 | 14 | [[[0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0], [1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0], [0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 1], [1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1], [0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0], [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 0], [0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0], [1, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0]], ["N", "W", "X", "P", "J", "E", "L", "M", "I", "K", "Q"], "P", "N"] | [[[0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0], [1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0], [0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 1], [1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1], [0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0], [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 0], [0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0], [1, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0]], ["N", "W", "X", "P", "J", "E", "L", "M", "I", "K", "Q"], "K", "P", "N"] | ["[[0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0], [1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0], [0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 1], [1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1], [0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0], [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 0], [0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0], [1, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0]]", "['N', 'W', 'X', 'P', 'J', 'E', 'L', 'M', 'I', 'K', 'Q']", "['K']", "['P', 'N']"] |
23 | In the 'taxed coin exchange' problem, you are required to choose a subset of coins from this list [84, 2, 8, 16, 21, 10, 15, 4, 17, 16, 4, 85, 30, 13, 28, 2, 2, 11, 18, 9, 25, 5, 24, 14, 20, 30, 6], such that the sum of the chosen coins adds up to 309. Each coin in the list is unique and can only be used once. Also coins carry a tax value. The tax values for each coin is {15: 2, 18: 9, 28: 4, 84: 10, 2: 1, 24: 19, 30: 12, 5: 2, 9: 9, 21: 9, 11: 10, 16: 14, 4: 2, 17: 2, 85: 18, 6: 5, 8: 6, 13: 2, 10: 4, 25: 11, 20: 19, 14: 2}, where the tax for coins of the same value is the same. Also, if the coin chosen is smaller than the previous one, it must have an even value, otherwise, if the coin is larger than or equal to the previous coin chosen, it must have an odd value. The objective is to determine which subset of coins should be selected to minimize the total tax paid. The solution should be presented as a list of numbers, representing the value of the coins chosen in order, with the first coins chosen being in index 0, formatted in Python syntax. | coin_exchange | subset_sum | 16 | [84, 28, 10, 13, 17, 4, 5, 15, 85, 30, 14, 4] | 62 | 0.03924393653869629 | 12 | 27 | 27 | [[84, 2, 8, 16, 21, 10, 15, 4, 17, 16, 4, 85, 30, 13, 28, 2, 2, 11, 18, 9, 25, 5, 24, 14, 20, 30, 6]] | [[84, 2, 8, 16, 21, 10, 15, 4, 17, 16, 4, 85, 30, 13, 28, 2, 2, 11, 18, 9, 25, 5, 24, 14, 20, 30, 6], {"15": 2, "18": 9, "28": 4, "84": 10, "2": 1, "24": 19, "30": 12, "5": 2, "9": 9, "21": 9, "11": 10, "16": 14, "4": 2, "17": 2, "85": 18, "6": 5, "8": 6, "13": 2, "10": 4, "25": 11, "20": 19, "14": 2}, 309] | ["[84, 2, 8, 16, 21, 10, 15, 4, 17, 16, 4, 85, 30, 13, 28, 2, 2, 11, 18, 9, 25, 5, 24, 14, 20, 30, 6]", "{15: 2, 18: 9, 28: 4, 84: 10, 2: 1, 24: 19, 30: 12, 5: 2, 9: 9, 21: 9, 11: 10, 16: 14, 4: 2, 17: 2, 85: 18, 6: 5, 8: 6, 13: 2, 10: 4, 25: 11, 20: 19, 14: 2}", "309"] |
23 | The game of 'Sort It' begins with 3 tubes, each filled with 4 balls of different colors. The goal is to sort the balls by color, with each tube containing balls of only one color. Only one ball can be moved at a time, taken from the top of one tube and placed on top of another. The capacity of each tube (maximum number of balls we can fit in each tube) is 6 balls. It is not allowed to place a ball in a tube that already has 6 balls. The solution should be a list of tuples, each containing, first, the index of the tube from which a ball is taken and, second, the index of the tube to which it is moved, indexing from 0. Given the initial state of the tubes, represented by the lists below (with the leftmost item being the color of the topmost ball in each tube), what is the shortest list of move tuples that will result in all the balls being correctly sorted? [['Red', 'Red', 'Blue', 'Green'], ['Blue', 'Green', 'Blue', 'Blue'], ['Red', 'Green', 'Green', 'Red']] | color_sorting | sorting | 7 | [[2, 0], [2, 1], [2, 1], [0, 2], [0, 2], [0, 2], [0, 2], [1, 0], [1, 0], [1, 2], [1, 0], [2, 1], [2, 1]] | 13 | 0.13763999938964844 | 13 | 6 | 12 | [[["Red", "Red", "Blue", "Green"], ["Blue", "Green", "Blue", "Blue"], ["Red", "Green", "Green", "Red"]], 6] | [[["Red", "Red", "Blue", "Green"], ["Blue", "Green", "Blue", "Blue"], ["Red", "Green", "Green", "Red"]], 6] | ["[['Red', 'Red', 'Blue', 'Green'], ['Blue', 'Green', 'Blue', 'Blue'], ['Red', 'Green', 'Green', 'Red']]", "6"] |
23 | We have a 3x3 numerical grid, with numbers ranging from 23 to 66 (23 included in the range but 66 is not included). The numbers in each row and column must be strictly increasing or decreasing. This means that either first > second > third or first < second < third in each row and column. If a grid cell is marked with an 'x', the number in that position is hidden. The objective is to replace the 'x's with unique integers from the given range, ensuring that each number only appears once in the grid. The replacements must maintain the consecutive order in each row and column. Additionally, the sum of the numbers in the topmost row plus the numbers in the rightmost column plus the numbers in the diagonal connecting the top-left corner of the grid to its bottom-right corner should be minimized. The solution should be given as a list of tuples in Python syntax. Each tuple should represent the replacement of a number with an 'x' number and contain three elements: the row index of the 'x', the column index of the 'x' (both starting from 0), and the value of the number that replaces the 'x'. The initial state of the grid is as follows:
Grid:
[['x' 'x' '57']
['x' 'x' 'x']
['33' '43' '47']] | consecutive_grid | underdetermined_system | 8 | [[0, 0, 23], [0, 1, 24], [1, 0, 25], [1, 1, 26], [1, 2, 48]] | 352 | 1.0622022151947021 | 5 | 43 | 9 | ["[['', '', '57'], ['', '', ''], ['33', '43', '47']]", 23, 66] | ["[['', '', '57'], ['', '', ''], ['33', '43', '47']]", 23, 66] | ["[['', '', '57'], ['', '', ''], ['33', '43', '47']]", "23", "66"] |
23 | In the magic square problem, a 3x3 grid is filled with unique integers ranging from 12 to 46. Some numbers are already given, while others are unknown and represented as 'x'. Sum of column 1 (counting from 0) must be 71, and sum of row 1 must be 82. Also, the sum of the numbers in the diagonal from the top right to the bottom left corner of the grid should equal 70. The goal is to find unique integers (ie each number can be in the final grid only once) in the given range to replace with ‘x’s in the grid below such that the sum of the specified rows, columns, and diagonal equals the given amounts and the sum of all of the numbers in the grid is as low as possible. The solution should be provided as a list of tuples in Python syntax. Each tuple should contain three numbers for each 'x' position: the row index, the column index (both starting from 0), and the value of the unique integer replaced with 'x' at that position.
Grid:
[['x' 'x' 'x']
['x' 'x' 'x']
['x' 'x' '19']] | magic_square | underdetermined_system | 7 | [[0, 0, 13], [0, 1, 14], [0, 2, 12], [1, 0, 17], [1, 1, 42], [1, 2, 23], [2, 0, 16], [2, 1, 15]] | 171 | 8.869033575057983 | 8 | 29 | 9 | ["[['', '', ''], ['', '', ''], ['', '', '19']]", 3, 12, 46] | ["[['', '', ''], ['', '', ''], ['', '', '19']]", 12, 46, [1, 2], [1, 2], [71], [82], 70] | ["[['', '', ''], ['', '', ''], ['', '', '19']]", "12", "46", "[None, 71, None]", "[None, 82, None]", "70"] |
23 | In 'Restricted Sorting', there are 6 stacks each with a capacity of 4 blocks, with 3 stacks filled with blocks of varying shades and the remaining are empty. The challenge is to sort the blocks by shade such that if a stack is not empty, it is stacked with 3 blocks of a single shade. The player can only transfer one block at a time from the top of a stack to an empty stack or to a stack that has only blocks of that shade, without exceeding the stacks’ capacity. Transferring blocks to certain stacks is more expensive than others. The cost of moving one block to the top of each stack is: {0: 2, 1: 7, 2: 4, 3: 7, 4: 6, 5: 3}, where the keys are the index of each stack, indexing from 0. The cost of moving a block is always at least 1. The solution should be a list of tuples, each containing, first, the index of the stack from which a block is picked up from and, second, the index of the stack to which it is transferred, indexing from 0. Given the initial state of the stacks, represented by the lists below (with the leftmost item being the shade of the topmost block in each stack)(and the first stack being the stack at index 0), what is the list of transfer pairs (reported in python syntax) with the least possible cost, that will result in all the blocks being correctly sorted? [['Green', 'Green', 'Blue', 'Red'], ['Blue', 'Red', 'Yellow', 'Blue'], [], ['Green', 'Yellow', 'Red', 'Yellow'], [], []] | restricted_sorting | sorting | 1 | [[3, 2], [0, 2], [0, 2], [0, 5], [1, 5], [1, 0], [1, 4], [3, 4], [3, 0], [3, 4], [1, 5]] | 43 | 0.04391932487487793 | 11 | 30 | 12 | [[["Green", "Green", "Blue", "Red"], ["Blue", "Red", "Yellow", "Blue"], [], ["Green", "Yellow", "Red", "Yellow"], [], []], 4, {"0": 2, "1": 7, "2": 4, "3": 7, "4": 6, "5": 3}] | [[["Green", "Green", "Blue", "Red"], ["Blue", "Red", "Yellow", "Blue"], [], ["Green", "Yellow", "Red", "Yellow"], [], []], 4, {"0": 2, "1": 7, "2": 4, "3": 7, "4": 6, "5": 3}, 3] | ["[['Green', 'Green', 'Blue', 'Red'], ['Blue', 'Red', 'Yellow', 'Blue'], [], ['Green', 'Yellow', 'Red', 'Yellow'], [], []]", "{0: 2, 1: 7, 2: 4, 3: 7, 4: 6, 5: 3}", "4", "3"] |
23 | Using the provided matrix map of a city, where numbers represent travel time in minutes (all numbers are positive integers) and 'x' marks closed workshops, find the quickest route for Ben to travel from his current workshop at index (5, 8) to his destination workshop at index (3, 0), indexing from 0. Ben's car can move north, south, east, or west from a given crossroad, provided there's no x in that direction. Also, there are 3 districts in the city with district 1 covering rows 0 to 2, district 2 covering rows 3 to 4, and district 3 covering rows 5 to 9. Ben has to visit at least 1 workshop in each district on his path to the destination. The roads are bidirectional. The answer should be a list of tuples (in Python syntax) indicating the index of workshops on Ben's path. The start and end workshops must be included in the path.
[x x x x x 8 x 15 18 10]
[4 5 10 6 20 2 12 x x x]
[19 6 19 7 6 2 x 15 x 14]
[16 17 x 2 3 7 4 x 18 6]
[x 2 1 19 7 10 18 5 3 19]
[8 5 x 1 x 10 17 x 13 5]
[18 1 3 4 x x 8 x 5 x]
[15 x x 13 x 11 x 2 x x]
[4 x x 4 1 x x x x x]
[x 10 8 x x 7 19 x x x] | traffic | pathfinding | 2 | [[5, 8], [4, 8], [4, 7], [4, 6], [3, 6], [3, 5], [2, 5], [2, 4], [3, 4], [3, 3], [4, 3], [4, 2], [4, 1], [3, 1], [3, 0]] | 105 | 0.02059459686279297 | 15 | 4 | 4 | [[["x", "x", "x", "x", "x", "8", "x", "15", "18", "10"], ["4", "5", "10", "6", "20", "2", "12", "x", "x", "x"], ["19", "6", "19", "7", "6", "2", "x", "15", "x", "14"], ["16", "17", "x", "2", "3", "7", "4", "x", "18", "6"], ["x", "2", "1", "19", "7", "10", "18", "5", "3", "19"], ["8", "5", "x", "1", "x", "10", "17", "x", "13", "5"], ["18", "1", "3", "4", "x", "x", "8", "x", "5", "x"], ["15", "x", "x", "13", "x", "11", "x", "2", "x", "x"], ["4", "x", "x", "4", "1", "x", "x", "x", "x", "x"], ["x", "10", "8", "x", "x", "7", "19", "x", "x", "x"]]] | [[["x", "x", "x", "x", "x", "8", "x", "15", "18", "10"], ["4", "5", "10", "6", "20", "2", "12", "x", "x", "x"], ["19", "6", "19", "7", "6", "2", "x", "15", "x", "14"], ["16", "17", "x", "2", "3", "7", "4", "x", "18", "6"], ["x", "2", "1", "19", "7", "10", "18", "5", "3", "19"], ["8", "5", "x", "1", "x", "10", "17", "x", "13", "5"], ["18", "1", "3", "4", "x", "x", "8", "x", "5", "x"], ["15", "x", "x", "13", "x", "11", "x", "2", "x", "x"], ["4", "x", "x", "4", "1", "x", "x", "x", "x", "x"], ["x", "10", "8", "x", "x", "7", "19", "x", "x", "x"]], [5, 8], [3, 0], 2, 4] | ["[['x', 'x', 'x', 'x', 'x', '8', 'x', '15', '18', '10'], ['4', '5', '10', '6', '20', '2', '12', 'x', 'x', 'x'], ['19', '6', '19', '7', '6', '2', 'x', '15', 'x', '14'], ['16', '17', 'x', '2', '3', '7', '4', 'x', '18', '6'], ['x', '2', '1', '19', '7', '10', '18', '5', '3', '19'], ['8', '5', 'x', '1', 'x', '10', '17', 'x', '13', '5'], ['18', '1', '3', '4', 'x', 'x', '8', 'x', '5', 'x'], ['15', 'x', 'x', '13', 'x', '11', 'x', '2', 'x', 'x'], ['4', 'x', 'x', '4', '1', 'x', 'x', 'x', 'x', 'x'], ['x', '10', '8', 'x', 'x', '7', '19', 'x', 'x', 'x']]", "(5, 8)", "(3, 0)", "2", "4"] |
23 | Alex is at a trampoline park with a grid of mini trampolines, arranged in a square of 10x10. Some trampolines are broken and unusable. A map of the park is provided below, with 1 indicating a broken trampoline and 0 indicating a functional one. Alex can jump to any of the eight adjacent trampolines, as long as they are not broken. However, Alex must make excatly 3 diagonal jumps, no more, no less, on his path to his destination. He is currently on the trampoline at position (1, 9) (positions are counted from 0, left to right, top to bottom) and wants to reach the trampoline at position (8, 3). What is the shortest sequence of trampolines he should jump on to reach his destination (including the first and final trampolines)? The answer should be a list of tuples, in Python syntax, indicating the row and column of each trampoline Alex jumps on.
1 0 0 1 0 1 1 0 1 1
0 0 1 0 0 1 1 1 1 0
1 0 0 0 1 1 0 0 0 0
1 1 0 0 1 1 1 1 0 0
0 0 1 1 1 0 1 0 0 0
1 0 1 0 0 0 0 0 0 1
1 0 1 0 0 0 0 1 1 1
1 0 1 0 1 0 1 0 1 1
1 0 1 0 0 1 1 1 1 1
1 1 1 0 1 1 0 0 1 0 | trampoline_matrix | pathfinding | 10 | [[1, 9], [2, 8], [3, 8], [4, 7], [5, 6], [5, 5], [6, 5], [6, 4], [6, 3], [7, 3], [8, 3]] | 11 | 0.028395891189575195 | 11 | 8 | 2 | ["[[1, 0, 0, 1, 0, 1, 1, 0, 1, 1], [0, 0, 1, 0, 0, 1, 1, 1, 1, 0], [1, 0, 0, 0, 1, 1, 0, 0, 0, 0], [1, 1, 0, 0, 1, 1, 1, 1, 0, 0], [0, 0, 1, 1, 1, 0, 1, 0, 0, 0], [1, 0, 1, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 0, 0, 0, 0, 1, 1, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 1], [1, 0, 1, 0, 0, 1, 1, 1, 1, 1], [1, 1, 1, 0, 1, 1, 0, 0, 1, 0]]", 3] | ["[[1, 0, 0, 1, 0, 1, 1, 0, 1, 1], [0, 0, 1, 0, 0, 1, 1, 1, 1, 0], [1, 0, 0, 0, 1, 1, 0, 0, 0, 0], [1, 1, 0, 0, 1, 1, 1, 1, 0, 0], [0, 0, 1, 1, 1, 0, 1, 0, 0, 0], [1, 0, 1, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 0, 0, 0, 0, 1, 1, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 1], [1, 0, 1, 0, 0, 1, 1, 1, 1, 1], [1, 1, 1, 0, 1, 1, 0, 0, 1, 0]]", [1, 9], [8, 3], 3] | ["[[1, 0, 0, 1, 0, 1, 1, 0, 1, 1], [0, 0, 1, 0, 0, 1, 1, 1, 1, 0], [1, 0, 0, 0, 1, 1, 0, 0, 0, 0], [1, 1, 0, 0, 1, 1, 1, 1, 0, 0], [0, 0, 1, 1, 1, 0, 1, 0, 0, 0], [1, 0, 1, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 0, 0, 0, 0, 1, 1, 1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 1], [1, 0, 1, 0, 0, 1, 1, 1, 1, 1], [1, 1, 1, 0, 1, 1, 0, 0, 1, 0]]", "(1, 9)", "(8, 3)", "3"] |
23 | Given 7 labeled water jugs with capacities 118, 15, 88, 145, 84, 14, 107, 31 liters, we aim to fill 3 unlabeled buckets, numbered 1 to 3 and arranged in a line in ascending order, with 226, 258, 296 liters of water respectively. The amount of water in each unlabeled bucket can not at any point in time exceed the amount of water in the bucket placed after it. Jugs can only be filled to the top and emptied completely, and the unlabeled buckets cannot be overfilled. An action, represented as a tuple ('+', X, Y) or ('-', X, Y), involves adding to or removing water from the unlabeled bucket numbered Y, using the jug with capacity X. Determine the shortest sequence of actions needed to fill the buckets as specified, and present the solution as a list of action tuples in Python syntax. | water_jug | subset_sum | 5 | [["+", 31, 3], ["+", 118, 3], ["+", 15, 3], ["+", 118, 3], ["+", 14, 3], ["+", 15, 2], ["+", 84, 2], ["+", 145, 2], ["+", 14, 2], ["+", 88, 1], ["+", 107, 1], ["+", 31, 1]] | 12 | 0.05219745635986328 | 12 | 48 | 3 | [[118, 15, 88, 145, 84, 14, 107, 31], [226, 258, 296]] | [[118, 15, 88, 145, 84, 14, 107, 31], [226, 258, 296]] | ["[118, 15, 88, 145, 84, 14, 107, 31]", "[226, 258, 296]"] |
24 | In the 8-puzzle game, you are given a grid with numbered square tiles arranged randomly and one tile missing. The goal is to arrange the tiles in descending order by sliding them into the empty space. The tiles can move in 4 directions: left, right, up, and down. Given the initial state of the puzzle below, where the empty spot is represented as “_”, provide the shortest list of tiles that need to be swapped with the empty spot to achieve the goal state. The goal state is when all tiles are in descending order, with the largest number in the top left corner, and the empty spot is in the bottom right corner. The solution should be a list of numbers in Python format, where each number represents the number on the tile that the empty spot is swapped with at each turn. Initial state of the puzzle: [[35, 92, '_'], [32, 44, 94], [97, 75, 58]] | 8_puzzle | puzzle | 5 | [92, 35, 32, 97, 75, 44, 97, 32, 35, 97, 94, 58, 44, 75, 32, 35, 97, 94, 75, 32, 35, 75, 58, 44] | 24 | 0.1467905044555664 | 24 | 4 | 9 | [[[35, 92, "_"], [32, 44, 94], [97, 75, 58]]] | [[[35, 92, "_"], [32, 44, 94], [97, 75, 58]]] | ["[[35, 92, '_'], [32, 44, 94], [97, 75, 58]]"] |
24 | In the game 'Sort the Chars', we are given a table of n by m dimensions. This table contains n words, each with m characters, except for the first word which has m - 1 characters. Each character is written on a separate tile. The objective of the game is to rearrange the characters such that row i spells the i-th word in the list, with the blank tile ('_') placed in the top left corner of the board in the end. We can rearrange the tiles by swapping the blank space with any of its 4 diagonal neighboring tiles. Given the list of words and initial state of the board below, where the black space is represented as '_', what is the shortest list of swap actions (reported in python syntax) that can sort the board into the given list of target words? The list must only include the 4 diagonal swap directions: up-right, down-right, up-left, or down-left, representing the direction in ehich the blank space was swpped in. Target words: pimp, sadhe, aurir, unzen The initial board: [['_', 'p', 'h', 'm', 'p'], ['s', 'a', 'd', 'r', 'e'], ['i', 'u', 'n', 'i', 'r'], ['u', 'a', 'z', 'e', 'n']] | 8_puzzle_words | puzzle | 2 | ["down-right", "down-left", "down-right", "up-right", "up-right", "up-left", "down-left", "up-left"] | 8 | 0.184800386428833 | 8 | 4 | 20 | [[["_", "p", "h", "m", "p"], ["s", "a", "d", "r", "e"], ["i", "u", "n", "i", "r"], ["u", "a", "z", "e", "n"]]] | [[["_", "p", "h", "m", "p"], ["s", "a", "d", "r", "e"], ["i", "u", "n", "i", "r"], ["u", "a", "z", "e", "n"]], ["pimp", "sadhe", "aurir", "unzen"]] | ["[['_', 'p', 'h', 'm', 'p'], ['s', 'a', 'd', 'r', 'e'], ['i', 'u', 'n', 'i', 'r'], ['u', 'a', 'z', 'e', 'n']]", "['pimp', 'sadhe', 'aurir', 'unzen']"] |
24 | We have a map of cities, each represented by a letter, and they are connected by one-way roads. The adjacency matrix below shows the connections between the cities. Each row and column represents a city, and a '1' signifies a direct road from the city of the row to the city of the column. The travel time between any two directly connected cities is the same. Currently, we are located in city 'D'. Our task is to visit city B and city L excatly twice. Determine the quickest route that allows us to visit both these destination cities, ensuring that we stop at the two destinations twice on our path. The sequence in which we visit the destination cities is not important. However, apart from L and B, we can only visit each city once on our path. Provide the solution as a list of the city names on our path, including the start, in Python syntax.
L H D O A M I J W Y B
L 0 1 0 1 0 0 0 1 0 1 0
H 0 0 0 0 1 0 1 0 1 1 0
D 0 1 0 0 0 0 0 0 0 0 0
O 0 1 1 0 1 0 0 0 0 0 1
A 0 0 1 0 0 0 0 0 0 0 1
M 1 1 0 0 0 0 0 0 0 0 0
I 0 0 0 0 0 0 0 1 0 1 0
J 1 0 0 1 0 1 0 0 1 0 0
W 1 0 0 1 0 1 1 0 0 0 1
Y 0 1 1 0 0 0 0 0 0 0 1
B 0 0 0 0 0 0 1 0 1 0 0
| city_directed_graph | pathfinding | 11 | ["D", "H", "A", "B", "W", "L", "J", "L", "O", "B"] | 10 | 0.0295867919921875 | 10 | 11 | 14 | [[[0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0], [0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 0], [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 1], [0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0], [1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0], [1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 1], [0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0]], ["L", "H", "D", "O", "A", "M", "I", "J", "W", "Y", "B"], "B", "L"] | [[[0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0], [0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 0], [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 1], [0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0], [1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0], [1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 1], [0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0]], ["L", "H", "D", "O", "A", "M", "I", "J", "W", "Y", "B"], "D", "B", "L"] | ["[[0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0], [0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 0], [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 1], [0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0], [1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0], [1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 1], [0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0]]", "['L', 'H', 'D', 'O', 'A', 'M', 'I', 'J', 'W', 'Y', 'B']", "['D']", "['B', 'L']"] |
24 | In the 'taxed coin exchange' problem, you are required to choose a subset of coins from this list [25, 29, 8, 11, 8, 25, 20, 16, 6, 4, 98, 7, 28, 24, 27, 16, 23, 26, 26, 99, 2, 7, 22, 7, 5, 24, 2], such that the sum of the chosen coins adds up to 305. Each coin in the list is unique and can only be used once. Also coins carry a tax value. The tax values for each coin is {24: 5, 26: 16, 28: 20, 2: 1, 22: 16, 25: 11, 27: 7, 11: 4, 6: 3, 99: 17, 8: 5, 7: 5, 5: 3, 23: 5, 4: 4, 98: 16, 16: 3, 29: 5, 20: 19}, where the tax for coins of the same value is the same. Also, if the coin chosen is smaller than the previous one, it must have an even value, otherwise, if the coin is larger than or equal to the previous coin chosen, it must have an odd value. The objective is to determine which subset of coins should be selected to minimize the total tax paid. The solution should be presented as a list of numbers, representing the value of the coins chosen in order, with the first coins chosen being in index 0, formatted in Python syntax. | coin_exchange | subset_sum | 17 | [98, 16, 29, 24, 16, 23, 99] | 54 | 0.034387826919555664 | 7 | 27 | 27 | [[25, 29, 8, 11, 8, 25, 20, 16, 6, 4, 98, 7, 28, 24, 27, 16, 23, 26, 26, 99, 2, 7, 22, 7, 5, 24, 2]] | [[25, 29, 8, 11, 8, 25, 20, 16, 6, 4, 98, 7, 28, 24, 27, 16, 23, 26, 26, 99, 2, 7, 22, 7, 5, 24, 2], {"24": 5, "26": 16, "28": 20, "2": 1, "22": 16, "25": 11, "27": 7, "11": 4, "6": 3, "99": 17, "8": 5, "7": 5, "5": 3, "23": 5, "4": 4, "98": 16, "16": 3, "29": 5, "20": 19}, 305] | ["[25, 29, 8, 11, 8, 25, 20, 16, 6, 4, 98, 7, 28, 24, 27, 16, 23, 26, 26, 99, 2, 7, 22, 7, 5, 24, 2]", "{24: 5, 26: 16, 28: 20, 2: 1, 22: 16, 25: 11, 27: 7, 11: 4, 6: 3, 99: 17, 8: 5, 7: 5, 5: 3, 23: 5, 4: 4, 98: 16, 16: 3, 29: 5, 20: 19}", "305"] |
24 | The game of 'Sort It' begins with 3 tubes, each filled with 4 balls of different colors. The goal is to sort the balls by color, with each tube containing balls of only one color. Only one ball can be moved at a time, taken from the top of one tube and placed on top of another. The capacity of each tube (maximum number of balls we can fit in each tube) is 6 balls. It is not allowed to place a ball in a tube that already has 6 balls. The solution should be a list of tuples, each containing, first, the index of the tube from which a ball is taken and, second, the index of the tube to which it is moved, indexing from 0. Given the initial state of the tubes, represented by the lists below (with the leftmost item being the color of the topmost ball in each tube), what is the shortest list of move tuples that will result in all the balls being correctly sorted? [['Red', 'Blue', 'Green', 'Blue'], ['Red', 'Red', 'Red', 'Green'], ['Blue', 'Green', 'Blue', 'Green']] | color_sorting | sorting | 7 | [[0, 1], [0, 2], [0, 1], [2, 0], [2, 0], [2, 0], [2, 0], [1, 2], [0, 1], [0, 2], [1, 0], [1, 0], [1, 2], [1, 2], [1, 2], [1, 0], [2, 1], [2, 1], [2, 1], [0, 2], [0, 1]] | 21 | 3.7056467533111572 | 21 | 6 | 12 | [[["Red", "Blue", "Green", "Blue"], ["Red", "Red", "Red", "Green"], ["Blue", "Green", "Blue", "Green"]], 6] | [[["Red", "Blue", "Green", "Blue"], ["Red", "Red", "Red", "Green"], ["Blue", "Green", "Blue", "Green"]], 6] | ["[['Red', 'Blue', 'Green', 'Blue'], ['Red', 'Red', 'Red', 'Green'], ['Blue', 'Green', 'Blue', 'Green']]", "6"] |
24 | We have a 3x3 numerical grid, with numbers ranging from 50 to 93 (50 included in the range but 93 is not included). The numbers in each row and column must be strictly increasing or decreasing. This means that either first > second > third or first < second < third in each row and column. If a grid cell is marked with an 'x', the number in that position is hidden. The objective is to replace the 'x's with unique integers from the given range, ensuring that each number only appears once in the grid. The replacements must maintain the consecutive order in each row and column. Additionally, the sum of the numbers in the topmost row plus the numbers in the rightmost column plus the numbers in the diagonal connecting the top-left corner of the grid to its bottom-right corner should be minimized. The solution should be given as a list of tuples in Python syntax. Each tuple should represent the replacement of a number with an 'x' number and contain three elements: the row index of the 'x', the column index of the 'x' (both starting from 0), and the value of the number that replaces the 'x'. The initial state of the grid is as follows:
Grid:
[['66' 'x' 'x']
['65' '68' 'x']
['x' 'x' '79']] | consecutive_grid | underdetermined_system | 8 | [[0, 1, 51], [0, 2, 50], [1, 2, 69], [2, 0, 52], [2, 1, 70]] | 578 | 0.18818449974060059 | 5 | 43 | 9 | ["[['66', '', ''], ['65', '68', ''], ['', '', '79']]", 50, 93] | ["[['66', '', ''], ['65', '68', ''], ['', '', '79']]", 50, 93] | ["[['66', '', ''], ['65', '68', ''], ['', '', '79']]", "50", "93"] |
24 | In the magic square problem, a 3x3 grid is filled with unique integers ranging from 9 to 48. Some numbers are already given, while others are unknown and represented as 'x'. Sum of column 1 (counting from 0) must be 115, and sum of row 1 must be 95. Also, the sum of the numbers in the diagonal from the top right to the bottom left corner of the grid should equal 133. The goal is to find unique integers (ie each number can be in the final grid only once) in the given range to replace with ‘x’s in the grid below such that the sum of the specified rows, columns, and diagonal equals the given amounts and the sum of all of the numbers in the grid is as low as possible. The solution should be provided as a list of tuples in Python syntax. Each tuple should contain three numbers for each 'x' position: the row index, the column index (both starting from 0), and the value of the unique integer replaced with 'x' at that position.
Grid:
[['x' 'x' 'x']
['x' 'x' 'x']
['42' '45' 'x']] | magic_square | underdetermined_system | 7 | [[0, 0, 9], [0, 1, 23], [0, 2, 44], [1, 0, 11], [1, 1, 47], [1, 2, 37], [2, 2, 10]] | 268 | 97.89336490631104 | 7 | 29 | 9 | ["[['', '', ''], ['', '', ''], ['42', '45', '']]", 3, 9, 48] | ["[['', '', ''], ['', '', ''], ['42', '45', '']]", 9, 48, [1, 2], [1, 2], [115], [95], 133] | ["[['', '', ''], ['', '', ''], ['42', '45', '']]", "9", "48", "[None, 115, None]", "[None, 95, None]", "133"] |
24 | In 'Restricted Sorting', there are 6 stacks each with a capacity of 4 blocks, with 3 stacks filled with blocks of varying shades and the remaining are empty. The challenge is to sort the blocks by shade such that if a stack is not empty, it is stacked with 3 blocks of a single shade. The player can only transfer one block at a time from the top of a stack to an empty stack or to a stack that has only blocks of that shade, without exceeding the stacks’ capacity. Transferring blocks to certain stacks is more expensive than others. The cost of moving one block to the top of each stack is: {0: 5, 1: 1, 2: 6, 3: 7, 4: 7, 5: 7}, where the keys are the index of each stack, indexing from 0. The cost of moving a block is always at least 1. The solution should be a list of tuples, each containing, first, the index of the stack from which a block is picked up from and, second, the index of the stack to which it is transferred, indexing from 0. Given the initial state of the stacks, represented by the lists below (with the leftmost item being the shade of the topmost block in each stack)(and the first stack being the stack at index 0), what is the list of transfer pairs (reported in python syntax) with the least possible cost, that will result in all the blocks being correctly sorted? [[], [], ['Green', 'Yellow', 'Green', 'Red'], ['Green', 'Red', 'Blue', 'Yellow'], [], ['Blue', 'Red', 'Yellow', 'Blue']] | restricted_sorting | sorting | 1 | [[3, 4], [2, 4], [2, 0], [2, 4], [3, 2], [5, 1], [5, 2], [5, 0], [3, 1], [3, 0], [5, 1]] | 51 | 0.07999825477600098 | 11 | 30 | 12 | [[[], [], ["Green", "Yellow", "Green", "Red"], ["Green", "Red", "Blue", "Yellow"], [], ["Blue", "Red", "Yellow", "Blue"]], 4, {"0": 5, "1": 1, "2": 6, "3": 7, "4": 7, "5": 7}] | [[[], [], ["Green", "Yellow", "Green", "Red"], ["Green", "Red", "Blue", "Yellow"], [], ["Blue", "Red", "Yellow", "Blue"]], 4, {"0": 5, "1": 1, "2": 6, "3": 7, "4": 7, "5": 7}, 3] | ["[[], [], ['Green', 'Yellow', 'Green', 'Red'], ['Green', 'Red', 'Blue', 'Yellow'], [], ['Blue', 'Red', 'Yellow', 'Blue']]", "{0: 5, 1: 1, 2: 6, 3: 7, 4: 7, 5: 7}", "4", "3"] |
24 | Using the provided matrix map of a city, where numbers represent travel time in minutes (all numbers are positive integers) and 'x' marks closed workshops, find the quickest route for Ben to travel from his current workshop at index (5, 1) to his destination workshop at index (3, 9), indexing from 0. Ben's car can move north, south, east, or west from a given crossroad, provided there's no x in that direction. Also, there are 3 districts in the city with district 1 covering rows 0 to 3, district 2 covering rows 4 to 4, and district 3 covering rows 5 to 9. Ben has to visit at least 1 workshop in each district on his path to the destination. The roads are bidirectional. The answer should be a list of tuples (in Python syntax) indicating the index of workshops on Ben's path. The start and end workshops must be included in the path.
[18 19 9 x x x 3 x 8 x]
[13 2 3 15 3 x 8 9 x x]
[x 6 18 1 20 7 16 8 1 19]
[x x x 20 14 x 19 11 9 6]
[2 x x 6 5 6 7 1 x 8]
[17 9 5 3 3 x 16 18 x 8]
[10 x 14 16 x 8 x 9 6 x]
[x 17 8 11 12 x 4 8 x 13]
[x x 6 x x x x 13 x 7]
[9 x x x 3 10 x 3 10 1] | traffic | pathfinding | 2 | [[5, 1], [5, 2], [5, 3], [5, 4], [4, 4], [4, 5], [4, 6], [4, 7], [3, 7], [3, 8], [3, 9]] | 56 | 0.020661354064941406 | 11 | 4 | 4 | [[["18", "19", "9", "x", "x", "x", "3", "x", "8", "x"], ["13", "2", "3", "15", "3", "x", "8", "9", "x", "x"], ["x", "6", "18", "1", "20", "7", "16", "8", "1", "19"], ["x", "x", "x", "20", "14", "x", "19", "11", "9", "6"], ["2", "x", "x", "6", "5", "6", "7", "1", "x", "8"], ["17", "9", "5", "3", "3", "x", "16", "18", "x", "8"], ["10", "x", "14", "16", "x", "8", "x", "9", "6", "x"], ["x", "17", "8", "11", "12", "x", "4", "8", "x", "13"], ["x", "x", "6", "x", "x", "x", "x", "13", "x", "7"], ["9", "x", "x", "x", "3", "10", "x", "3", "10", "1"]]] | [[["18", "19", "9", "x", "x", "x", "3", "x", "8", "x"], ["13", "2", "3", "15", "3", "x", "8", "9", "x", "x"], ["x", "6", "18", "1", "20", "7", "16", "8", "1", "19"], ["x", "x", "x", "20", "14", "x", "19", "11", "9", "6"], ["2", "x", "x", "6", "5", "6", "7", "1", "x", "8"], ["17", "9", "5", "3", "3", "x", "16", "18", "x", "8"], ["10", "x", "14", "16", "x", "8", "x", "9", "6", "x"], ["x", "17", "8", "11", "12", "x", "4", "8", "x", "13"], ["x", "x", "6", "x", "x", "x", "x", "13", "x", "7"], ["9", "x", "x", "x", "3", "10", "x", "3", "10", "1"]], [5, 1], [3, 9], 3, 4] | ["[['18', '19', '9', 'x', 'x', 'x', '3', 'x', '8', 'x'], ['13', '2', '3', '15', '3', 'x', '8', '9', 'x', 'x'], ['x', '6', '18', '1', '20', '7', '16', '8', '1', '19'], ['x', 'x', 'x', '20', '14', 'x', '19', '11', '9', '6'], ['2', 'x', 'x', '6', '5', '6', '7', '1', 'x', '8'], ['17', '9', '5', '3', '3', 'x', '16', '18', 'x', '8'], ['10', 'x', '14', '16', 'x', '8', 'x', '9', '6', 'x'], ['x', '17', '8', '11', '12', 'x', '4', '8', 'x', '13'], ['x', 'x', '6', 'x', 'x', 'x', 'x', '13', 'x', '7'], ['9', 'x', 'x', 'x', '3', '10', 'x', '3', '10', '1']]", "(5, 1)", "(3, 9)", "3", "4"] |
24 | Alex is at a trampoline park with a grid of mini trampolines, arranged in a square of 10x10. Some trampolines are broken and unusable. A map of the park is provided below, with 1 indicating a broken trampoline and 0 indicating a functional one. Alex can jump to any of the eight adjacent trampolines, as long as they are not broken. However, Alex must make excatly 3 diagonal jumps, no more, no less, on his path to his destination. He is currently on the trampoline at position (9, 9) (positions are counted from 0, left to right, top to bottom) and wants to reach the trampoline at position (4, 1). What is the shortest sequence of trampolines he should jump on to reach his destination (including the first and final trampolines)? The answer should be a list of tuples, in Python syntax, indicating the row and column of each trampoline Alex jumps on.
1 1 1 1 0 1 0 0 0 0
1 1 0 0 0 0 0 0 0 1
1 0 1 0 1 1 0 1 1 1
1 0 1 0 1 1 0 1 1 1
1 0 1 1 0 1 1 1 0 1
1 0 1 1 1 0 1 1 1 1
1 0 0 1 1 1 1 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 1 0
0 1 1 0 0 1 1 1 0 0 | trampoline_matrix | pathfinding | 10 | [[9, 9], [9, 8], [8, 7], [7, 6], [7, 5], [7, 4], [7, 3], [6, 2], [6, 1], [5, 1], [4, 1]] | 11 | 0.030521631240844727 | 11 | 8 | 2 | ["[[1, 1, 1, 1, 0, 1, 0, 0, 0, 0], [1, 1, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 0, 1, 1, 0, 1, 1, 1], [1, 0, 1, 0, 1, 1, 0, 1, 1, 1], [1, 0, 1, 1, 0, 1, 1, 1, 0, 1], [1, 0, 1, 1, 1, 0, 1, 1, 1, 1], [1, 0, 0, 1, 1, 1, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 1, 0], [0, 1, 1, 0, 0, 1, 1, 1, 0, 0]]", 3] | ["[[1, 1, 1, 1, 0, 1, 0, 0, 0, 0], [1, 1, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 0, 1, 1, 0, 1, 1, 1], [1, 0, 1, 0, 1, 1, 0, 1, 1, 1], [1, 0, 1, 1, 0, 1, 1, 1, 0, 1], [1, 0, 1, 1, 1, 0, 1, 1, 1, 1], [1, 0, 0, 1, 1, 1, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 1, 0], [0, 1, 1, 0, 0, 1, 1, 1, 0, 0]]", [9, 9], [4, 1], 3] | ["[[1, 1, 1, 1, 0, 1, 0, 0, 0, 0], [1, 1, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 0, 1, 1, 0, 1, 1, 1], [1, 0, 1, 0, 1, 1, 0, 1, 1, 1], [1, 0, 1, 1, 0, 1, 1, 1, 0, 1], [1, 0, 1, 1, 1, 0, 1, 1, 1, 1], [1, 0, 0, 1, 1, 1, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 1, 0], [0, 1, 1, 0, 0, 1, 1, 1, 0, 0]]", "(9, 9)", "(4, 1)", "3"] |
24 | Given 7 labeled water jugs with capacities 33, 56, 108, 53, 65, 54, 52, 59 liters, we aim to fill 3 unlabeled buckets, numbered 1 to 3 and arranged in a line in ascending order, with 168, 239, 307 liters of water respectively. The amount of water in each unlabeled bucket can not at any point in time exceed the amount of water in the bucket placed after it. Jugs can only be filled to the top and emptied completely, and the unlabeled buckets cannot be overfilled. An action, represented as a tuple ('+', X, Y) or ('-', X, Y), involves adding to or removing water from the unlabeled bucket numbered Y, using the jug with capacity X. Determine the shortest sequence of actions needed to fill the buckets as specified, and present the solution as a list of action tuples in Python syntax. | water_jug | subset_sum | 5 | [["+", 59, 3], ["+", 108, 3], ["+", 108, 3], ["-", 33, 3], ["+", 65, 3], ["+", 108, 2], ["+", 108, 2], ["-", 33, 2], ["+", 56, 2], ["+", 53, 1], ["+", 56, 1], ["+", 59, 1]] | 12 | 0.04154396057128906 | 12 | 48 | 3 | [[33, 56, 108, 53, 65, 54, 52, 59], [168, 239, 307]] | [[33, 56, 108, 53, 65, 54, 52, 59], [168, 239, 307]] | ["[33, 56, 108, 53, 65, 54, 52, 59]", "[168, 239, 307]"] |
25 | In the 8-puzzle game, you are given a grid with numbered square tiles arranged randomly and one tile missing. The goal is to arrange the tiles in descending order by sliding them into the empty space. The tiles can move in 4 directions: left, right, up, and down. Given the initial state of the puzzle below, where the empty spot is represented as “_”, provide the shortest list of tiles that need to be swapped with the empty spot to achieve the goal state. The goal state is when all tiles are in descending order, with the largest number in the top left corner, and the empty spot is in the bottom right corner. The solution should be a list of numbers in Python format, where each number represents the number on the tile that the empty spot is swapped with at each turn. Initial state of the puzzle: [[45, 13, '_'], [66, 41, 76], [85, 21, 74]] | 8_puzzle | puzzle | 6 | [76, 41, 13, 76, 41, 13, 66, 85, 21, 74, 13, 41, 76, 45, 85, 66, 74, 13, 41, 74, 45, 76, 74, 41] | 24 | 0.10150957107543945 | 24 | 4 | 9 | [[[45, 13, "_"], [66, 41, 76], [85, 21, 74]]] | [[[45, 13, "_"], [66, 41, 76], [85, 21, 74]]] | ["[[45, 13, '_'], [66, 41, 76], [85, 21, 74]]"] |
25 | In the game 'Sort the Chars', we are given a table of n by m dimensions. This table contains n words, each with m characters, except for the first word which has m - 1 characters. Each character is written on a separate tile. The objective of the game is to rearrange the characters such that row i spells the i-th word in the list, with the blank tile ('_') placed in the top left corner of the board in the end. We can rearrange the tiles by swapping the blank space with any of its 4 diagonal neighboring tiles. Given the list of words and initial state of the board below, where the black space is represented as '_', what is the shortest list of swap actions (reported in python syntax) that can sort the board into the given list of target words? The list must only include the 4 diagonal swap directions: up-right, down-right, up-left, or down-left, representing the direction in ehich the blank space was swpped in. Target words: guha, nisus, uncap, jough The initial board: [['i', 'g', 'u', 'h', 'a'], ['n', 'o', 's', 'u', 's'], ['c', 'n', 'g', 'a', '_'], ['j', 'u', 'u', 'p', 'h']] | 8_puzzle_words | puzzle | 2 | ["down-left", "up-left", "up-left", "down-left", "down-right", "up-right", "up-left", "up-left"] | 8 | 0.21672630310058594 | 8 | 4 | 20 | [[["i", "g", "u", "h", "a"], ["n", "o", "s", "u", "s"], ["c", "n", "g", "a", "_"], ["j", "u", "u", "p", "h"]]] | [[["i", "g", "u", "h", "a"], ["n", "o", "s", "u", "s"], ["c", "n", "g", "a", "_"], ["j", "u", "u", "p", "h"]], ["guha", "nisus", "uncap", "jough"]] | ["[['i', 'g', 'u', 'h', 'a'], ['n', 'o', 's', 'u', 's'], ['c', 'n', 'g', 'a', '_'], ['j', 'u', 'u', 'p', 'h']]", "['guha', 'nisus', 'uncap', 'jough']"] |
25 | We have a map of cities, each represented by a letter, and they are connected by one-way roads. The adjacency matrix below shows the connections between the cities. Each row and column represents a city, and a '1' signifies a direct road from the city of the row to the city of the column. The travel time between any two directly connected cities is the same. Currently, we are located in city 'M'. Our task is to visit city Y and city X excatly twice. Determine the quickest route that allows us to visit both these destination cities, ensuring that we stop at the two destinations twice on our path. The sequence in which we visit the destination cities is not important. However, apart from X and Y, we can only visit each city once on our path. Provide the solution as a list of the city names on our path, including the start, in Python syntax.
O M Y J Z V K F X L R
O 0 0 0 0 1 0 0 0 0 1 1
M 0 0 0 0 0 1 0 0 0 0 0
Y 1 1 0 0 0 1 0 0 0 0 1
J 0 0 0 0 1 0 0 1 1 1 0
Z 0 0 0 0 0 0 1 0 0 0 0
V 0 0 0 0 0 0 0 1 0 0 0
K 0 1 1 0 1 1 0 0 0 0 0
F 1 0 1 0 0 0 0 0 0 0 0
X 0 0 0 1 1 1 1 0 0 0 0
L 1 1 0 0 0 0 1 0 1 0 0
R 0 0 0 1 0 1 0 1 0 0 0
| city_directed_graph | pathfinding | 11 | ["M", "V", "F", "Y", "O", "L", "X", "J", "X", "K", "Y"] | 11 | 0.02562737464904785 | 11 | 11 | 14 | [[[0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1], [0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], [1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1], [0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0], [0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0], [1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0], [1, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0], [0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0]], ["O", "M", "Y", "J", "Z", "V", "K", "F", "X", "L", "R"], "Y", "X"] | [[[0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1], [0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], [1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1], [0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0], [0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0], [1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0], [1, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0], [0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0]], ["O", "M", "Y", "J", "Z", "V", "K", "F", "X", "L", "R"], "M", "Y", "X"] | ["[[0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1], [0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], [1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1], [0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0], [0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0], [1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0], [1, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0], [0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0]]", "['O', 'M', 'Y', 'J', 'Z', 'V', 'K', 'F', 'X', 'L', 'R']", "['M']", "['Y', 'X']"] |
25 | In the 'taxed coin exchange' problem, you are required to choose a subset of coins from this list [28, 5, 25, 22, 26, 13, 20, 20, 18, 28, 7, 20, 18, 19, 18, 5, 15, 23, 28, 27, 22, 10, 8, 17, 3, 8, 5, 11, 21, 17, 65, 23, 11, 3, 12], such that the sum of the chosen coins adds up to 284. Each coin in the list is unique and can only be used once. Also coins carry a tax value. The tax values for each coin is {20: 12, 21: 3, 5: 2, 3: 2, 7: 1, 15: 8, 8: 7, 27: 6, 17: 8, 18: 14, 28: 5, 13: 1, 23: 4, 65: 8, 26: 8, 22: 5, 25: 3, 11: 11, 12: 8, 19: 19, 10: 7}, where the tax for coins of the same value is the same. Also, if the coin chosen is smaller than the previous one, it must have an even value, otherwise, if the coin is larger than or equal to the previous coin chosen, it must have an odd value. The objective is to determine which subset of coins should be selected to minimize the total tax paid. The solution should be presented as a list of numbers, representing the value of the coins chosen in order, with the first coins chosen being in index 0, formatted in Python syntax. | coin_exchange | subset_sum | 18 | [7, 13, 21, 23, 25, 65, 28, 22, 23, 22, 27, 8] | 52 | 0.03629875183105469 | 12 | 35 | 35 | [[28, 5, 25, 22, 26, 13, 20, 20, 18, 28, 7, 20, 18, 19, 18, 5, 15, 23, 28, 27, 22, 10, 8, 17, 3, 8, 5, 11, 21, 17, 65, 23, 11, 3, 12]] | [[28, 5, 25, 22, 26, 13, 20, 20, 18, 28, 7, 20, 18, 19, 18, 5, 15, 23, 28, 27, 22, 10, 8, 17, 3, 8, 5, 11, 21, 17, 65, 23, 11, 3, 12], {"20": 12, "21": 3, "5": 2, "3": 2, "7": 1, "15": 8, "8": 7, "27": 6, "17": 8, "18": 14, "28": 5, "13": 1, "23": 4, "65": 8, "26": 8, "22": 5, "25": 3, "11": 11, "12": 8, "19": 19, "10": 7}, 284] | ["[28, 5, 25, 22, 26, 13, 20, 20, 18, 28, 7, 20, 18, 19, 18, 5, 15, 23, 28, 27, 22, 10, 8, 17, 3, 8, 5, 11, 21, 17, 65, 23, 11, 3, 12]", "{20: 12, 21: 3, 5: 2, 3: 2, 7: 1, 15: 8, 8: 7, 27: 6, 17: 8, 18: 14, 28: 5, 13: 1, 23: 4, 65: 8, 26: 8, 22: 5, 25: 3, 11: 11, 12: 8, 19: 19, 10: 7}", "284"] |
25 | The game of 'Sort It' begins with 3 tubes, each filled with 4 balls of different colors. The goal is to sort the balls by color, with each tube containing balls of only one color. Only one ball can be moved at a time, taken from the top of one tube and placed on top of another. The capacity of each tube (maximum number of balls we can fit in each tube) is 6 balls. It is not allowed to place a ball in a tube that already has 6 balls. The solution should be a list of tuples, each containing, first, the index of the tube from which a ball is taken and, second, the index of the tube to which it is moved, indexing from 0. Given the initial state of the tubes, represented by the lists below (with the leftmost item being the color of the topmost ball in each tube), what is the shortest list of move tuples that will result in all the balls being correctly sorted? [['Green', 'Green', 'Red', 'Red'], ['Blue', 'Blue', 'Blue', 'Blue'], ['Green', 'Red', 'Green', 'Red']] | color_sorting | sorting | 7 | [[2, 0], [2, 1], [2, 0], [2, 1], [0, 2], [0, 2], [0, 2], [0, 2], [1, 0], [1, 0]] | 10 | 0.04879570007324219 | 10 | 6 | 12 | [[["Green", "Green", "Red", "Red"], ["Blue", "Blue", "Blue", "Blue"], ["Green", "Red", "Green", "Red"]], 6] | [[["Green", "Green", "Red", "Red"], ["Blue", "Blue", "Blue", "Blue"], ["Green", "Red", "Green", "Red"]], 6] | ["[['Green', 'Green', 'Red', 'Red'], ['Blue', 'Blue', 'Blue', 'Blue'], ['Green', 'Red', 'Green', 'Red']]", "6"] |
25 | We have a 3x3 numerical grid, with numbers ranging from 29 to 72 (29 included in the range but 72 is not included). The numbers in each row and column must be strictly increasing or decreasing. This means that either first > second > third or first < second < third in each row and column. If a grid cell is marked with an 'x', the number in that position is hidden. The objective is to replace the 'x's with unique integers from the given range, ensuring that each number only appears once in the grid. The replacements must maintain the consecutive order in each row and column. Additionally, the sum of the numbers in the topmost row plus the numbers in the rightmost column plus the numbers in the diagonal connecting the top-left corner of the grid to its bottom-right corner should be minimized. The solution should be given as a list of tuples in Python syntax. Each tuple should represent the replacement of a number with an 'x' number and contain three elements: the row index of the 'x', the column index of the 'x' (both starting from 0), and the value of the number that replaces the 'x'. The initial state of the grid is as follows:
Grid:
[['x' 'x' 'x']
['39' 'x' '52']
['60' 'x' 'x']] | consecutive_grid | underdetermined_system | 9 | [[0, 0, 29], [0, 1, 31], [0, 2, 53], [1, 1, 40], [2, 1, 41], [2, 2, 30]] | 347 | 36.68832039833069 | 6 | 43 | 9 | ["[['', '', ''], ['39', '', '52'], ['60', '', '']]", 29, 72] | ["[['', '', ''], ['39', '', '52'], ['60', '', '']]", 29, 72] | ["[['', '', ''], ['39', '', '52'], ['60', '', '']]", "29", "72"] |
25 | In the magic square problem, a 3x3 grid is filled with unique integers ranging from 9 to 48. Some numbers are already given, while others are unknown and represented as 'x'. Sum of column 1 (counting from 0) must be 67, and sum of row 1 must be 60. Also, the sum of the numbers in the diagonal from the top right to the bottom left corner of the grid should equal 89. The goal is to find unique integers (ie each number can be in the final grid only once) in the given range to replace with ‘x’s in the grid below such that the sum of the specified rows, columns, and diagonal equals the given amounts and the sum of all of the numbers in the grid is as low as possible. The solution should be provided as a list of tuples in Python syntax. Each tuple should contain three numbers for each 'x' position: the row index, the column index (both starting from 0), and the value of the unique integer replaced with 'x' at that position.
Grid:
[['x' '16' 'x']
['x' 'x' 'x']
['45' 'x' 'x']] | magic_square | underdetermined_system | 6 | [[0, 0, 9], [0, 2, 10], [1, 0, 12], [1, 1, 34], [1, 2, 14], [2, 1, 17], [2, 2, 11]] | 168 | 0.5386793613433838 | 7 | 34 | 9 | ["[['', '16', ''], ['', '', ''], ['45', '', '']]", 3, 9, 48] | ["[['', '16', ''], ['', '', ''], ['45', '', '']]", 9, 48, [1, 2], [1, 2], [67], [60], 89] | ["[['', '16', ''], ['', '', ''], ['45', '', '']]", "9", "48", "[None, 67, None]", "[None, 60, None]", "89"] |
25 | In 'Restricted Sorting', there are 6 stacks each with a capacity of 4 blocks, with 3 stacks filled with blocks of varying shades and the remaining are empty. The challenge is to sort the blocks by shade such that if a stack is not empty, it is stacked with 3 blocks of a single shade. The player can only transfer one block at a time from the top of a stack to an empty stack or to a stack that has only blocks of that shade, without exceeding the stacks’ capacity. Transferring blocks to certain stacks is more expensive than others. The cost of moving one block to the top of each stack is: {0: 4, 1: 3, 2: 2, 3: 4, 4: 2, 5: 5}, where the keys are the index of each stack, indexing from 0. The cost of moving a block is always at least 1. The solution should be a list of tuples, each containing, first, the index of the stack from which a block is picked up from and, second, the index of the stack to which it is transferred, indexing from 0. Given the initial state of the stacks, represented by the lists below (with the leftmost item being the shade of the topmost block in each stack)(and the first stack being the stack at index 0), what is the list of transfer pairs (reported in python syntax) with the least possible cost, that will result in all the blocks being correctly sorted? [[], ['Green', 'Blue', 'Yellow', 'Green'], ['Yellow', 'Red', 'Red', 'Blue'], [], ['Blue', 'Green', 'Yellow', 'Red'], []] | restricted_sorting | sorting | 1 | [[2, 0], [4, 3], [4, 5], [4, 0], [2, 4], [2, 4], [2, 3], [1, 2], [1, 3], [1, 0], [1, 2], [5, 2]] | 39 | 0.023729562759399414 | 12 | 30 | 12 | [[[], ["Green", "Blue", "Yellow", "Green"], ["Yellow", "Red", "Red", "Blue"], [], ["Blue", "Green", "Yellow", "Red"], []], 4, {"0": 4, "1": 3, "2": 2, "3": 4, "4": 2, "5": 5}] | [[[], ["Green", "Blue", "Yellow", "Green"], ["Yellow", "Red", "Red", "Blue"], [], ["Blue", "Green", "Yellow", "Red"], []], 4, {"0": 4, "1": 3, "2": 2, "3": 4, "4": 2, "5": 5}, 3] | ["[[], ['Green', 'Blue', 'Yellow', 'Green'], ['Yellow', 'Red', 'Red', 'Blue'], [], ['Blue', 'Green', 'Yellow', 'Red'], []]", "{0: 4, 1: 3, 2: 2, 3: 4, 4: 2, 5: 5}", "4", "3"] |
25 | Using the provided matrix map of a city, where numbers represent travel time in minutes (all numbers are positive integers) and 'x' marks closed workshops, find the quickest route for Ben to travel from his current workshop at index (2, 9) to his destination workshop at index (5, 2), indexing from 0. Ben's car can move north, south, east, or west from a given crossroad, provided there's no x in that direction. Also, there are 3 districts in the city with district 1 covering rows 0 to 2, district 2 covering rows 3 to 4, and district 3 covering rows 5 to 9. Ben has to visit at least 1 workshop in each district on his path to the destination. The roads are bidirectional. The answer should be a list of tuples (in Python syntax) indicating the index of workshops on Ben's path. The start and end workshops must be included in the path.
[x x 6 x x x x 15 x x]
[x 17 13 13 x 12 x 3 10 2]
[x 5 13 15 4 x x 20 6 2]
[x 9 x 6 2 16 18 9 13 x]
[x x 15 17 x 10 11 x x x]
[3 x 3 17 8 x 1 x 16 x]
[x x 13 15 x x 11 x x 4]
[x x 12 1 x x x 14 11 x]
[x 14 x x 19 13 4 x x x]
[1 x x 14 11 19 2 17 2 5] | traffic | pathfinding | 2 | [[2, 9], [2, 8], [3, 8], [3, 7], [3, 6], [3, 5], [3, 4], [3, 3], [4, 3], [4, 2], [5, 2]] | 105 | 0.022072553634643555 | 11 | 4 | 4 | [[["x", "x", "6", "x", "x", "x", "x", "15", "x", "x"], ["x", "17", "13", "13", "x", "12", "x", "3", "10", "2"], ["x", "5", "13", "15", "4", "x", "x", "20", "6", "2"], ["x", "9", "x", "6", "2", "16", "18", "9", "13", "x"], ["x", "x", "15", "17", "x", "10", "11", "x", "x", "x"], ["3", "x", "3", "17", "8", "x", "1", "x", "16", "x"], ["x", "x", "13", "15", "x", "x", "11", "x", "x", "4"], ["x", "x", "12", "1", "x", "x", "x", "14", "11", "x"], ["x", "14", "x", "x", "19", "13", "4", "x", "x", "x"], ["1", "x", "x", "14", "11", "19", "2", "17", "2", "5"]]] | [[["x", "x", "6", "x", "x", "x", "x", "15", "x", "x"], ["x", "17", "13", "13", "x", "12", "x", "3", "10", "2"], ["x", "5", "13", "15", "4", "x", "x", "20", "6", "2"], ["x", "9", "x", "6", "2", "16", "18", "9", "13", "x"], ["x", "x", "15", "17", "x", "10", "11", "x", "x", "x"], ["3", "x", "3", "17", "8", "x", "1", "x", "16", "x"], ["x", "x", "13", "15", "x", "x", "11", "x", "x", "4"], ["x", "x", "12", "1", "x", "x", "x", "14", "11", "x"], ["x", "14", "x", "x", "19", "13", "4", "x", "x", "x"], ["1", "x", "x", "14", "11", "19", "2", "17", "2", "5"]], [2, 9], [5, 2], 2, 4] | ["[['x', 'x', '6', 'x', 'x', 'x', 'x', '15', 'x', 'x'], ['x', '17', '13', '13', 'x', '12', 'x', '3', '10', '2'], ['x', '5', '13', '15', '4', 'x', 'x', '20', '6', '2'], ['x', '9', 'x', '6', '2', '16', '18', '9', '13', 'x'], ['x', 'x', '15', '17', 'x', '10', '11', 'x', 'x', 'x'], ['3', 'x', '3', '17', '8', 'x', '1', 'x', '16', 'x'], ['x', 'x', '13', '15', 'x', 'x', '11', 'x', 'x', '4'], ['x', 'x', '12', '1', 'x', 'x', 'x', '14', '11', 'x'], ['x', '14', 'x', 'x', '19', '13', '4', 'x', 'x', 'x'], ['1', 'x', 'x', '14', '11', '19', '2', '17', '2', '5']]", "(2, 9)", "(5, 2)", "2", "4"] |
25 | Alex is at a trampoline park with a grid of mini trampolines, arranged in a square of 10x10. Some trampolines are broken and unusable. A map of the park is provided below, with 1 indicating a broken trampoline and 0 indicating a functional one. Alex can jump to any of the eight adjacent trampolines, as long as they are not broken. However, Alex must make excatly 3 diagonal jumps, no more, no less, on his path to his destination. He is currently on the trampoline at position (0, 0) (positions are counted from 0, left to right, top to bottom) and wants to reach the trampoline at position (7, 6). What is the shortest sequence of trampolines he should jump on to reach his destination (including the first and final trampolines)? The answer should be a list of tuples, in Python syntax, indicating the row and column of each trampoline Alex jumps on.
0 0 0 1 1 1 0 1 0 0
0 0 0 1 1 0 1 1 0 1
1 0 1 1 1 1 0 0 1 1
0 1 0 1 0 0 1 1 1 1
0 0 0 0 0 0 1 1 1 1
1 1 1 0 0 0 1 1 1 0
1 0 1 1 0 0 1 1 1 1
1 0 1 1 1 0 0 0 0 0
1 1 0 1 0 1 1 1 0 0
0 1 1 1 0 1 1 1 1 1 | trampoline_matrix | pathfinding | 10 | [[0, 0], [1, 0], [1, 1], [2, 1], [3, 2], [4, 2], [4, 3], [4, 4], [5, 4], [6, 5], [7, 6]] | 11 | 0.031239748001098633 | 11 | 8 | 2 | ["[[0, 0, 0, 1, 1, 1, 0, 1, 0, 0], [0, 0, 0, 1, 1, 0, 1, 1, 0, 1], [1, 0, 1, 1, 1, 1, 0, 0, 1, 1], [0, 1, 0, 1, 0, 0, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 1, 1, 1, 1], [1, 1, 1, 0, 0, 0, 1, 1, 1, 0], [1, 0, 1, 1, 0, 0, 1, 1, 1, 1], [1, 0, 1, 1, 1, 0, 0, 0, 0, 0], [1, 1, 0, 1, 0, 1, 1, 1, 0, 0], [0, 1, 1, 1, 0, 1, 1, 1, 1, 1]]", 3] | ["[[0, 0, 0, 1, 1, 1, 0, 1, 0, 0], [0, 0, 0, 1, 1, 0, 1, 1, 0, 1], [1, 0, 1, 1, 1, 1, 0, 0, 1, 1], [0, 1, 0, 1, 0, 0, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 1, 1, 1, 1], [1, 1, 1, 0, 0, 0, 1, 1, 1, 0], [1, 0, 1, 1, 0, 0, 1, 1, 1, 1], [1, 0, 1, 1, 1, 0, 0, 0, 0, 0], [1, 1, 0, 1, 0, 1, 1, 1, 0, 0], [0, 1, 1, 1, 0, 1, 1, 1, 1, 1]]", [0, 0], [7, 6], 3] | ["[[0, 0, 0, 1, 1, 1, 0, 1, 0, 0], [0, 0, 0, 1, 1, 0, 1, 1, 0, 1], [1, 0, 1, 1, 1, 1, 0, 0, 1, 1], [0, 1, 0, 1, 0, 0, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 1, 1, 1, 1], [1, 1, 1, 0, 0, 0, 1, 1, 1, 0], [1, 0, 1, 1, 0, 0, 1, 1, 1, 1], [1, 0, 1, 1, 1, 0, 0, 0, 0, 0], [1, 1, 0, 1, 0, 1, 1, 1, 0, 0], [0, 1, 1, 1, 0, 1, 1, 1, 1, 1]]", "(0, 0)", "(7, 6)", "3"] |
25 | Given 7 labeled water jugs with capacities 75, 20, 64, 106, 88, 13, 107, 131 liters, we aim to fill 3 unlabeled buckets, numbered 1 to 3 and arranged in a line in ascending order, with 287, 394, 455 liters of water respectively. The amount of water in each unlabeled bucket can not at any point in time exceed the amount of water in the bucket placed after it. Jugs can only be filled to the top and emptied completely, and the unlabeled buckets cannot be overfilled. An action, represented as a tuple ('+', X, Y) or ('-', X, Y), involves adding to or removing water from the unlabeled bucket numbered Y, using the jug with capacity X. Determine the shortest sequence of actions needed to fill the buckets as specified, and present the solution as a list of action tuples in Python syntax. | water_jug | subset_sum | 5 | [["+", 75, 3], ["+", 131, 3], ["+", 131, 3], ["-", 13, 3], ["+", 131, 3], ["+", 106, 2], ["+", 106, 2], ["+", 75, 2], ["+", 107, 2], ["+", 75, 1], ["+", 106, 1], ["+", 106, 1]] | 12 | 0.05149412155151367 | 12 | 48 | 3 | [[75, 20, 64, 106, 88, 13, 107, 131], [287, 394, 455]] | [[75, 20, 64, 106, 88, 13, 107, 131], [287, 394, 455]] | ["[75, 20, 64, 106, 88, 13, 107, 131]", "[287, 394, 455]"] |
26 | In the 8-puzzle game, you are given a grid with numbered square tiles arranged randomly and one tile missing. The goal is to arrange the tiles in descending order by sliding them into the empty space. The tiles can move in 4 directions: left, right, up, and down. Given the initial state of the puzzle below, where the empty spot is represented as “_”, provide the shortest list of tiles that need to be swapped with the empty spot to achieve the goal state. The goal state is when all tiles are in descending order, with the largest number in the top left corner, and the empty spot is in the bottom right corner. The solution should be a list of numbers in Python format, where each number represents the number on the tile that the empty spot is swapped with at each turn. Initial state of the puzzle: [[56, 79, '_'], [43, 89, 94], [36, 52, 25]] | 8_puzzle | puzzle | 6 | [79, 89, 94, 79, 89, 94, 43, 56, 94, 89, 79, 43, 52, 25] | 14 | 0.0211181640625 | 14 | 4 | 9 | [[[56, 79, "_"], [43, 89, 94], [36, 52, 25]]] | [[[56, 79, "_"], [43, 89, 94], [36, 52, 25]]] | ["[[56, 79, '_'], [43, 89, 94], [36, 52, 25]]"] |
26 | In the game 'Sort the Chars', we are given a table of n by m dimensions. This table contains n words, each with m characters, except for the first word which has m - 1 characters. Each character is written on a separate tile. The objective of the game is to rearrange the characters such that row i spells the i-th word in the list, with the blank tile ('_') placed in the top left corner of the board in the end. We can rearrange the tiles by swapping the blank space with any of its 4 diagonal neighboring tiles. Given the list of words and initial state of the board below, where the black space is represented as '_', what is the shortest list of swap actions (reported in python syntax) that can sort the board into the given list of target words? The list must only include the 4 diagonal swap directions: up-right, down-right, up-left, or down-left, representing the direction in ehich the blank space was swpped in. Target words: wolf, stunt, lammy, faded The initial board: [['t', 'w', 'y', 'l', '_'], ['s', 'a', 'u', 'f', 't'], ['o', 'a', 'e', 'm', 'n'], ['f', 'l', 'd', 'm', 'd']] | 8_puzzle_words | puzzle | 2 | ["down-left", "down-left", "up-left", "down-left", "down-right", "up-right", "down-right", "up-right", "up-left", "up-left", "down-left", "down-right", "down-right", "up-right", "up-left", "down-left", "up-left", "up-left"] | 18 | 0.2016615867614746 | 18 | 4 | 20 | [[["t", "w", "y", "l", "_"], ["s", "a", "u", "f", "t"], ["o", "a", "e", "m", "n"], ["f", "l", "d", "m", "d"]]] | [[["t", "w", "y", "l", "_"], ["s", "a", "u", "f", "t"], ["o", "a", "e", "m", "n"], ["f", "l", "d", "m", "d"]], ["wolf", "stunt", "lammy", "faded"]] | ["[['t', 'w', 'y', 'l', '_'], ['s', 'a', 'u', 'f', 't'], ['o', 'a', 'e', 'm', 'n'], ['f', 'l', 'd', 'm', 'd']]", "['wolf', 'stunt', 'lammy', 'faded']"] |
26 | We have a map of cities, each represented by a letter, and they are connected by one-way roads. The adjacency matrix below shows the connections between the cities. Each row and column represents a city, and a '1' signifies a direct road from the city of the row to the city of the column. The travel time between any two directly connected cities is the same. Currently, we are located in city 'I'. Our task is to visit city W and city L excatly twice. Determine the quickest route that allows us to visit both these destination cities, ensuring that we stop at the two destinations twice on our path. The sequence in which we visit the destination cities is not important. However, apart from L and W, we can only visit each city once on our path. Provide the solution as a list of the city names on our path, including the start, in Python syntax.
L T W P Z H I X R C K
L 0 0 0 0 1 0 0 0 1 0 1
T 1 0 0 1 0 0 1 1 0 0 0
W 0 0 0 0 0 0 0 0 1 1 0
P 1 0 0 0 0 0 0 0 0 0 1
Z 1 1 0 1 0 0 0 0 1 0 0
H 1 1 1 0 0 0 0 0 0 0 1
I 0 1 0 0 1 0 0 0 0 1 0
X 0 0 1 0 0 1 0 0 0 0 0
R 0 1 1 1 1 0 1 1 0 0 0
C 1 1 0 1 0 0 0 0 1 0 0
K 0 0 0 0 0 1 0 0 1 0 0
| city_directed_graph | pathfinding | 11 | ["I", "T", "L", "K", "H", "W", "R", "W", "C", "L"] | 10 | 0.03812885284423828 | 10 | 11 | 14 | [[[0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1], [1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0], [1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1], [0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0], [0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0], [1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0]], ["L", "T", "W", "P", "Z", "H", "I", "X", "R", "C", "K"], "W", "L"] | [[[0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1], [1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0], [1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1], [0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0], [0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0], [1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0]], ["L", "T", "W", "P", "Z", "H", "I", "X", "R", "C", "K"], "I", "W", "L"] | ["[[0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1], [1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0], [1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1], [0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0], [0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0], [1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0]]", "['L', 'T', 'W', 'P', 'Z', 'H', 'I', 'X', 'R', 'C', 'K']", "['I']", "['W', 'L']"] |
26 | In the 'taxed coin exchange' problem, you are required to choose a subset of coins from this list [29, 29, 22, 23, 23, 3, 26, 9, 15, 8, 21, 15, 29, 25, 71, 27, 23, 6, 7, 9, 15, 21, 6, 8, 19, 17, 18, 6, 26, 24, 24, 3, 25, 2], such that the sum of the chosen coins adds up to 307. Each coin in the list is unique and can only be used once. Also coins carry a tax value. The tax values for each coin is {24: 14, 2: 1, 25: 2, 26: 14, 18: 12, 27: 15, 29: 19, 19: 3, 15: 7, 9: 1, 8: 1, 21: 18, 6: 1, 71: 3, 23: 4, 17: 7, 7: 2, 22: 11, 3: 1}, where the tax for coins of the same value is the same. Also, if the coin chosen is smaller than the previous one, it must have an even value, otherwise, if the coin is larger than or equal to the previous coin chosen, it must have an odd value. The objective is to determine which subset of coins should be selected to minimize the total tax paid. The solution should be presented as a list of numbers, representing the value of the coins chosen in order, with the first coins chosen being in index 0, formatted in Python syntax. | coin_exchange | subset_sum | 19 | [6, 9, 25, 25, 71, 6, 19, 8, 23, 23, 23, 6, 7, 9, 15, 15, 17] | 51 | 0.04102158546447754 | 17 | 34 | 34 | [[29, 29, 22, 23, 23, 3, 26, 9, 15, 8, 21, 15, 29, 25, 71, 27, 23, 6, 7, 9, 15, 21, 6, 8, 19, 17, 18, 6, 26, 24, 24, 3, 25, 2]] | [[29, 29, 22, 23, 23, 3, 26, 9, 15, 8, 21, 15, 29, 25, 71, 27, 23, 6, 7, 9, 15, 21, 6, 8, 19, 17, 18, 6, 26, 24, 24, 3, 25, 2], {"24": 14, "2": 1, "25": 2, "26": 14, "18": 12, "27": 15, "29": 19, "19": 3, "15": 7, "9": 1, "8": 1, "21": 18, "6": 1, "71": 3, "23": 4, "17": 7, "7": 2, "22": 11, "3": 1}, 307] | ["[29, 29, 22, 23, 23, 3, 26, 9, 15, 8, 21, 15, 29, 25, 71, 27, 23, 6, 7, 9, 15, 21, 6, 8, 19, 17, 18, 6, 26, 24, 24, 3, 25, 2]", "{24: 14, 2: 1, 25: 2, 26: 14, 18: 12, 27: 15, 29: 19, 19: 3, 15: 7, 9: 1, 8: 1, 21: 18, 6: 1, 71: 3, 23: 4, 17: 7, 7: 2, 22: 11, 3: 1}", "307"] |
26 | The game of 'Sort It' begins with 3 tubes, each filled with 4 balls of different colors. The goal is to sort the balls by color, with each tube containing balls of only one color. Only one ball can be moved at a time, taken from the top of one tube and placed on top of another. The capacity of each tube (maximum number of balls we can fit in each tube) is 7 balls. It is not allowed to place a ball in a tube that already has 7 balls. The solution should be a list of tuples, each containing, first, the index of the tube from which a ball is taken and, second, the index of the tube to which it is moved, indexing from 0. Given the initial state of the tubes, represented by the lists below (with the leftmost item being the color of the topmost ball in each tube), what is the shortest list of move tuples that will result in all the balls being correctly sorted? [['Red', 'Blue', 'Blue', 'Red'], ['Green', 'Green', 'Blue', 'Blue'], ['Green', 'Green', 'Red', 'Red']] | color_sorting | sorting | 8 | [[0, 2], [1, 2], [1, 2], [0, 1], [0, 1], [0, 1], [2, 0], [2, 0], [2, 1], [2, 0], [2, 0], [1, 2], [1, 2]] | 13 | 0.2634403705596924 | 13 | 6 | 12 | [[["Red", "Blue", "Blue", "Red"], ["Green", "Green", "Blue", "Blue"], ["Green", "Green", "Red", "Red"]], 7] | [[["Red", "Blue", "Blue", "Red"], ["Green", "Green", "Blue", "Blue"], ["Green", "Green", "Red", "Red"]], 7] | ["[['Red', 'Blue', 'Blue', 'Red'], ['Green', 'Green', 'Blue', 'Blue'], ['Green', 'Green', 'Red', 'Red']]", "7"] |
26 | We have a 3x3 numerical grid, with numbers ranging from 17 to 60 (17 included in the range but 60 is not included). The numbers in each row and column must be strictly increasing or decreasing. This means that either first > second > third or first < second < third in each row and column. If a grid cell is marked with an 'x', the number in that position is hidden. The objective is to replace the 'x's with unique integers from the given range, ensuring that each number only appears once in the grid. The replacements must maintain the consecutive order in each row and column. Additionally, the sum of the numbers in the topmost row plus the numbers in the rightmost column plus the numbers in the diagonal connecting the top-left corner of the grid to its bottom-right corner should be minimized. The solution should be given as a list of tuples in Python syntax. Each tuple should represent the replacement of a number with an 'x' number and contain three elements: the row index of the 'x', the column index of the 'x' (both starting from 0), and the value of the number that replaces the 'x'. The initial state of the grid is as follows:
Grid:
[['29' 'x' 'x']
['x' 'x' 'x']
['36' '55' 'x']] | consecutive_grid | underdetermined_system | 9 | [[0, 1, 18], [0, 2, 17], [1, 0, 30], [1, 1, 20], [1, 2, 19], [2, 2, 56]] | 261 | 27.528469800949097 | 6 | 43 | 9 | ["[['29', '', ''], ['', '', ''], ['36', '55', '']]", 17, 60] | ["[['29', '', ''], ['', '', ''], ['36', '55', '']]", 17, 60] | ["[['29', '', ''], ['', '', ''], ['36', '55', '']]", "17", "60"] |
26 | In the magic square problem, a 3x3 grid is filled with unique integers ranging from 26 to 65. Some numbers are already given, while others are unknown and represented as 'x'. Sum of column 1 (counting from 0) must be 150, and sum of row 1 must be 135. Also, the sum of the numbers in the diagonal from the top right to the bottom left corner of the grid should equal 119. The goal is to find unique integers (ie each number can be in the final grid only once) in the given range to replace with ‘x’s in the grid below such that the sum of the specified rows, columns, and diagonal equals the given amounts and the sum of all of the numbers in the grid is as low as possible. The solution should be provided as a list of tuples in Python syntax. Each tuple should contain three numbers for each 'x' position: the row index, the column index (both starting from 0), and the value of the unique integer replaced with 'x' at that position.
Grid:
[['x' 'x' 'x']
['x' 'x' 'x']
['x' '32' 'x']] | magic_square | underdetermined_system | 6 | [[0, 0, 26], [0, 1, 54], [0, 2, 27], [1, 0, 30], [1, 1, 64], [1, 2, 41], [2, 0, 28], [2, 2, 29]] | 331 | 25.04846739768982 | 8 | 34 | 9 | ["[['', '', ''], ['', '', ''], ['', '32', '']]", 3, 26, 65] | ["[['', '', ''], ['', '', ''], ['', '32', '']]", 26, 65, [1, 2], [1, 2], [150], [135], 119] | ["[['', '', ''], ['', '', ''], ['', '32', '']]", "26", "65", "[None, 150, None]", "[None, 135, None]", "119"] |
26 | In 'Restricted Sorting', there are 6 stacks each with a capacity of 4 blocks, with 3 stacks filled with blocks of varying shades and the remaining are empty. The challenge is to sort the blocks by shade such that if a stack is not empty, it is stacked with 3 blocks of a single shade. The player can only transfer one block at a time from the top of a stack to an empty stack or to a stack that has only blocks of that shade, without exceeding the stacks’ capacity. Transferring blocks to certain stacks is more expensive than others. The cost of moving one block to the top of each stack is: {0: 4, 1: 4, 2: 7, 3: 7, 4: 5, 5: 6}, where the keys are the index of each stack, indexing from 0. The cost of moving a block is always at least 1. The solution should be a list of tuples, each containing, first, the index of the stack from which a block is picked up from and, second, the index of the stack to which it is transferred, indexing from 0. Given the initial state of the stacks, represented by the lists below (with the leftmost item being the shade of the topmost block in each stack)(and the first stack being the stack at index 0), what is the list of transfer pairs (reported in python syntax) with the least possible cost, that will result in all the blocks being correctly sorted? [['Blue', 'Yellow', 'Red', 'Yellow'], ['Green', 'Red', 'Green', 'Red'], ['Blue', 'Green', 'Blue', 'Yellow'], [], [], []] | restricted_sorting | sorting | 1 | [[0, 4], [1, 5], [2, 4], [2, 5], [2, 3], [0, 2], [3, 4], [0, 3], [0, 2], [1, 0], [1, 5], [0, 1], [3, 1]] | 73 | 0.024808883666992188 | 13 | 30 | 12 | [[["Blue", "Yellow", "Red", "Yellow"], ["Green", "Red", "Green", "Red"], ["Blue", "Green", "Blue", "Yellow"], [], [], []], 4, {"0": 4, "1": 4, "2": 7, "3": 7, "4": 5, "5": 6}] | [[["Blue", "Yellow", "Red", "Yellow"], ["Green", "Red", "Green", "Red"], ["Blue", "Green", "Blue", "Yellow"], [], [], []], 4, {"0": 4, "1": 4, "2": 7, "3": 7, "4": 5, "5": 6}, 3] | ["[['Blue', 'Yellow', 'Red', 'Yellow'], ['Green', 'Red', 'Green', 'Red'], ['Blue', 'Green', 'Blue', 'Yellow'], [], [], []]", "{0: 4, 1: 4, 2: 7, 3: 7, 4: 5, 5: 6}", "4", "3"] |
26 | Using the provided matrix map of a city, where numbers represent travel time in minutes (all numbers are positive integers) and 'x' marks closed workshops, find the quickest route for Ben to travel from his current workshop at index (5, 9) to his destination workshop at index (3, 1), indexing from 0. Ben's car can move north, south, east, or west from a given crossroad, provided there's no x in that direction. Also, there are 3 districts in the city with district 1 covering rows 0 to 3, district 2 covering rows 4 to 4, and district 3 covering rows 5 to 9. Ben has to visit at least 1 workshop in each district on his path to the destination. The roads are bidirectional. The answer should be a list of tuples (in Python syntax) indicating the index of workshops on Ben's path. The start and end workshops must be included in the path.
[7 x 19 11 6 x 4 15 9 3]
[x x 13 x 8 17 x x 12 16]
[x x 2 x 15 8 x 13 4 x]
[13 11 3 3 3 x x x x x]
[1 16 14 6 14 17 4 9 1 x]
[x 4 9 x 17 17 x 13 2 9]
[x x x x 5 14 17 12 7 14]
[x 15 1 6 x x 5 x x 1]
[x x 19 x x x x x 13 8]
[x 6 9 12 8 8 x 18 x x] | traffic | pathfinding | 2 | [[5, 9], [5, 8], [4, 8], [4, 7], [4, 6], [4, 5], [4, 4], [3, 4], [3, 3], [3, 2], [3, 1]] | 67 | 0.02885293960571289 | 11 | 4 | 4 | [[["7", "x", "19", "11", "6", "x", "4", "15", "9", "3"], ["x", "x", "13", "x", "8", "17", "x", "x", "12", "16"], ["x", "x", "2", "x", "15", "8", "x", "13", "4", "x"], ["13", "11", "3", "3", "3", "x", "x", "x", "x", "x"], ["1", "16", "14", "6", "14", "17", "4", "9", "1", "x"], ["x", "4", "9", "x", "17", "17", "x", "13", "2", "9"], ["x", "x", "x", "x", "5", "14", "17", "12", "7", "14"], ["x", "15", "1", "6", "x", "x", "5", "x", "x", "1"], ["x", "x", "19", "x", "x", "x", "x", "x", "13", "8"], ["x", "6", "9", "12", "8", "8", "x", "18", "x", "x"]]] | [[["7", "x", "19", "11", "6", "x", "4", "15", "9", "3"], ["x", "x", "13", "x", "8", "17", "x", "x", "12", "16"], ["x", "x", "2", "x", "15", "8", "x", "13", "4", "x"], ["13", "11", "3", "3", "3", "x", "x", "x", "x", "x"], ["1", "16", "14", "6", "14", "17", "4", "9", "1", "x"], ["x", "4", "9", "x", "17", "17", "x", "13", "2", "9"], ["x", "x", "x", "x", "5", "14", "17", "12", "7", "14"], ["x", "15", "1", "6", "x", "x", "5", "x", "x", "1"], ["x", "x", "19", "x", "x", "x", "x", "x", "13", "8"], ["x", "6", "9", "12", "8", "8", "x", "18", "x", "x"]], [5, 9], [3, 1], 3, 4] | ["[['7', 'x', '19', '11', '6', 'x', '4', '15', '9', '3'], ['x', 'x', '13', 'x', '8', '17', 'x', 'x', '12', '16'], ['x', 'x', '2', 'x', '15', '8', 'x', '13', '4', 'x'], ['13', '11', '3', '3', '3', 'x', 'x', 'x', 'x', 'x'], ['1', '16', '14', '6', '14', '17', '4', '9', '1', 'x'], ['x', '4', '9', 'x', '17', '17', 'x', '13', '2', '9'], ['x', 'x', 'x', 'x', '5', '14', '17', '12', '7', '14'], ['x', '15', '1', '6', 'x', 'x', '5', 'x', 'x', '1'], ['x', 'x', '19', 'x', 'x', 'x', 'x', 'x', '13', '8'], ['x', '6', '9', '12', '8', '8', 'x', '18', 'x', 'x']]", "(5, 9)", "(3, 1)", "3", "4"] |
26 | Alex is at a trampoline park with a grid of mini trampolines, arranged in a square of 10x10. Some trampolines are broken and unusable. A map of the park is provided below, with 1 indicating a broken trampoline and 0 indicating a functional one. Alex can jump to any of the eight adjacent trampolines, as long as they are not broken. However, Alex must make excatly 3 diagonal jumps, no more, no less, on his path to his destination. He is currently on the trampoline at position (8, 6) (positions are counted from 0, left to right, top to bottom) and wants to reach the trampoline at position (0, 1). What is the shortest sequence of trampolines he should jump on to reach his destination (including the first and final trampolines)? The answer should be a list of tuples, in Python syntax, indicating the row and column of each trampoline Alex jumps on.
1 0 0 1 1 0 0 1 1 0
1 0 0 0 1 0 1 1 0 1
0 0 0 1 0 0 1 1 1 1
0 1 1 0 1 1 1 1 0 1
0 1 1 0 1 1 1 1 0 0
0 1 1 0 0 0 1 1 1 0
0 1 0 0 1 1 0 0 1 1
0 0 0 0 0 0 0 1 1 1
1 1 0 1 1 0 0 0 0 0
0 0 1 0 0 0 0 0 1 0 | trampoline_matrix | pathfinding | 10 | [[8, 6], [7, 5], [7, 4], [6, 3], [5, 3], [4, 3], [3, 3], [2, 2], [1, 2], [0, 2], [0, 1]] | 11 | 0.030196428298950195 | 11 | 8 | 2 | ["[[1, 0, 0, 1, 1, 0, 0, 1, 1, 0], [1, 0, 0, 0, 1, 0, 1, 1, 0, 1], [0, 0, 0, 1, 0, 0, 1, 1, 1, 1], [0, 1, 1, 0, 1, 1, 1, 1, 0, 1], [0, 1, 1, 0, 1, 1, 1, 1, 0, 0], [0, 1, 1, 0, 0, 0, 1, 1, 1, 0], [0, 1, 0, 0, 1, 1, 0, 0, 1, 1], [0, 0, 0, 0, 0, 0, 0, 1, 1, 1], [1, 1, 0, 1, 1, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0, 0, 1, 0]]", 3] | ["[[1, 0, 0, 1, 1, 0, 0, 1, 1, 0], [1, 0, 0, 0, 1, 0, 1, 1, 0, 1], [0, 0, 0, 1, 0, 0, 1, 1, 1, 1], [0, 1, 1, 0, 1, 1, 1, 1, 0, 1], [0, 1, 1, 0, 1, 1, 1, 1, 0, 0], [0, 1, 1, 0, 0, 0, 1, 1, 1, 0], [0, 1, 0, 0, 1, 1, 0, 0, 1, 1], [0, 0, 0, 0, 0, 0, 0, 1, 1, 1], [1, 1, 0, 1, 1, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0, 0, 1, 0]]", [8, 6], [0, 1], 3] | ["[[1, 0, 0, 1, 1, 0, 0, 1, 1, 0], [1, 0, 0, 0, 1, 0, 1, 1, 0, 1], [0, 0, 0, 1, 0, 0, 1, 1, 1, 1], [0, 1, 1, 0, 1, 1, 1, 1, 0, 1], [0, 1, 1, 0, 1, 1, 1, 1, 0, 0], [0, 1, 1, 0, 0, 0, 1, 1, 1, 0], [0, 1, 0, 0, 1, 1, 0, 0, 1, 1], [0, 0, 0, 0, 0, 0, 0, 1, 1, 1], [1, 1, 0, 1, 1, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0, 0, 1, 0]]", "(8, 6)", "(0, 1)", "3"] |
26 | Given 7 labeled water jugs with capacities 24, 132, 149, 62, 120, 61, 42 liters, we aim to fill 3 unlabeled buckets, numbered 1 to 3 and arranged in a line in ascending order, with 298, 430, 468 liters of water respectively. The amount of water in each unlabeled bucket can not at any point in time exceed the amount of water in the bucket placed after it. Jugs can only be filled to the top and emptied completely, and the unlabeled buckets cannot be overfilled. An action, represented as a tuple ('+', X, Y) or ('-', X, Y), involves adding to or removing water from the unlabeled bucket numbered Y, using the jug with capacity X. Determine the shortest sequence of actions needed to fill the buckets as specified, and present the solution as a list of action tuples in Python syntax. | water_jug | subset_sum | 5 | [["+", 42, 3], ["+", 132, 3], ["+", 132, 3], ["+", 42, 3], ["+", 120, 3], ["+", 132, 2], ["+", 149, 2], ["+", 149, 2], ["+", 149, 1], ["+", 149, 1]] | 10 | 0.0418705940246582 | 10 | 42 | 3 | [[24, 132, 149, 62, 120, 61, 42], [298, 430, 468]] | [[24, 132, 149, 62, 120, 61, 42], [298, 430, 468]] | ["[24, 132, 149, 62, 120, 61, 42]", "[298, 430, 468]"] |
27 | In the 8-puzzle game, you are given a grid with numbered square tiles arranged randomly and one tile missing. The goal is to arrange the tiles in descending order by sliding them into the empty space. The tiles can move in 4 directions: left, right, up, and down. Given the initial state of the puzzle below, where the empty spot is represented as “_”, provide the shortest list of tiles that need to be swapped with the empty spot to achieve the goal state. The goal state is when all tiles are in descending order, with the largest number in the top left corner, and the empty spot is in the bottom right corner. The solution should be a list of numbers in Python format, where each number represents the number on the tile that the empty spot is swapped with at each turn. Initial state of the puzzle: [[85, 73, 14], [79, 23, 50], ['_', 99, 63]] | 8_puzzle | puzzle | 6 | [99, 23, 50, 14, 73, 50, 79, 99, 23, 63, 14, 73, 50, 79, 73, 50, 79, 85, 99, 73, 63, 14] | 22 | 0.036279916763305664 | 22 | 4 | 9 | [[[85, 73, 14], [79, 23, 50], ["_", 99, 63]]] | [[[85, 73, 14], [79, 23, 50], ["_", 99, 63]]] | ["[[85, 73, 14], [79, 23, 50], ['_', 99, 63]]"] |
27 | In the game 'Sort the Chars', we are given a table of n by m dimensions. This table contains n words, each with m characters, except for the first word which has m - 1 characters. Each character is written on a separate tile. The objective of the game is to rearrange the characters such that row i spells the i-th word in the list, with the blank tile ('_') placed in the top left corner of the board in the end. We can rearrange the tiles by swapping the blank space with any of its 4 diagonal neighboring tiles. Given the list of words and initial state of the board below, where the black space is represented as '_', what is the shortest list of swap actions (reported in python syntax) that can sort the board into the given list of target words? The list must only include the 4 diagonal swap directions: up-right, down-right, up-left, or down-left, representing the direction in ehich the blank space was swpped in. Target words: bois, duroc, linen, spent The initial board: [['_', 'b', 'p', 'i', 's'], ['d', 'u', 'r', 'n', 'c'], ['l', 'i', 'o', 'e', 'n'], ['s', 'n', 'e', 'o', 't']] | 8_puzzle_words | puzzle | 2 | ["down-right", "down-right", "down-right", "up-right", "up-left", "down-left", "down-left", "up-left", "up-right", "up-right", "down-right", "down-left", "up-left", "down-left", "down-right", "up-right", "up-right", "up-left", "down-left", "up-left"] | 20 | 0.26288700103759766 | 20 | 4 | 20 | [[["_", "b", "p", "i", "s"], ["d", "u", "r", "n", "c"], ["l", "i", "o", "e", "n"], ["s", "n", "e", "o", "t"]]] | [[["_", "b", "p", "i", "s"], ["d", "u", "r", "n", "c"], ["l", "i", "o", "e", "n"], ["s", "n", "e", "o", "t"]], ["bois", "duroc", "linen", "spent"]] | ["[['_', 'b', 'p', 'i', 's'], ['d', 'u', 'r', 'n', 'c'], ['l', 'i', 'o', 'e', 'n'], ['s', 'n', 'e', 'o', 't']]", "['bois', 'duroc', 'linen', 'spent']"] |
27 | We have a map of cities, each represented by a letter, and they are connected by one-way roads. The adjacency matrix below shows the connections between the cities. Each row and column represents a city, and a '1' signifies a direct road from the city of the row to the city of the column. The travel time between any two directly connected cities is the same. Currently, we are located in city 'D'. Our task is to visit city H and city Z excatly twice. Determine the quickest route that allows us to visit both these destination cities, ensuring that we stop at the two destinations twice on our path. The sequence in which we visit the destination cities is not important. However, apart from Z and H, we can only visit each city once on our path. Provide the solution as a list of the city names on our path, including the start, in Python syntax.
J H K W X I B U D Z G
J 0 0 0 0 1 0 0 0 0 0 0
H 0 0 1 0 0 0 1 1 0 0 0
K 0 0 0 0 0 1 0 0 0 0 0
W 0 1 1 0 1 0 0 0 0 0 0
X 0 1 0 0 0 1 0 0 0 0 0
I 0 0 1 0 0 0 1 1 0 1 0
B 0 0 0 1 0 0 0 0 0 1 1
U 0 0 1 1 1 0 0 0 0 0 0
D 0 0 0 1 0 1 0 1 0 0 0
Z 1 0 1 1 0 0 0 1 0 0 0
G 1 0 0 0 1 0 0 0 0 1 0
| city_directed_graph | pathfinding | 11 | ["D", "I", "Z", "J", "X", "H", "B", "Z", "W", "H"] | 10 | 0.03222942352294922 | 10 | 11 | 14 | [[[0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0], [0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0], [0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1], [0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0], [1, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0], [1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0]], ["J", "H", "K", "W", "X", "I", "B", "U", "D", "Z", "G"], "H", "Z"] | [[[0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0], [0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0], [0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1], [0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0], [1, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0], [1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0]], ["J", "H", "K", "W", "X", "I", "B", "U", "D", "Z", "G"], "D", "H", "Z"] | ["[[0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0], [0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0], [0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1], [0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0], [1, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0], [1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0]]", "['J', 'H', 'K', 'W', 'X', 'I', 'B', 'U', 'D', 'Z', 'G']", "['D']", "['H', 'Z']"] |
27 | In the 'taxed coin exchange' problem, you are required to choose a subset of coins from this list [22, 4, 12, 26, 4, 9, 4, 28, 28, 8, 28, 19, 15, 20, 9, 161, 11, 28, 17, 10, 25, 15, 7, 28, 21, 24, 10, 13, 22, 4, 10, 14], such that the sum of the chosen coins adds up to 301. Each coin in the list is unique and can only be used once. Also coins carry a tax value. The tax values for each coin is {15: 2, 17: 10, 10: 3, 12: 10, 21: 12, 4: 2, 22: 1, 11: 6, 26: 9, 14: 7, 24: 12, 161: 16, 20: 15, 9: 8, 8: 1, 13: 10, 28: 6, 7: 6, 25: 6, 19: 15}, where the tax for coins of the same value is the same. Also, if the coin chosen is smaller than the previous one, it must have an even value, otherwise, if the coin is larger than or equal to the previous coin chosen, it must have an odd value. The objective is to determine which subset of coins should be selected to minimize the total tax paid. The solution should be presented as a list of numbers, representing the value of the coins chosen in order, with the first coins chosen being in index 0, formatted in Python syntax. | coin_exchange | subset_sum | 20 | [22, 10, 15, 10, 8, 15, 161, 28, 22, 10] | 38 | 0.0371396541595459 | 10 | 32 | 32 | [[22, 4, 12, 26, 4, 9, 4, 28, 28, 8, 28, 19, 15, 20, 9, 161, 11, 28, 17, 10, 25, 15, 7, 28, 21, 24, 10, 13, 22, 4, 10, 14]] | [[22, 4, 12, 26, 4, 9, 4, 28, 28, 8, 28, 19, 15, 20, 9, 161, 11, 28, 17, 10, 25, 15, 7, 28, 21, 24, 10, 13, 22, 4, 10, 14], {"15": 2, "17": 10, "10": 3, "12": 10, "21": 12, "4": 2, "22": 1, "11": 6, "26": 9, "14": 7, "24": 12, "161": 16, "20": 15, "9": 8, "8": 1, "13": 10, "28": 6, "7": 6, "25": 6, "19": 15}, 301] | ["[22, 4, 12, 26, 4, 9, 4, 28, 28, 8, 28, 19, 15, 20, 9, 161, 11, 28, 17, 10, 25, 15, 7, 28, 21, 24, 10, 13, 22, 4, 10, 14]", "{15: 2, 17: 10, 10: 3, 12: 10, 21: 12, 4: 2, 22: 1, 11: 6, 26: 9, 14: 7, 24: 12, 161: 16, 20: 15, 9: 8, 8: 1, 13: 10, 28: 6, 7: 6, 25: 6, 19: 15}", "301"] |
27 | The game of 'Sort It' begins with 3 tubes, each filled with 4 balls of different colors. The goal is to sort the balls by color, with each tube containing balls of only one color. Only one ball can be moved at a time, taken from the top of one tube and placed on top of another. The capacity of each tube (maximum number of balls we can fit in each tube) is 7 balls. It is not allowed to place a ball in a tube that already has 7 balls. The solution should be a list of tuples, each containing, first, the index of the tube from which a ball is taken and, second, the index of the tube to which it is moved, indexing from 0. Given the initial state of the tubes, represented by the lists below (with the leftmost item being the color of the topmost ball in each tube), what is the shortest list of move tuples that will result in all the balls being correctly sorted? [['Blue', 'Red', 'Red', 'Blue'], ['Green', 'Red', 'Red', 'Green'], ['Blue', 'Blue', 'Green', 'Green']] | color_sorting | sorting | 8 | [[0, 2], [0, 1], [0, 1], [2, 0], [2, 0], [2, 0], [2, 0], [2, 0], [1, 2], [1, 2], [1, 0], [1, 2], [1, 2], [0, 1], [0, 1], [0, 1]] | 16 | 1.1768579483032227 | 16 | 6 | 12 | [[["Blue", "Red", "Red", "Blue"], ["Green", "Red", "Red", "Green"], ["Blue", "Blue", "Green", "Green"]], 7] | [[["Blue", "Red", "Red", "Blue"], ["Green", "Red", "Red", "Green"], ["Blue", "Blue", "Green", "Green"]], 7] | ["[['Blue', 'Red', 'Red', 'Blue'], ['Green', 'Red', 'Red', 'Green'], ['Blue', 'Blue', 'Green', 'Green']]", "7"] |
27 | We have a 3x3 numerical grid, with numbers ranging from 46 to 89 (46 included in the range but 89 is not included). The numbers in each row and column must be strictly increasing or decreasing. This means that either first > second > third or first < second < third in each row and column. If a grid cell is marked with an 'x', the number in that position is hidden. The objective is to replace the 'x's with unique integers from the given range, ensuring that each number only appears once in the grid. The replacements must maintain the consecutive order in each row and column. Additionally, the sum of the numbers in the topmost row plus the numbers in the rightmost column plus the numbers in the diagonal connecting the top-left corner of the grid to its bottom-right corner should be minimized. The solution should be given as a list of tuples in Python syntax. Each tuple should represent the replacement of a number with an 'x' number and contain three elements: the row index of the 'x', the column index of the 'x' (both starting from 0), and the value of the number that replaces the 'x'. The initial state of the grid is as follows:
Grid:
[['52' 'x' 'x']
['50' 'x' 'x']
['x' 'x' '69']] | consecutive_grid | underdetermined_system | 9 | [[0, 1, 47], [0, 2, 46], [1, 1, 51], [1, 2, 53], [2, 0, 48], [2, 1, 54]] | 485 | 0.19235539436340332 | 6 | 43 | 9 | ["[['52', '', ''], ['50', '', ''], ['', '', '69']]", 46, 89] | ["[['52', '', ''], ['50', '', ''], ['', '', '69']]", 46, 89] | ["[['52', '', ''], ['50', '', ''], ['', '', '69']]", "46", "89"] |
27 | In the magic square problem, a 3x3 grid is filled with unique integers ranging from 26 to 65. Some numbers are already given, while others are unknown and represented as 'x'. Sum of column 1 (counting from 0) must be 93, and sum of row 1 must be 135. Also, the sum of the numbers in the diagonal from the top right to the bottom left corner of the grid should equal 106. The goal is to find unique integers (ie each number can be in the final grid only once) in the given range to replace with ‘x’s in the grid below such that the sum of the specified rows, columns, and diagonal equals the given amounts and the sum of all of the numbers in the grid is as low as possible. The solution should be provided as a list of tuples in Python syntax. Each tuple should contain three numbers for each 'x' position: the row index, the column index (both starting from 0), and the value of the unique integer replaced with 'x' at that position.
Grid:
[['47' 'x' 'x']
['x' 'x' 'x']
['x' 'x' 'x']] | magic_square | underdetermined_system | 6 | [[0, 1, 26], [0, 2, 29], [1, 0, 31], [1, 1, 40], [1, 2, 64], [2, 0, 37], [2, 1, 27], [2, 2, 28]] | 329 | 29.752150774002075 | 8 | 34 | 9 | ["[['47', '', ''], ['', '', ''], ['', '', '']]", 3, 26, 65] | ["[['47', '', ''], ['', '', ''], ['', '', '']]", 26, 65, [1, 2], [1, 2], [93], [135], 106] | ["[['47', '', ''], ['', '', ''], ['', '', '']]", "26", "65", "[None, 93, None]", "[None, 135, None]", "106"] |
27 | In 'Restricted Sorting', there are 6 stacks each with a capacity of 4 blocks, with 3 stacks filled with blocks of varying shades and the remaining are empty. The challenge is to sort the blocks by shade such that if a stack is not empty, it is stacked with 3 blocks of a single shade. The player can only transfer one block at a time from the top of a stack to an empty stack or to a stack that has only blocks of that shade, without exceeding the stacks’ capacity. Transferring blocks to certain stacks is more expensive than others. The cost of moving one block to the top of each stack is: {0: 3, 1: 6, 2: 2, 3: 4, 4: 6, 5: 5}, where the keys are the index of each stack, indexing from 0. The cost of moving a block is always at least 1. The solution should be a list of tuples, each containing, first, the index of the stack from which a block is picked up from and, second, the index of the stack to which it is transferred, indexing from 0. Given the initial state of the stacks, represented by the lists below (with the leftmost item being the shade of the topmost block in each stack)(and the first stack being the stack at index 0), what is the list of transfer pairs (reported in python syntax) with the least possible cost, that will result in all the blocks being correctly sorted? [['Red', 'Blue', 'Green', 'Yellow'], ['Blue', 'Blue', 'Green', 'Red'], [], [], [], ['Green', 'Red', 'Yellow', 'Yellow']] | restricted_sorting | sorting | 1 | [[0, 2], [5, 3], [5, 2], [0, 4], [0, 3], [0, 5], [1, 0], [1, 0], [1, 3], [4, 0], [1, 2]] | 38 | 0.03287506103515625 | 11 | 30 | 12 | [[["Red", "Blue", "Green", "Yellow"], ["Blue", "Blue", "Green", "Red"], [], [], [], ["Green", "Red", "Yellow", "Yellow"]], 4, {"0": 3, "1": 6, "2": 2, "3": 4, "4": 6, "5": 5}] | [[["Red", "Blue", "Green", "Yellow"], ["Blue", "Blue", "Green", "Red"], [], [], [], ["Green", "Red", "Yellow", "Yellow"]], 4, {"0": 3, "1": 6, "2": 2, "3": 4, "4": 6, "5": 5}, 3] | ["[['Red', 'Blue', 'Green', 'Yellow'], ['Blue', 'Blue', 'Green', 'Red'], [], [], [], ['Green', 'Red', 'Yellow', 'Yellow']]", "{0: 3, 1: 6, 2: 2, 3: 4, 4: 6, 5: 5}", "4", "3"] |
27 | Using the provided matrix map of a city, where numbers represent travel time in minutes (all numbers are positive integers) and 'x' marks closed workshops, find the quickest route for Ben to travel from his current workshop at index (3, 8) to his destination workshop at index (6, 0), indexing from 0. Ben's car can move north, south, east, or west from a given crossroad, provided there's no x in that direction. Also, there are 3 districts in the city with district 1 covering rows 0 to 2, district 2 covering rows 3 to 5, and district 3 covering rows 6 to 9. Ben has to visit at least 1 workshop in each district on his path to the destination. The roads are bidirectional. The answer should be a list of tuples (in Python syntax) indicating the index of workshops on Ben's path. The start and end workshops must be included in the path.
[19 x 3 x x x 13 x 12 x]
[x x 8 x 15 18 11 12 x 7]
[x 8 x x 15 20 17 12 2 8]
[x x 4 13 2 14 19 13 15 19]
[13 2 x 8 x 17 13 x x 12]
[2 20 20 14 x x 15 x 2 19]
[15 16 18 x 2 x x x x x]
[2 x 17 x x 12 x x 3 x]
[2 x 10 x 6 x x 9 8 19]
[17 x 6 13 x 18 x 3 x 18] | traffic | pathfinding | 2 | [[3, 8], [2, 8], [2, 7], [3, 7], [3, 6], [3, 5], [3, 4], [3, 3], [4, 3], [5, 3], [5, 2], [5, 1], [5, 0], [6, 0]] | 154 | 0.028217792510986328 | 14 | 4 | 4 | [[["19", "x", "3", "x", "x", "x", "13", "x", "12", "x"], ["x", "x", "8", "x", "15", "18", "11", "12", "x", "7"], ["x", "8", "x", "x", "15", "20", "17", "12", "2", "8"], ["x", "x", "4", "13", "2", "14", "19", "13", "15", "19"], ["13", "2", "x", "8", "x", "17", "13", "x", "x", "12"], ["2", "20", "20", "14", "x", "x", "15", "x", "2", "19"], ["15", "16", "18", "x", "2", "x", "x", "x", "x", "x"], ["2", "x", "17", "x", "x", "12", "x", "x", "3", "x"], ["2", "x", "10", "x", "6", "x", "x", "9", "8", "19"], ["17", "x", "6", "13", "x", "18", "x", "3", "x", "18"]]] | [[["19", "x", "3", "x", "x", "x", "13", "x", "12", "x"], ["x", "x", "8", "x", "15", "18", "11", "12", "x", "7"], ["x", "8", "x", "x", "15", "20", "17", "12", "2", "8"], ["x", "x", "4", "13", "2", "14", "19", "13", "15", "19"], ["13", "2", "x", "8", "x", "17", "13", "x", "x", "12"], ["2", "20", "20", "14", "x", "x", "15", "x", "2", "19"], ["15", "16", "18", "x", "2", "x", "x", "x", "x", "x"], ["2", "x", "17", "x", "x", "12", "x", "x", "3", "x"], ["2", "x", "10", "x", "6", "x", "x", "9", "8", "19"], ["17", "x", "6", "13", "x", "18", "x", "3", "x", "18"]], [3, 8], [6, 0], 2, 5] | ["[['19', 'x', '3', 'x', 'x', 'x', '13', 'x', '12', 'x'], ['x', 'x', '8', 'x', '15', '18', '11', '12', 'x', '7'], ['x', '8', 'x', 'x', '15', '20', '17', '12', '2', '8'], ['x', 'x', '4', '13', '2', '14', '19', '13', '15', '19'], ['13', '2', 'x', '8', 'x', '17', '13', 'x', 'x', '12'], ['2', '20', '20', '14', 'x', 'x', '15', 'x', '2', '19'], ['15', '16', '18', 'x', '2', 'x', 'x', 'x', 'x', 'x'], ['2', 'x', '17', 'x', 'x', '12', 'x', 'x', '3', 'x'], ['2', 'x', '10', 'x', '6', 'x', 'x', '9', '8', '19'], ['17', 'x', '6', '13', 'x', '18', 'x', '3', 'x', '18']]", "(3, 8)", "(6, 0)", "2", "5"] |
27 | Alex is at a trampoline park with a grid of mini trampolines, arranged in a square of 10x10. Some trampolines are broken and unusable. A map of the park is provided below, with 1 indicating a broken trampoline and 0 indicating a functional one. Alex can jump to any of the eight adjacent trampolines, as long as they are not broken. However, Alex must make excatly 3 diagonal jumps, no more, no less, on his path to his destination. He is currently on the trampoline at position (7, 9) (positions are counted from 0, left to right, top to bottom) and wants to reach the trampoline at position (3, 0). What is the shortest sequence of trampolines he should jump on to reach his destination (including the first and final trampolines)? The answer should be a list of tuples, in Python syntax, indicating the row and column of each trampoline Alex jumps on.
1 1 1 0 1 1 1 1 1 1
0 1 0 0 1 1 0 1 0 0
1 1 1 0 1 1 1 0 0 0
0 1 0 1 0 0 1 1 1 1
0 0 1 1 0 1 1 1 0 0
0 0 0 0 1 1 1 1 1 1
0 0 0 0 1 1 0 0 0 1
0 1 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 1 0 0
1 0 0 0 0 1 0 0 1 0 | trampoline_matrix | pathfinding | 10 | [[7, 9], [7, 8], [7, 7], [7, 6], [7, 5], [7, 4], [6, 3], [5, 2], [4, 1], [4, 0], [3, 0]] | 11 | 0.030271291732788086 | 11 | 8 | 2 | ["[[1, 1, 1, 0, 1, 1, 1, 1, 1, 1], [0, 1, 0, 0, 1, 1, 0, 1, 0, 0], [1, 1, 1, 0, 1, 1, 1, 0, 0, 0], [0, 1, 0, 1, 0, 0, 1, 1, 1, 1], [0, 0, 1, 1, 0, 1, 1, 1, 0, 0], [0, 0, 0, 0, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 1, 1, 0, 0, 0, 1], [0, 1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1, 0, 0], [1, 0, 0, 0, 0, 1, 0, 0, 1, 0]]", 3] | ["[[1, 1, 1, 0, 1, 1, 1, 1, 1, 1], [0, 1, 0, 0, 1, 1, 0, 1, 0, 0], [1, 1, 1, 0, 1, 1, 1, 0, 0, 0], [0, 1, 0, 1, 0, 0, 1, 1, 1, 1], [0, 0, 1, 1, 0, 1, 1, 1, 0, 0], [0, 0, 0, 0, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 1, 1, 0, 0, 0, 1], [0, 1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1, 0, 0], [1, 0, 0, 0, 0, 1, 0, 0, 1, 0]]", [7, 9], [3, 0], 3] | ["[[1, 1, 1, 0, 1, 1, 1, 1, 1, 1], [0, 1, 0, 0, 1, 1, 0, 1, 0, 0], [1, 1, 1, 0, 1, 1, 1, 0, 0, 0], [0, 1, 0, 1, 0, 0, 1, 1, 1, 1], [0, 0, 1, 1, 0, 1, 1, 1, 0, 0], [0, 0, 0, 0, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 1, 1, 0, 0, 0, 1], [0, 1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1, 0, 0], [1, 0, 0, 0, 0, 1, 0, 0, 1, 0]]", "(7, 9)", "(3, 0)", "3"] |
27 | Given 7 labeled water jugs with capacities 80, 76, 132, 60, 83, 28, 75, 26 liters, we aim to fill 3 unlabeled buckets, numbered 1 to 3 and arranged in a line in ascending order, with 337, 378, 398 liters of water respectively. The amount of water in each unlabeled bucket can not at any point in time exceed the amount of water in the bucket placed after it. Jugs can only be filled to the top and emptied completely, and the unlabeled buckets cannot be overfilled. An action, represented as a tuple ('+', X, Y) or ('-', X, Y), involves adding to or removing water from the unlabeled bucket numbered Y, using the jug with capacity X. Determine the shortest sequence of actions needed to fill the buckets as specified, and present the solution as a list of action tuples in Python syntax. | water_jug | subset_sum | 5 | [["+", 28, 3], ["+", 80, 3], ["+", 132, 3], ["+", 75, 3], ["+", 83, 3], ["+", 80, 2], ["+", 83, 2], ["+", 83, 2], ["+", 132, 2], ["+", 28, 1], ["+", 83, 1], ["+", 83, 1], ["+", 83, 1], ["+", 60, 1]] | 14 | 0.05565452575683594 | 14 | 48 | 3 | [[80, 76, 132, 60, 83, 28, 75, 26], [337, 378, 398]] | [[80, 76, 132, 60, 83, 28, 75, 26], [337, 378, 398]] | ["[80, 76, 132, 60, 83, 28, 75, 26]", "[337, 378, 398]"] |
28 | In the 8-puzzle game, you are given a grid with numbered square tiles arranged randomly and one tile missing. The goal is to arrange the tiles in descending order by sliding them into the empty space. The tiles can move in 4 directions: left, right, up, and down. Given the initial state of the puzzle below, where the empty spot is represented as “_”, provide the shortest list of tiles that need to be swapped with the empty spot to achieve the goal state. The goal state is when all tiles are in descending order, with the largest number in the top left corner, and the empty spot is in the bottom right corner. The solution should be a list of numbers in Python format, where each number represents the number on the tile that the empty spot is swapped with at each turn. Initial state of the puzzle: [[10, 81, 46], [87, 74, 72], [36, 45, '_']] | 8_puzzle | puzzle | 6 | [45, 36, 87, 10, 81, 74, 10, 87, 36, 10, 72, 46, 74, 81, 87, 72, 46, 45] | 18 | 0.023023605346679688 | 18 | 4 | 9 | [[[10, 81, 46], [87, 74, 72], [36, 45, "_"]]] | [[[10, 81, 46], [87, 74, 72], [36, 45, "_"]]] | ["[[10, 81, 46], [87, 74, 72], [36, 45, '_']]"] |
28 | In the game 'Sort the Chars', we are given a table of n by m dimensions. This table contains n words, each with m characters, except for the first word which has m - 1 characters. Each character is written on a separate tile. The objective of the game is to rearrange the characters such that row i spells the i-th word in the list, with the blank tile ('_') placed in the top left corner of the board in the end. We can rearrange the tiles by swapping the blank space with any of its 4 diagonal neighboring tiles. Given the list of words and initial state of the board below, where the black space is represented as '_', what is the shortest list of swap actions (reported in python syntax) that can sort the board into the given list of target words? The list must only include the 4 diagonal swap directions: up-right, down-right, up-left, or down-left, representing the direction in ehich the blank space was swpped in. Target words: akey, haikh, trone, manto The initial board: [['a', 'a', 'e', 'e', 'y'], ['h', 'a', 'i', 't', 'h'], ['_', 'r', 'k', 'n', 't'], ['m', 'k', 'n', 'o', 'o']] | 8_puzzle_words | puzzle | 2 | ["up-right", "down-right", "up-right", "up-left", "down-left", "down-right", "down-left", "up-left", "up-right", "down-right", "down-right", "up-right", "up-left", "up-left", "down-left", "up-left"] | 16 | 0.22631430625915527 | 16 | 4 | 20 | [[["a", "a", "e", "e", "y"], ["h", "a", "i", "t", "h"], ["_", "r", "k", "n", "t"], ["m", "k", "n", "o", "o"]]] | [[["a", "a", "e", "e", "y"], ["h", "a", "i", "t", "h"], ["_", "r", "k", "n", "t"], ["m", "k", "n", "o", "o"]], ["akey", "haikh", "trone", "manto"]] | ["[['a', 'a', 'e', 'e', 'y'], ['h', 'a', 'i', 't', 'h'], ['_', 'r', 'k', 'n', 't'], ['m', 'k', 'n', 'o', 'o']]", "['akey', 'haikh', 'trone', 'manto']"] |
28 | We have a map of cities, each represented by a letter, and they are connected by one-way roads. The adjacency matrix below shows the connections between the cities. Each row and column represents a city, and a '1' signifies a direct road from the city of the row to the city of the column. The travel time between any two directly connected cities is the same. Currently, we are located in city 'B'. Our task is to visit city E and city N excatly twice. Determine the quickest route that allows us to visit both these destination cities, ensuring that we stop at the two destinations twice on our path. The sequence in which we visit the destination cities is not important. However, apart from N and E, we can only visit each city once on our path. Provide the solution as a list of the city names on our path, including the start, in Python syntax.
A N B M Z O E Q G L P
A 0 0 0 1 0 1 1 0 1 0 1
N 0 0 0 0 0 0 0 1 0 0 1
B 0 0 0 0 1 0 0 1 1 0 0
M 0 1 0 0 0 0 1 0 0 0 0
Z 0 0 0 0 0 1 0 1 0 0 0
O 0 0 0 1 0 0 1 1 0 1 0
E 1 0 1 1 1 0 0 0 1 0 1
Q 0 0 0 1 0 0 0 0 0 0 0
G 0 1 0 1 0 0 0 1 0 0 0
L 0 1 0 0 0 0 0 1 1 0 1
P 0 0 0 0 0 0 1 0 0 1 0
| city_directed_graph | pathfinding | 11 | ["B", "G", "N", "P", "E", "A", "E", "M", "N"] | 9 | 0.029226064682006836 | 9 | 11 | 14 | [[[0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 1], [0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1], [0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0], [0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0], [0, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0], [1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1], [0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 1], [0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0]], ["A", "N", "B", "M", "Z", "O", "E", "Q", "G", "L", "P"], "E", "N"] | [[[0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 1], [0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1], [0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0], [0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0], [0, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0], [1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1], [0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 1], [0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0]], ["A", "N", "B", "M", "Z", "O", "E", "Q", "G", "L", "P"], "B", "E", "N"] | ["[[0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 1], [0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1], [0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0], [0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0], [0, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0], [1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1], [0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 1], [0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0]]", "['A', 'N', 'B', 'M', 'Z', 'O', 'E', 'Q', 'G', 'L', 'P']", "['B']", "['E', 'N']"] |