id stringlengths 2 6 | media images listlengths 1 1 | messages stringlengths 310 1.17k | answer stringlengths 249 4.55k | question_type stringclasses 1
value | test_script stringlengths 839 9.64k | diagram_description stringlengths 759 3.88k | capability_aspects dict | task_type stringclasses 6
values |
|---|---|---|---|---|---|---|---|---|
q1 | [{"role": "user", "question": "def solution(red_triangle: tuple, orange_dots: list) -> int:\n \"\"\"\n Determine the number of iterations required to absorb all the orange dots.\n\n Parameters:\n red_triangle (tuple): The coordinates of the red triangle (x0, y0).\n orange_dots (list): A list of tuples, w... | def solution(red_triangle: tuple, orange_dots: list) -> int:
"""
Determine the number of iterations required to absorb all the orange dots.
Parameters:
red_triangle (tuple): The coordinates of the red triangle (x0, y0).
orange_dots (list): A list of tuples, where each tuple represents the coordinat... | open | def test():
test_cases = [
((2, 2), [(2, 4)], 1),
((3, 0), [(3, 1), (3, 2), (3, 3)], 1),
((0, 3), [(1, 3), (2, 3), (4, 3)], 1),
((2, 2), [(1, 1), (0, 0), (3, 3)], 1),
((2, 2), [(0, 2), (2, 4), (4, 4), (2, 0)], 3),
((2, 2), [], 0),
((0, 0), [(1, 1), (2, 2), (3,... | # Problem Description
This is a geometric transformation problem on a grid where we need to simulate the absorption of orange dots by purple lines emanating from a red triangle. The goal is to calculate the minimum number of iterations needed to convert all orange dots into purple dots, following specific geometric rul... | {
"Common Sense": null,
"Data Structures": [
"Matrix"
],
"Dynamic Patterns": [
"Propagation"
],
"Geometric Objects": [
"Coordinate System",
"Point",
"Line",
"Grid",
"Triangle"
],
"Mathematical Operations": null,
"Spatial Transformations": null,
"Topological Relations": [
... | Iterative Calculation | |
q1-2 | [{"role": "user", "question": "def solution(red_triangle: tuple, orange_dots: list) -> int:\n \"\"\"\n Determine the number of iterations required to absorb all the orange dots.\n\n Parameters:\n red_triangle (tuple): The coordinates of the red triangle (x0, y0).\n orange_dots (list): A list of tuples, w... | def solution(red_triangle: tuple, orange_dots: list) -> int:
"""
Determine the number of iterations required to absorb all the orange dots.
Parameters:
red_triangle (tuple): The coordinates of the red triangle (x0, y0).
orange_dots (list): A list of tuples, where each tuple represents the coordinat... | open | def test():
test_cases = [
((2, 2), [(2, 4)], 1),
((3, 0), [(3, 1), (3, 2), (3, 3)], 1),
((0, 3), [(1, 3), (2, 3), (4, 3)], 1),
((3, 1), [(3, 0), (3, 2), (3, 3)], 2),
((2, 3), [(1, 3), (0, 3), (4, 3)], 2),
((2, 2), [(1, 1), (0, 0), (3, 3)], 2),
((2, 2), [(0, 2... | # Problem Description
This problem involves a grid-based transformation where we need to simulate the absorption of orange dots by purple lines emanating from a red triangle. The goal is to calculate the minimum number of iterations required to convert all orange dots into purple dots, following specific geometric rule... | {
"Common Sense": null,
"Data Structures": [
"Matrix"
],
"Dynamic Patterns": [
"Propagation"
],
"Geometric Objects": [
"Coordinate System",
"Point",
"Line",
"Grid",
"Triangle"
],
"Mathematical Operations": null,
"Spatial Transformations": null,
"Topological Relations": [
... | Iterative Calculation | |
q1-3 | [{"role": "user", "question": "def solution(red_triangle: tuple, orange_dots: list) -> int:\n \"\"\"\n Determine the number of iterations required to absorb all the orange dots.\n\n Parameters:\n red_triangle (tuple): The coordinates of the red triangle (x0, y0).\n orange_dots (list): A list of tuples, w... | def solution(red_triangle: tuple, orange_dots: list) -> int:
"""
Determine the number of iterations required to absorb all the orange dots.
Parameters:
red_triangle (tuple): The coordinates of the red triangle (x0, y0).
orange_dots (list): A list of tuples, where each tuple represents the coordinat... | open |
def test():
test_cases = [
((2, 2), [(2, 4)], 2),
((3, 0), [(3, 1), (3, 2), (3, 3)], 2),
((0, 3), [(1, 3), (2, 3), (4, 3)], 2),
((2, 2), [(1, 1), (0, 0), (3, 3)], 2),
((2, 2), [(0, 2), (2, 4), (4, 4), (2, 0)], 6),
((2, 2), [], 0),
((0, 0), [(1, 1), (2, 2), (3... | # Problem Description
This problem involves a grid where a red triangle and several orange dots are placed. The goal is to determine the number of iterations required to convert all orange dots into purple dots. Each iteration involves drawing a line through the red triangle, and any orange dot that lies on this line i... | {
"Common Sense": null,
"Data Structures": [
"Matrix"
],
"Dynamic Patterns": [
"Propagation"
],
"Geometric Objects": [
"Coordinate System",
"Point",
"Line",
"Grid",
"Triangle"
],
"Mathematical Operations": null,
"Spatial Transformations": null,
"Topological Relations": [
... | Iterative Calculation | |
q10 | [{"role": "user", "question": "from typing import List\n\ndef solution(n: int) -> List[List[int]]:\n \"\"\"\n Given an n x n grid, determine the coordinates of a specific pattern that is formed on the grid. \n \n Parameters:\n n (int): The dimensions of the grid (which is an n*n 2D matrix). n is alwa... | from typing import List
def solution(n: int) -> List[List[int]]:
"""
Given an n x n grid, determine the coordinates of a specific pattern that is formed on the grid.
Parameters:
n (int): The dimensions of the grid (which is an n*n 2D matrix). n is always an odd number.
Returns:
... | open | def reference(n):
grid = [[0 for _ in range(n)] for _ in range(n)]
# Middle index
mid = n // 2
# Set the center
grid[mid][mid] = 1
# Set the diagonals
for i in range(mid + 1):
if (i-mid) % 2 == 1:
continue
grid[i][i] = 1
grid[i][n-1-i] = 1
... | # Problem Description
This is a grid pattern generation problem where we need to:
- Create an n×n grid (where n is always odd)
- Place black cells (represented as 1) in specific positions
- Fill remaining cells with white (represented as 0)
- Return the resulting grid as a 2D matrix
- The pattern follows a specific rul... | {
"Common Sense": null,
"Data Structures": [
"Matrix"
],
"Dynamic Patterns": [
"Concentric Arrangement",
"Cross Pattern"
],
"Geometric Objects": [
"Square",
"Grid"
],
"Mathematical Operations": null,
"Spatial Transformations": [
"Scaling"
],
"Topological Relations": [
"... | Expansion | |
q10-2 | [{"role": "user", "question": "from typing import List\n\ndef solution(n: int) -> List[List[int]]:\n \"\"\"\n Given an n x n grid, determine the coordinates of a specific pattern that is formed on the grid. \n \n Parameters:\n n (int): The dimensions of the grid (which is an n*n 2D matrix). n is alwa... | from typing import List
def solution(n: int) -> List[List[int]]:
"""
Given an n x n grid, determine the coordinates of a specific pattern that is formed on the grid.
Parameters:
n (int): The dimensions of the grid (which is an n*n 2D matrix). n is always an odd number.
Returns:
... | open | def reference(n):
grid = [[0 for _ in range(n)] for _ in range(n)]
# Middle index
mid = n // 2
# Set the center
grid[mid][mid] = 1
# Set the diagonals
for i in range(mid + 1):
if (i-mid) % 2 == 1:
continue
grid[i][mid] = 1
grid[mid][i] = 1
... | # Problem Description
This is a grid pattern generation problem where we need to:
- Create an n×n grid (where n is always odd)
- Place black cells (represented as 1) in specific positions
- Fill remaining cells with white (represented as 0)
- Return the resulting grid as a 2D matrix
- The pattern follows a specific rul... | {
"Common Sense": null,
"Data Structures": [
"Matrix"
],
"Dynamic Patterns": [
"Concentric Arrangement",
"Cross Pattern"
],
"Geometric Objects": [
"Square",
"Grid"
],
"Mathematical Operations": null,
"Spatial Transformations": [
"Scaling"
],
"Topological Relations": [
"... | Expansion | |
q10-3 | [{"role": "user", "question": "from typing import List\n\ndef solution(n: int) -> List[List[int]]:\n \"\"\"\n Given an n x n grid, determine the coordinates of a specific pattern that is formed on the grid. \n \n Parameters:\n n (int): The dimensions of the grid (which is an n*n 2D matrix). n is alwa... | from typing import List
def solution(n: int) -> List[List[int]]:
"""
Given an n x n grid, determine the coordinates of a specific pattern that is formed on the grid.
Parameters:
n (int): The dimensions of the grid (which is an n*n 2D matrix). n is always an odd number.
Returns:
... | open | def reference(n):
grid = [[0 for _ in range(n)] for _ in range(n)]
# Middle index
mid = n // 2
# Set the center
grid[mid][mid] = 0
# Set the diagonals
for i in range(mid + 1):
if (i-mid) % 2 == 0:
continue
grid[i][i] = 1
grid[i][n - 1 - i] =... | # Problem Description
This is a grid pattern generation problem where we need to:
- Create an n×n grid (where n is always odd)
- Place black cells (represented as 1) in specific positions
- Fill remaining cells with white (represented as 0)
- Return the resulting grid as a 2D matrix
- The pattern follows a specific rul... | {
"Common Sense": null,
"Data Structures": [
"Matrix"
],
"Dynamic Patterns": [
"Concentric Arrangement",
"Cross Pattern"
],
"Geometric Objects": [
"Square",
"Grid"
],
"Mathematical Operations": null,
"Spatial Transformations": [
"Scaling"
],
"Topological Relations": [
"... | Expansion | |
q100 | [{"role": "user", "question": "from typing import Tuple\nimport math\n\ndef solution(coordinate: Tuple[int, int]) -> int:\n \"\"\"\n Determines the color of the zone at the given coordinate.\n The colors follow an infinitely repeating pattern.\n\n Args:\n coordinate: A tuple (x, y) representing the c... | from typing import Tuple
import math
def solution(coordinate: Tuple[int, int]) -> int:
"""
Determines the color of the zone at the given coordinate.
The colors follow an infinitely repeating pattern.
Args:
coordinate: A tuple (x, y) representing the coordinate point
Returns:
0 for... | open | def test():
test_cases = [
((0.5, 0.5), 1),
((0.5, -0.5),0),
((3, 2), 0),
((-1, 1), 1),
((5, -3), 1),
((5, -4), 0),
((2, 2), 1),
((4, 3), 3),
((7, 7), 0),
((23009853, 23009853), 1),
((-23009853, -23009853), 1),
((99238... | # Problem Description
This is a coordinate-based zone coloring problem where we need to determine the color of a point given its (x,y) coordinates. The plane is divided into alternating black and white circular rings, with special rules for different quadrants. The coloring pattern depends on:
1. The distance from the ... | {
"Common Sense": null,
"Data Structures": null,
"Dynamic Patterns": [
"Alternation",
"Concentric Arrangement"
],
"Geometric Objects": [
"Point",
"Circle",
"Distance",
"Radius",
"Coordinate System"
],
"Mathematical Operations": [
"Value Comparison"
],
"Spatial Transform... | Validation | |
q100-2 | [{"role": "user", "question": "from typing import Tuple\nimport math\n\ndef solution(coordinate: Tuple[int, int]) -> int:\n \"\"\"\n Determines the color of the zone at the given coordinate.\n The colors follow an infinitely repeating pattern.\n\n Args:\n coordinate: A tuple (x, y) representing the c... | from typing import Tuple
import math
def solution(coordinate: Tuple[int, int]) -> int:
"""
Determines the color of the zone at the given coordinate.
The colors follow an infinitely repeating pattern.
Args:
coordinate: A tuple (x, y) representing the coordinate point
Returns:
0 for... | open | def test():
test_cases = [
((0.5, 0.5), 0),
((0.5, -0.5),1),
((3, 2), 1),
((-1, 1), 0),
((5, -3), 0),
((5, -4), 1),
((2, 2), 0),
((4, 3), 3),
((7, 7), 1),
((23009853, 23009853), 0),
((-23009853, -23009853), 0),
((99238... | # Problem Description
This is a coordinate-based zone coloring problem where we need to determine the color of a point given its (x,y) coordinates. The plane is divided into alternating black and white circular rings, with special rules for different quadrants. The coloring pattern depends on:
1. The distance from the ... | {
"Common Sense": null,
"Data Structures": null,
"Dynamic Patterns": [
"Alternation",
"Concentric Arrangement"
],
"Geometric Objects": [
"Point",
"Circle",
"Distance",
"Radius",
"Coordinate System"
],
"Mathematical Operations": [
"Value Comparison"
],
"Spatial Transform... | Validation | |
q100-3 | [{"role": "user", "question": "from typing import Tuple\nimport math\n\ndef solution(coordinate: Tuple[int, int]) -> int:\n \"\"\"\n Determines the color of the zone at the given coordinate.\n The colors follow an infinitely repeating pattern.\n\n Args:\n coordinate: A tuple (x, y) representing the c... | from typing import Tuple
import math
def solution(coordinate: Tuple[int, int]) -> int:
"""
Determines the color of the zone at the given coordinate.
The colors follow an infinitely repeating pattern.
Args:
coordinate: A tuple (x, y) representing the coordinate point
Returns:
0 for... | open | def test():
test_cases = [
((0.5, 0.5), 0),
((0.5, 1.5),1),
((3, 2), 1),
((1, 1), 1),
((5, 3), 1),
((5, 4), 0),
((2, 2), 0),
((4, 3), 3),
((7, 7), 1),
((23009853, 23009853), 0),
((23009853, 23009853), 0),
((992384, 223... | # Problem Description
This is a coordinate-based zone coloring problem where we need to determine the color of a point given its (x,y) coordinates. The plane is divided into alternating black and white circular rings, with special rules. The coloring pattern depends on:
1. The distance from the origin (0,0)
2. Whether ... | {
"Common Sense": null,
"Data Structures": null,
"Dynamic Patterns": [
"Alternation",
"Concentric Arrangement"
],
"Geometric Objects": [
"Point",
"Circle",
"Distance",
"Radius",
"Coordinate System"
],
"Mathematical Operations": [
"Value Comparison"
],
"Spatial Transform... | Validation | |
q11 | [{"role": "user", "question": "from typing import Tuple\n\ndef solution(point1: Tuple[int, int], point2: Tuple[int, int]) -> str:\n \"\"\"\n Determine the relationship between two points based on their layers.\n \n Parameters:\n point1 (Tuple[int, int]): The coordinates of the first point, where both... | from typing import Tuple
def layer(x: int, y: int) -> int:
"""
Determine the layer of a point based on its coordinates.
Parameters:
x (int): The x-coordinate of the point.
y (int): The y-coordinate of the point.
Returns:
int: The layer of the point.
"""
return max(x, y... | open | def test():
test_cases = [
((2, 0), (2, 1), 'A'),
((0, 0), (4, 0), 'C'),
((1, 0), (2, 0), 'B'),
((0, 0), (0, 0), 'A'),
((3, 10), (4, 4), 'C'),
((5, 6), (7, 4), 'B'),
((9, 9), (9, 10), 'B'),
((999, 1002), (1000, 1000), 'C'),
((0, 0), (0, 1), 'B'... | # Problem Description
This is a point relationship classification problem in a layered grid system. Given two points in a coordinate system, we need to determine their relationship, which falls into one of three categories (A, B, or C) based on their relative layer positions. The layers are organized as concentric squa... | {
"Common Sense": null,
"Data Structures": null,
"Dynamic Patterns": [
"Linear Increment",
"Concentric Arrangement",
"Layered Structure"
],
"Geometric Objects": [
"Line",
"Arrow",
"Point",
"Coordinate System",
"Grid"
],
"Mathematical Operations": [
"Value Comparison"
... | Validation | |
q11-2 | [{"role": "user", "question": "from typing import Tuple\n\ndef solution(point1: Tuple[int, int], point2: Tuple[int, int]) -> str:\n \"\"\"\n Determine the relationship between two points based on their layers.\n \n Parameters:\n point1 (Tuple[int, int]): The coordinates of the first point, where both... | from typing import Tuple
def solution(point1: Tuple[int, int], point2: Tuple[int, int]) -> str:
"""
Determine the relationship between two points based on their layers.
Parameters:
point1 (Tuple[int, int]): The coordinates of the first point, where both x and y are non-negative integers.
... | open | def test():
test_cases = [
((2, 0), (2, 1), 'B'),
((1, 1), (0, 2), 'A'),
((0, 3), (1, 2), 'A'),
((0, 0), (4, 0), 'C'),
((1, 0), (2, 0), 'B'),
((0, 0), (0, 0), 'A'),
((3, 10), (4, 4), 'C'),
((5, 6), (7, 4), 'A'),
((9, 9), (9, 10), 'B'),
... | # Problem Description
This problem involves determining the relationship between two points in a layered coordinate system. The layers are organized in a triangular grid pattern, expanding outward from the origin. Given two points, we need to classify their relationship into one of three categories: "A" (Same Layer), "... | {
"Common Sense": null,
"Data Structures": null,
"Dynamic Patterns": [
"Linear Increment",
"Concentric Arrangement",
"Layered Structure"
],
"Geometric Objects": [
"Line",
"Arrow",
"Point",
"Coordinate System",
"Grid"
],
"Mathematical Operations": [
"Value Comparison"
... | Validation | |
q11-3 | [{"role": "user", "question": "from typing import Tuple\n\ndef solution(point1: Tuple[int, int], point2: Tuple[int, int]) -> str:\n \"\"\"\n Determine the relationship between two points based on their layers.\n \n Parameters:\n point1 (Tuple[int, int]): The coordinates of the first point, where both... | from typing import Tuple
def layer(x: int, y: int) -> int:
"""
Determine the layer of a point based on its coordinates.
Parameters:
x (int): The x-coordinate of the point.
y (int): The y-coordinate of the point.
Returns:
int: The layer of the point.
"""
return min(x, y... | open | def test():
test_cases = [
((2, 0), (2, 1), 'B'),
((0, 0), (4, 0), 'A'),
((1, 0), (2, 0), 'A'),
((0, 0), (0, 0), 'A'),
((3, 10), (4, 4), 'B'),
((5, 6), (7, 4), 'B'),
((9, 9), (9, 10), 'A'),
((999, 1002), (1000, 1000), 'B'),
((0, 0), (0, 1), 'A'... | # Problem Description
This problem involves determining the relationship between two points on a coordinate grid based on their respective layers. The grid is divided into layers, with each layer forming a square perimeter around the origin. The relationship between the points can be one of three types:
- "A": Points a... | {
"Common Sense": null,
"Data Structures": null,
"Dynamic Patterns": [
"Linear Increment",
"Concentric Arrangement",
"Layered Structure"
],
"Geometric Objects": [
"Line",
"Arrow",
"Point",
"Coordinate System",
"Grid"
],
"Mathematical Operations": [
"Value Comparison"
... | Validation | |
q12 | [{"role": "user", "question": "from typing import List\n\ndef solution(input_matrix: List[List[str]]) -> List[List[str]]:\n \"\"\"\n Transform the input matrix based on the pattern shown in the figure\n \n Parameters:\n input_matrix (List[List[str]]): Input matrix as a 2d array.\n \n Returns:\n... | from typing import List
def solution(input_matrix: List[List[str]]) -> List[List[str]]:
"""
Transform the input matrix based on the pattern shown in the figure
Parameters:
input_matrix (List[List[str]]): Input matrix as a 2d array.
Returns:
output_matrix (List[List[str]]): Out... | open | def test():
test_cases = [
[['1', '2', '3'], ['4', '#', '6'], ['D', '8', 'a']],
[['1', 'a'], ['3', '#']],
[['4', '@', '1', '8'], ['#', 'a', 'Q', '&'], ['9', '?', '&', '%'], ['b', '$', 'F', 't']],
[['6', '@', '2', '1'], ['9', '#', 'Q', '1'], ['9', '4', '5', '4'], ['1', '1', '1', '1']]... | # Problem Description
The problem requires implementing a matrix transformation function that takes a NxN input matrix and produces a NxN output matrix following specific rotation patterns. The transformation appears to involve both repositioning and rearranging elements in a systematic way.
# Visual Facts
1. Matrix D... | {
"Common Sense": null,
"Data Structures": [
"Matrix"
],
"Dynamic Patterns": null,
"Geometric Objects": [
"Line",
"Grid",
"Arrow"
],
"Mathematical Operations": null,
"Spatial Transformations": [
"Rotation"
],
"Topological Relations": [
"Boundary",
"Adjacency"
]
} | Transformation | |
q12-2 | [{"role": "user", "question": "from typing import List\n\ndef solution(input_matrix: List[List[str]]) -> List[List[str]]:\n \"\"\"\n Transform the input matrix based on the pattern shown in the figure\n \n Parameters:\n input_matrix (List[List[str]]): Input matrix as a 2d array.\n \n Returns:\n... | from typing import List
def solution(input_matrix: List[List[str]]) -> List[List[str]]:
"""
Transform the input matrix based on the pattern shown in the figure
Parameters:
input_matrix (List[List[str]]): Input matrix as a 2d array.
Returns:
output_matrix (List[List[str]]): Out... | open | def test():
test_cases = [
[['1', '2', '3'], ['4', '#', '6'], ['D', '8', 'a']],
[['1', 'a'], ['3', '#']],
[['4', '@', '1', '8'], ['#', 'a', 'Q', '&'], ['9', '?', '&', '%'], ['b', '$', 'F', 't']],
[['6', '@', '2', '1'], ['9', '#', 'Q', '1'], ['9', '4', '5', '4'], ['1', '1', '1', '1']]... | # Problem Description
The problem requires implementing a matrix transformation function that takes a NxN input matrix and produces a NxN output matrix. The transformation appears to be a reflection or mirroring operation around a vertical axis that runs through the center of the matrix.
# Visual Facts
1. Matrix Prope... | {
"Common Sense": null,
"Data Structures": [
"Matrix"
],
"Dynamic Patterns": [
"Mirror Symmetry",
"Mirror Reflection"
],
"Geometric Objects": [
"Line",
"Grid",
"Arrow"
],
"Mathematical Operations": null,
"Spatial Transformations": [
"Rotation",
"Flipping"
],
"Topolo... | Transformation | |
q12-3 | [{"role": "user", "question": "from typing import List\n\ndef solution(input_matrix: List[List[str]]) -> List[List[str]]:\n \"\"\"\n Transform the input matrix based on the pattern shown in the figure\n \n Parameters:\n input_matrix (List[List[str]]): Input matrix as a 2d array.\n \n Returns:\n... | from typing import List
def solution(input_matrix: List[List[str]]) -> List[List[str]]:
"""
Transform the input matrix based on the pattern shown in the figure
Parameters:
input_matrix (List[List[str]]): Input matrix as a 2d array.
Returns:
output_matrix (List[List[str]]): Out... | open | def test():
test_cases = [
[['1', '2', '3'], ['4', '#', '6'], ['D', '8', 'a']],
[['1', 'a'], ['3', '#']],
[['4', '@', '1', '8'], ['#', 'a', 'Q', '&'], ['9', '?', '&', '%'], ['b', '$', 'F', 't']],
[['6', '@', '2', '1'], ['9', '#', 'Q', '1'], ['9', '4', '5', '4'], ['1', '1', '1', '1']]... | Let me analyze your problem:
# Problem Description
The problem requires implementing a matrix transformation function that takes a NxN input matrix and produces a NxN output matrix. The transformation appears to be a horizontal flip or reflection around a horizontal axis that runs through the middle of the matrix.
# ... | {
"Common Sense": null,
"Data Structures": [
"Matrix"
],
"Dynamic Patterns": [
"Mirror Symmetry",
"Mirror Reflection"
],
"Geometric Objects": [
"Line",
"Grid",
"Arrow"
],
"Mathematical Operations": null,
"Spatial Transformations": [
"Rotation",
"Flipping"
],
"Topolo... | Transformation | |
q13 | [{"role": "user", "question": "def solution(nodes: dict, edges: list, start: str, end: str) -> int:\n \"\"\"\n Given the nodes and edges of a graph, determine the minimum path cost from a given starting node to an ending node.\n Please observe the example graph in the image to deduce the pattern calculating th... | import heapq
def solution(nodes: dict, edges: list, start: str, end: str) -> int:
"""
Given the nodes and edges of a graph, determine the minimum path cost from a given starting node to an ending node.
Please observe the example graph in the image to deduce the pattern calculating the path cost between two... | open | def test():
nodes = {'A': 10, 'B': 3, 'C': -2, 'D': -8, 'E': -6, 'F': 4}
connections = [('A', 'B'), ('B', 'C'), ('B', 'D'), ('D', 'E'), ('D', 'F')]
pairs = [('A', 'C'), ('B', 'E'), ('A', 'F'), ('A', 'D'), ('A', 'E'), ('B', 'F')]
expected_results = [18, 25, 36, 24, 38, 23]
for index, (start, end... | # Problem Description
This is a graph pathfinding problem where we need to:
- Find the minimum cost path between two given nodes in an undirected weighted graph
- Each node has an associated value
- Each edge has a cost
- The total path cost must follow a specific pattern based on the nodes' values and edge costs
- We ... | {
"Common Sense": null,
"Data Structures": [
"Undirected Graph",
"Path"
],
"Dynamic Patterns": null,
"Geometric Objects": null,
"Mathematical Operations": [
"Absolute Value",
"Basic Arithmetic"
],
"Spatial Transformations": null,
"Topological Relations": [
"Adjacency",
"Connect... | Direct Calculation | |
q13-2 | [{"role": "user", "question": "def solution(nodes: dict, edges: list, start: str, end: str) -> int:\n \"\"\"\n Given the nodes and edges of a graph, determine the minimum path cost from a given starting node to an ending node.\n Please observe the example graph in the image to deduce the pattern calculating th... | import heapq
def solution(nodes: dict, edges: list, start: str, end: str) -> int:
"""
Given the nodes and edges of a graph, determine the minimum path cost from a given starting node to an ending node.
Please observe the example graph in the image to deduce the pattern calculating the path cost between two... | open | def test():
nodes = {'A': 10, 'B': 3, 'C': -2, 'D': -8, 'E': -6, 'F': 4}
connections = [('A', 'B'), ('B', 'C'), ('B', 'D'), ('D', 'E'), ('D', 'F')]
pairs = [('A', 'C'), ('B', 'E'), ('A', 'F'), ('A', 'D'), ('A', 'E'), ('B', 'F')]
expected_results = [36, 72, 86, 54, 102, 56]
for index, (start, en... | # Problem Description
This problem involves finding the minimum cost path between two nodes in an undirected weighted graph. Each node has an associated value, and each edge has a cost. The goal is to determine the minimum cost required to travel from a given starting node to an ending node, following a specific patter... | {
"Common Sense": null,
"Data Structures": [
"Undirected Graph",
"Path"
],
"Dynamic Patterns": null,
"Geometric Objects": null,
"Mathematical Operations": [
"Absolute Value",
"Basic Arithmetic"
],
"Spatial Transformations": null,
"Topological Relations": [
"Adjacency",
"Connect... | Direct Calculation | |
q13-3 | [{"role": "user", "question": "def solution(nodes: dict, edges: list, start: str, end: str) -> int:\n \"\"\"\n Given the nodes and edges of a graph, determine the minimum path cost from a given starting node to an ending node.\n Please observe the example graph in the image to deduce the pattern calculating th... | import heapq
def solution(nodes: dict, edges: list, start: str, end: str) -> int:
"""
Given the nodes and edges of a graph, determine the minimum path cost from a given starting node to an ending node.
Please observe the example graph in the image to deduce the pattern calculating the path cost between two... | open | def test():
nodes = {'A': 10, 'B': 3, 'C': -2, 'D': -8, 'E': -6, 'F': 4}
connections = [('A', 'B'), ('B', 'C'), ('B', 'D'), ('D', 'E'), ('D', 'F')]
pairs = [('A', 'C'), ('B', 'E'), ('A', 'F'), ('A', 'D'), ('A', 'E'), ('B', 'F')]
expected_results = [12, 13, 30, 18, 20, 23]
for index, (start, end... | # Problem Description
This is a graph pathfinding problem where we need to:
- Find the minimum cost path between two given nodes in an undirected weighted graph.
- Each node has an associated value.
- Each edge has a cost.
- The total path cost must follow a specific pattern based on the nodes' values and edge costs.
-... | {
"Common Sense": null,
"Data Structures": [
"Undirected Graph",
"Path"
],
"Dynamic Patterns": null,
"Geometric Objects": null,
"Mathematical Operations": [
"Basic Arithmetic",
"Value Comparison"
],
"Spatial Transformations": null,
"Topological Relations": [
"Adjacency",
"Conne... | Direct Calculation | |
q14 | [{"role": "user", "question": "def solution(start: tuple[int, int], target: tuple[int, int], direction: tuple[int, int]) -> bool:\n \"\"\"\n Determines whether the ball can reach the target.\n\n Parameters:\n - start: Tuple[int, int], represents the initial position of the ball (x, y).\n - target: Tuple[... | def solution(start: tuple[int, int], target: tuple[int, int], direction: tuple[int, int]) -> bool:
"""
Determines whether the ball can reach the target.
Parameters:
- start: Tuple[int, int], represents the initial position of the ball (x, y).
- target: Tuple[int, int], represents the position of th... | open | def test():
test_cases = [
[(8, 7), (6, 9), (1, -1), True],
[(8, 7), (6, 10), (1, -1), False],
[(8, 7), (9, 6), (1, -1), True],
[(0, 0), (1, 1), (1, 0), False],
[(0, 0), (2, 2), (1, 1), True],
[(0, 0), (0, 1), (0, 1), True],
[(2, 1), (6, 10),... | # Problem Description
This is a ball trajectory problem where we need to determine if a ball starting from a given position with an initial direction can reach a target position after bouncing off the boundaries of a 10x10 grid. The ball follows the law of reflection (angle of incidence equals angle of reflection) when... | {
"Common Sense": null,
"Data Structures": [
"Path"
],
"Dynamic Patterns": [
"Bouncing"
],
"Geometric Objects": [
"Grid",
"Arrow",
"Point",
"Line",
"Coordinate System"
],
"Mathematical Operations": null,
"Spatial Transformations": null,
"Topological Relations": [
"Int... | Validation | |
q14-2 | [{"role": "user", "question": "def solution(start_1: tuple[int, int], start_2: tuple[int, int], direction_1: tuple[int, int], direction_2: tuple[int, int]) -> bool:\n \"\"\"\n Determines whether the two balls will collide.\n\n Parameters:\n - start_1: Tuple[int, int], represents the initial position of ball... | def solution(start_1: tuple[int, int], start_2: tuple[int, int], direction_1: tuple[int, int], direction_2: tuple[int, int]) -> bool:
"""
Determines whether the two balls will collide.
Parameters:
- start_1: Tuple[int, int], represents the initial position of ball 1 (x, y).
- start_2: Tuple[int, in... | open | def test():
test_cases = [
[(8, 7), (6, 9), (1, -1), (1, 1), False],
[(8, 7), (6, 9), (1, -1), (-1, 1), True],
[(8, 7), (6, 9), (-1, 1), (1, -1), True],
[(8, 7), (9, 6), (1, -1), (1, -1), False],
[(0, 0), (1, 1), (1, 0), (1, 1), False],
[(0, 0), (0, 3), (1, 0... | # Problem Description
This problem involves determining whether two balls, starting from different positions and moving in specified directions, will collide on a 10x10 grid. The balls bounce off the boundaries of the grid according to the law of reflection (angle of incidence equals angle of reflection). The task is t... | {
"Common Sense": null,
"Data Structures": [
"Path"
],
"Dynamic Patterns": [
"Bouncing"
],
"Geometric Objects": [
"Grid",
"Arrow",
"Point",
"Line",
"Coordinate System"
],
"Mathematical Operations": null,
"Spatial Transformations": null,
"Topological Relations": [
"Int... | Validation | |
q14-3 | [{"role": "user", "question": "def solution(start: tuple[int, int], direction: tuple[int, int]) -> bool:\n \"\"\"\n Determines whether the ball can go into the hole\n\n Parameters:\n - start: Tuple[int, int], represents the initial position of the ball (x, y).\n - direction: Tuple[int, int], represents t... | def solution(start: tuple[int, int], direction: tuple[int, int]) -> bool:
"""
Determines whether the ball can go into the hole
Parameters:
- start: Tuple[int, int], represents the initial position of the ball (x, y).
- direction: Tuple[int, int], represents the initial direction of the ball (dx, dy... | open | def test():
test_cases = [
[(8, 7), (1, -1), False],
[(8, 7), (-1, -1), False],
[(8, 8), (1, -1), True],
[(0, 0), (1, 0), False],
[(0, 0), (1, 1), True],
[(0, 0), (0, 1), False],
[(2, 1), (-1, -1), False],
[(2, 1), (0, 1), True],
... | # Problem Description
This problem involves determining if a ball starting from a given position with an initial direction can reach any of the holes on a 10x10 grid. The ball follows the law of reflection when it hits the boundaries of the grid. The task is to simulate the ball's movement and check if it eventually fa... | {
"Common Sense": null,
"Data Structures": [
"Path"
],
"Dynamic Patterns": [
"Bouncing"
],
"Geometric Objects": [
"Grid",
"Arrow",
"Point",
"Line",
"Coordinate System"
],
"Mathematical Operations": null,
"Spatial Transformations": null,
"Topological Relations": [
"Int... | Validation | |
q15 | [{"role": "user", "question": "def solution(end_time: int) -> int:\n \"\"\"\n Calculate how many layers of cups have been full-filled by the given end time.\n\n Input:\n - end_time: the given end time.\n\n Output:\n - the total numbers of full-filled layers.\n \"\"\"\n", "hint": "", "options": {}, ... | def solution(end_time: int) -> int:
"""
Calculate how many layers of cups have been full-filled by the given end time.
Input:
- end_time: the given end time.
Output:
- the total numbers of full-filled layers.
"""
layers_filled = 0
total_time = 0
while True:
time_for_nex... | open | def test():
test_cases = [
(1*8, 1),
(2*8, 1),
(3*8, 2),
(4*8, 2),
(5*8, 2),
(7*8, 3),
(9*8, 3),
(25*8, 4),
(30*8, 4),
(50*8, 5),
(70*8, 6),
(100*8, 6),
]
for i, (end_time, expected_output) in enumerate(test_case... | # Problem Description
This is a water flow simulation problem in a pyramid-like cup structure. Water is poured continuously from the top, and when a cup is full, it overflows equally to the two cups below it. The task is to calculate how many layers of cups are completely filled at a given time point.
# Visual Facts
1... | {
"Common Sense": [
"Flow of Water",
"Capacity"
],
"Data Structures": null,
"Dynamic Patterns": [
"Layered Structure",
"Propagation"
],
"Geometric Objects": null,
"Mathematical Operations": null,
"Spatial Transformations": null,
"Topological Relations": [
"Connectivity",
"Conne... | Iterative Calculation | |
q16 | [{"role": "user", "question": "def solution(grid: list[int]) -> int:\n \"\"\"\n Calculate the number of communities according to the image.\n\n Input:\n - grid: A list representing the initial grid, each str element is a row of the grid. The 'x' indicates a gray square and '.' indicates a white square.\n\n ... | def solution(grid: list[int]) -> int:
"""
Calculate the number of communities according to the image.
Input:
- grid: A list representing the initial grid, each str element is a row of the grid. The 'x' indicates a gray square and '.' indicates a white square.
Output:
- An integer representing ... | open | def test():
test_cases = [
([".x.x",
"xxxx"], 2),
(["....",
"..xx"], 1),
([".xxxx....",
"..xxx.xxx"], 2),
(["xxx..",
"...x."], 1),
(["xxx..xx",
"...xx.."], 1),
(["x.x..x",
".x...x",
"..x.xx",
... | # Problem Description
This is a grid-based problem where we need to count the number of "communities" in a given grid. A community appears to be a group of connected white squares (represented by '.') in a grid where some squares are gray (represented by 'x'). The goal is to return the total count of distinct communiti... | {
"Common Sense": null,
"Data Structures": [
"Matrix"
],
"Dynamic Patterns": null,
"Geometric Objects": [
"Grid",
"Square"
],
"Mathematical Operations": null,
"Spatial Transformations": [
"Clustering",
"Grouping"
],
"Topological Relations": [
"Connectivity",
"Adjacency"
... | Aggregation | |
q17 | [{"role": "user", "question": "def solution(matrix: list[list[int]]) -> list[list[int]]:\n \"\"\"\n Refer to the example cases illustrated in the figure, identify and implement the pooling operation on the matrix.\n\n Input:\n - matrix: A 2d list representing the initial matrix. For example, [[1,3,4,2], [2,... | def solution(matrix: list[list[int]]) -> list[list[int]]:
"""
Refer to the example cases illustrated in the figure, identify and implement the pooling operation on the matrix.
Input:
- matrix: A 2d list representing the initial matrix. For example, [[1,3,4,2], [2,1,1,3], [1,2,2,4], [3,2,1,0]]
Outp... | open | def test():
test_cases = [
{
"input":[
[1,2],
[3,4]
],
"expected":[
[1]
]
},
{
"input": [
[1, 3, 4, 2],
[2, 1, 1, 3],
[1, 2, 2, 4],
... | # Problem Description
This is a matrix pooling operation problem where a larger input matrix needs to be transformed into a smaller output matrix using specific rules. The pooling operation appears to reduce the size of the input matrix by processing 2×2 regions into single values in the output matrix. The goal is to i... | {
"Common Sense": null,
"Data Structures": [
"Matrix"
],
"Dynamic Patterns": null,
"Geometric Objects": null,
"Mathematical Operations": [
"Value Comparison",
"Aggregation"
],
"Spatial Transformations": [
"Grouping",
"Scaling",
"Filtering"
],
"Topological Relations": [
"A... | Aggregation | |
q17-2 | [{"role": "user", "question": "def solution(matrix: list[list[int]]) -> list[list[int]]:\n \"\"\"\n Refer to the example cases illustrated in the figure, identify and implement the pooling operation on the matrix.\n\n Input:\n - matrix: A 2d list representing the initial matrix. For example, [[1,3,4,2], [2,... | def solution(matrix: list[list[int]]) -> list[list[int]]:
"""
Refer to the example cases illustrated in the figure, identify and implement the pooling operation on the matrix.
Input:
- matrix: A 2d list representing the initial matrix. For example, [[1,3,4,2], [2,1,1,3], [1,2,2,4], [3,2,1,0]]
Outp... | open | def test():
test_cases = [
{
"input": [
[1, -2],
[3, 4]
],
"expected": [
[4]
]
},
{
"input": [
[1, 3, 4, 2],
[2, 1, 1, 3],
[1, 2, 2, 4]... | # Problem Description
This problem involves performing a pooling operation on a given 2D matrix. The pooling operation reduces the size of the matrix by processing 2x2 regions into single values in the output matrix. The goal is to implement this transformation according to the pattern shown in the examples.
# Visual ... | {
"Common Sense": null,
"Data Structures": [
"Matrix"
],
"Dynamic Patterns": null,
"Geometric Objects": null,
"Mathematical Operations": [
"Value Comparison",
"Aggregation",
"Absolute Value"
],
"Spatial Transformations": [
"Grouping",
"Scaling",
"Filtering"
],
"Topologica... | Aggregation | |
q17-3 | [{"role": "user", "question": "def solution(matrix: list[list[int]]) -> list[list[int]]:\n \"\"\"\n Refer to the example cases illustrated in the figure, identify and implement the pooling operation on the matrix.\n\n Input:\n - matrix: A 2d list representing the initial matrix. For example, [[1,3,4], [2,1,... | def solution(matrix: list[list[int]]) -> list[list[int]]:
"""
Refer to the example cases illustrated in the figure, identify and implement the pooling operation on the matrix.
Input:
- matrix: A 2d list representing the initial matrix. For example, [[1,3,4], [2,1,1], [1,2,2]]
Output:
- A 2d li... | open | def test():
test_cases = [
{
"input": [
[1, 2, 6],
[3, 4, 3],
[8, 7, 9],
],
"expected": [
[1]
]
},
{
"input": [
[1, 3, 4, 2, 0, 3],
[2, ... | # Problem Description
This problem involves performing a pooling operation on a given matrix. The pooling operation reduces the size of the matrix by selecting specific elements from sub-regions of the original matrix. The goal is to implement this transformation according to the patterns shown in the examples.
# Visu... | {
"Common Sense": null,
"Data Structures": [
"Matrix"
],
"Dynamic Patterns": null,
"Geometric Objects": null,
"Mathematical Operations": [
"Value Comparison",
"Aggregation"
],
"Spatial Transformations": [
"Grouping",
"Scaling",
"Filtering"
],
"Topological Relations": [
"A... | Aggregation | |
q18 | [{"role": "user", "question": "from typing import List\n\n\ndef solution(matrix: List[List[int]]) -> List[int]:\n \"\"\"\n Given an M x N 2D matrix, traverse the matrix according to the spiral pattern shown in the figure\n\n Parameters:\n matrix (List[List[int]]): A 2D list of integers representing the matr... | from typing import List
def solution(matrix: List[List[int]]) -> List[int]:
"""
Given an M x N 2D matrix, traverse the matrix according to the spiral pattern shown in the figure
Parameters:
matrix (List[List[int]]): A 2D list of integers representing the matrix.
Returns:
List[int]: A list of... | open | def test():
test_cases = [
([[1, 2]], [2, 1]),
([[1, 2], [3, 4]], [2, 1, 3, 4]),
([[1, 2, 3],
[4, 5, 6],
[7, 8 , 9]], [3, 2, 1, 4, 7, 8, 9, 6, 5]),
([[1,2,3,4],
[5,6,7,8],
[9,10,11,12]], [4, 3, 2, 1, 5, 9, 10, 11, 12, 8, 7, 6]),
([[1,... | # Problem Description
This is a matrix traversal problem where we need to:
- Start from the top-right corner of a given matrix
- Follow a specific spiral pattern in counter-clockwise direction
- Collect all elements in the order of traversal
- The traversal pattern should work for matrices of different sizes (MxN)
# V... | {
"Common Sense": null,
"Data Structures": [
"Path",
"Matrix",
"Directed Graph"
],
"Dynamic Patterns": [
"Cyclic Motion",
"Spiral"
],
"Geometric Objects": [
"Grid",
"Arrow"
],
"Mathematical Operations": null,
"Spatial Transformations": null,
"Topological Relations": [
... | Transformation | |
q18-2 | [{"role": "user", "question": "from typing import List\n\n\ndef solution(matrix: List[List[int]]) -> List[int]:\n \"\"\"\n Given an M x N 2D matrix, traverse the matrix according to the spiral pattern shown in the figure\n\n Parameters:\n matrix (List[List[int]]): A 2D list of integers representing the matr... | from typing import List
def solution(matrix: List[List[int]]) -> List[int]:
"""
Given an M x N 2D matrix, traverse the matrix according to the spiral pattern shown in the figure
Parameters:
matrix (List[List[int]]): A 2D list of integers representing the matrix.
Returns:
List[int]: A list of... | open | def test():
test_cases = [
([[1, 2]], [2, 1]),
([[1, 2], [3, 4]], [4, 3, 1, 2]),
([[1, 2, 3],
[4, 5, 6],
[7, 8 , 9]], [9, 8, 7, 4, 1, 2, 3, 6, 5]),
([[1,2,3,4],
[5,6,7,8],
[9,10,11,12]], [12, 11, 10, 9, 5, 1, 2, 3, 4, 8, 7, 6]),
([[1,... | # Problem Description
The problem requires implementing a matrix traversal function that follows a specific spiral pattern. Given a matrix of M x N dimensions, we need to return the elements in a specific order that follows a spiral path starting from the bottom-right corner, moving initially leftward, and then followi... | {
"Common Sense": null,
"Data Structures": [
"Path",
"Matrix",
"Directed Graph"
],
"Dynamic Patterns": [
"Cyclic Motion",
"Spiral"
],
"Geometric Objects": [
"Grid",
"Arrow"
],
"Mathematical Operations": null,
"Spatial Transformations": null,
"Topological Relations": [
... | Transformation | |
q18-3 | [{"role": "user", "question": "from typing import List\n\n\ndef solution(matrix: List[List[int]]) -> List[int]:\n \"\"\"\n Given an M x N 2D matrix, traverse the matrix according to the spiral pattern shown in the figure\n\n Parameters:\n matrix (List[List[int]]): A 2D list of integers representing the matr... | from typing import List
def solution(matrix: List[List[int]]) -> List[int]:
"""
Given an M x N 2D matrix, traverse the matrix according to the spiral pattern shown in the figure
Parameters:
matrix (List[List[int]]): A 2D list of integers representing the matrix.
Returns:
List[int]: A list of... | open | def test():
test_cases = [
([[1, 2]], [1, 2]),
([[1, 2], [3, 4]], [3, 4, 2, 1]),
([[1, 2, 3],
[4, 5, 6],
[7, 8 , 9]], [7, 8, 9, 6, 3, 2, 1, 4, 5]),
([[1,2,3,4],
[5,6,7,8],
[9,10,11,12]], [9, 10, 11, 12, 8, 4, 3, 2, 1, 5, 6, 7]),
([[1,... | # Problem Description
The problem requires implementing a matrix traversal function that follows a specific spiral pattern. Given a matrix of M x N dimensions, we need to return the elements in a specific order that follows a spiral path starting from the bottom-left corner, moving initially rightward, and then followi... | {
"Common Sense": null,
"Data Structures": [
"Path",
"Matrix",
"Directed Graph"
],
"Dynamic Patterns": [
"Cyclic Motion",
"Spiral"
],
"Geometric Objects": [
"Grid",
"Arrow"
],
"Mathematical Operations": null,
"Spatial Transformations": null,
"Topological Relations": [
... | Transformation | |
q19 | [{"role": "user", "question": "\ndef solution(dragon_life: float, player_life: float, dragon_attack_point: float, player_attack_point: float) -> int:\n \"\"\"\n Build the dragon slaying game as shown in the diagram, and calculate how many life points the winner has left.\n\n Parameters:\n dragon_life (f... | def solution(dragon_life: float, player_life: float, dragon_attack_point: float, player_attack_point: float) -> int:
"""
Build the dragon slaying game as shown in the diagram, and calculate how many life points the winner has left.
Parameters:
dragon_life (float): The life points of the dragon.
... | open | def test():
test_cases = [
(100, 90, 10, 5, 49),
(59.9, 78, 60, 26.6, 1),
(1000.1, 100.79, 8.54, 50.3, 396),
(63, 100, 100, 1, 62),
(1000.34, 10, 11, 1001, 10),
(150.33, 176.24, 23.5, 26.8, 68),
(92.3, 11.1, 1, 32.3, 9),
(12384.4, 13323.9, 10.1, 11.1, ... | # Problem Description
This is a turn-based battle game simulation between a player and a dragon. The game has two distinct status phases with different attack patterns. The goal is to calculate the remaining life points of whoever wins the battle (either dragon or player). The battle follows specific rules for attack p... | {
"Common Sense": null,
"Data Structures": null,
"Dynamic Patterns": null,
"Geometric Objects": [
"Arrow"
],
"Mathematical Operations": [
"Flowcharting",
"Conditional Branching",
"Value Comparison"
],
"Spatial Transformations": null,
"Topological Relations": [
"Connectivity",
"... | Direct Calculation | |
q19-2 | [{"role": "user", "question": "\ndef solution(dragon_life: float, player_life: float, dragon_attack_point: float, player_attack_point: float) -> int:\n \"\"\"\n Build the dragon slaying game as shown in the diagram, and calculate how many life points the winner has left.\n\n Parameters:\n dragon_life (f... | def solution(dragon_life: float, player_life: float, dragon_attack_point: float, player_attack_point: float) -> int:
"""
Build the dragon slaying game as shown in the diagram, and calculate how many life points the winner has left.
Parameters:
dragon_life (float): The life points of the dragon.
... | open | def test():
test_cases = [
(100, 90, 10, 5, 55),
(59.9, 78, 60, 26.6, 39),
(1000.1, 100.79, 8.54, 50.3, 396),
(63, 100, 100, 1, 62),
(1000.34, 10, 11, 1001, 10),
(150.33, 176.24, 23.5, 26.8, 66),
(92.3, 11.1, 1, 32.3, 9),
(12384.4, 13323.9, 10.1, 11.1,... | # Problem Description
This is a turn-based battle game simulation between a player and a dragon. The game has two distinct status phases with different attack patterns. The goal is to calculate the remaining life points of whoever wins the battle (either dragon or player). The battle follows specific rules for attack p... | {
"Common Sense": null,
"Data Structures": null,
"Dynamic Patterns": null,
"Geometric Objects": [
"Arrow"
],
"Mathematical Operations": [
"Flowcharting",
"Conditional Branching",
"Value Comparison"
],
"Spatial Transformations": null,
"Topological Relations": [
"Connectivity",
"... | Direct Calculation | |
q19-3 | [{"role": "user", "question": "\ndef solution(dragon_life: float, player_life: float, dragon_attack_point: float, player_attack_point: float) -> int:\n \"\"\"\n Build the dragon slaying game as shown in the diagram, and calculate how many life points the winner has left.\n\n Parameters:\n dragon_life (f... | def solution(dragon_life: float, player_life: float, dragon_attack_point: float, player_attack_point: float) -> int:
"""
Build the dragon slaying game as shown in the diagram, and calculate how many life points the winner has left.
Parameters:
dragon_life (float): The life points of the dragon.
... | open | def test():
test_cases = [
(90, 100, 5, 10, 49),
(78, 59.9, 26.6, 60, 1),
(100.79, 1000.1, 50.3, 8.54, 396),
(100, 63, 1, 100, 62),
(10, 1000.34, 1001, 11, 10),
(176.24, 150.33, 26.8, 23.5, 68),
(11.1, 92.3, 32.3, 1, 9),
(13323.9, 12384.4, 11.1, 10.1, ... | # Problem Description
This is a turn-based battle game simulation between a player and a dragon. The game has two distinct status phases with different attack patterns. The goal is to calculate the remaining life points of whoever wins the battle (either dragon or player). The battle follows specific rules for attack p... | {
"Common Sense": null,
"Data Structures": null,
"Dynamic Patterns": null,
"Geometric Objects": [
"Arrow"
],
"Mathematical Operations": [
"Flowcharting",
"Conditional Branching",
"Value Comparison"
],
"Spatial Transformations": null,
"Topological Relations": [
"Connectivity",
"... | Direct Calculation | |
q2 | [{"role": "user", "question": "from typing import List\n\ndef solution() -> List[List[float]]:\n \"\"\"\n generate a set of 1000 data points that match the distribution shown in the figure\n\n Returns:\n List[List[float]]: A 2D array of shape (1000, 2), where each row contains the x and y coordinates of... | from typing import List
import numpy as np
def solution() -> List[List[float]]:
"""
generate a set of 1000 data points that match the distribution shown in the figure
Returns:
List[List[float]]: A 2D array of shape (1000, 2), where each row contains the x and y coordinates of a point.
"""
... | open |
import numpy as np
def quartile_test(points):
x_quartiles = np.percentile(points[:, 0], [25, 50, 75])
y_quartiles = np.percentile(points[:, 1], [25, 50, 75])
theoretical_quartiles = [0.2, 0.5, 0.8]
x_check = np.allclose(x_quartiles, theoretical_quartiles, atol=0.1)
y_check = np.allclose(y_quartil... | # Problem Description
The task is to generate a dataset of 1000 2D points that follows a specific distribution pattern shown in the figure. The points should be distributed within a 1x1 square area with special constraints around a circular region. The output should be a 2D array of shape (1000, 2) where each row repre... | {
"Common Sense": null,
"Data Structures": null,
"Dynamic Patterns": [
"Concentric Arrangement"
],
"Geometric Objects": [
"Point",
"Coordinate System",
"Circle"
],
"Mathematical Operations": [
"Random Distribution"
],
"Spatial Transformations": [
"Clustering"
],
"Topologica... | Direct Calculation | |
q2-2 | [{"role": "user", "question": "from typing import List\n\ndef solution() -> List[List[float]]:\n \"\"\"\n generate a set of 1000 data points that match the distribution shown in the figure\n\n Returns:\n List[List[float]]: A 2D array of shape (1000, 2), where each row contains the x and y coordinates of... | from typing import List
import numpy as np
def solution() -> List[List[float]]:
"""
generate a set of 1000 data points that match the distribution shown in the figure
Returns:
List[List[float]]: A 2D array of shape (1000, 2), where each row contains the x and y coordinates of a point.
"""
... | open | import numpy as np
def quartile_test(points):
x_quartiles = np.percentile(points[:, 0], [25, 50, 75])
y_quartiles = np.percentile(points[:, 1], [25, 50, 75])
theoretical_quartiles = [0.4, 0.5, 0.6]
x_check = np.allclose(x_quartiles, theoretical_quartiles, atol=0.1)
y_check = np.allclose(y_quar... | # Problem Description
The task is to generate a dataset of 1000 2D points that follows a specific distribution pattern shown in the figure. The points should be distributed within a circular area with a radius of 0.25. The output should be a 2D array of shape (1000, 2) where each row represents the (x,y) coordinates of... | {
"Common Sense": null,
"Data Structures": null,
"Dynamic Patterns": [
"Concentric Arrangement"
],
"Geometric Objects": [
"Point",
"Coordinate System",
"Circle"
],
"Mathematical Operations": [
"Random Distribution"
],
"Spatial Transformations": [
"Clustering"
],
"Topologica... | Direct Calculation |
End of preview. Expand in Data Studio
README.md exists but content is empty.
- Downloads last month
- 71