Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 9 additions & 14 deletions tasks/easy/arrays/matrix_sums_equality.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ tags = ["math", "arrays", "matrix"]
time_to_solve_sec = 250

description_en = """
Given a $3 \times 3$ matrix of integers, determine if the sum of elements in every row and every column is the same. Return `true` if all sums are equal, otherwise return `false`.
Given a $3 \\times 3$ matrix of integers, determine if the sum of elements in every row and every column is the same. Return `true` if all sums are equal, otherwise return `false`.
"""

description_ru = """
Дана матрица $3 \times 3$, состоящая из целых чисел. Проверьте, равны ли суммы чисел во всех строках и всех столбцах. Верните `true`, если все суммы равны, иначе — `false`.
Дана матрица $3 \\times 3$, состоящая из целых чисел. Проверьте, равны ли суммы чисел во всех строках и всех столбцах. Верните `true`, если все суммы равны, иначе — `false`.
"""

limits = """
- $\text{len}(m) = 3$
- $\text{len}(m[i]) = 3$
- $-10^6 \leq m_{i,j} \leq 10^6$
- $\\text{len}(m) = 3$
- $\\text{len}(m[i]) = 3$
- $-10^6 \\leq m_{i,j} \\leq 10^6$
"""

solution = """
Expand Down Expand Up @@ -96,11 +96,6 @@ arguments = [[[4, 9, 2], [3, 5, 7], [8, 1, 6]]]
comment = "Reflected magic square"
expected = true

[[asserts]]
arguments = [[[100, 0, 0], [0, 100, 0], [0, 0, 100]]]
comment = "Identity-like matrix (sums differ)"
expected = false

[[asserts]]
arguments = [[[5, 5, 5], [5, 5, 5], [5, 5, 4]]]
comment = "One element difference"
Expand All @@ -109,7 +104,7 @@ expected = false
[[asserts]]
arguments = [[[7, 0, 0], [0, 7, 0], [0, 0, 7]]]
comment = "Diagonal matrix with same values"
expected = false
expected = true

[[asserts]]
arguments = [[[1, 1, 4], [4, 1, 1], [1, 4, 1]]]
Expand All @@ -133,8 +128,8 @@ expected = true

[[asserts]]
arguments = [[[1000000, 0, 0], [0, 1000000, 0], [0, 0, 1000000]]]
comment = "Large values, unequal sums"
expected = false
comment = "Large values, equal sums"
expected = true

[[asserts]]
arguments = [[[50, 50, 50], [50, 50, 50], [50, 50, 50]]]
Expand All @@ -144,7 +139,7 @@ expected = true
[[asserts]]
arguments = [[[1, 0, 0], [0, 1, 0], [0, 0, 1]]]
comment = "Standard identity matrix"
expected = false
expected = true

[[asserts]]
arguments = [[[2, 2, 2], [2, 2, 2], [2, 2, 2]]]
Expand Down
2 changes: 1 addition & 1 deletion tasks/easy/arrays/palindrome_by_removing_one.toml
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ expected = true
[[asserts]]
arguments = [[1, 2, 1, 2, 1, 2]]
comment = "Alternating"
expected = false
expected = true

[[asserts]]
arguments = [[4, 3, 2, 1, 2, 3, 4]]
Expand Down
18 changes: 9 additions & 9 deletions tasks/easy/greedy/autobattler_squad.toml
Original file line number Diff line number Diff line change
Expand Up @@ -157,18 +157,18 @@ expected = 16

[[asserts]]
arguments = [27, 3]
comment = "Still only one best warrior available"
expected = 16
comment = "Exactly enough for 3 best warriors"
expected = 48

[[asserts]]
arguments = [30, 2]
comment = "One best and one upgraded"
expected = 20
comment = "3 best and 1 upgraded available, squad limit two, take 2 best"
expected = 32

[[asserts]]
arguments = [50, 5]
comment = "Mix of tiers: 1 best, 5 upgraded, 2 normal"
expected = 32
comment = "Mix of tiers: 5 best, 1 upgraded, 2 normal. Take 5 best"
expected = 80

[[asserts]]
arguments = [80, 2]
Expand All @@ -193,7 +193,7 @@ expected = 160
[[asserts]]
arguments = [123, 456]
comment = "k is larger than total units available"
expected = 83
expected = 216

[[asserts]]
arguments = [1000000, 100]
Expand Down Expand Up @@ -222,5 +222,5 @@ expected = 20

[[asserts]]
arguments = [40, 40]
comment = "Take all: 1 best, 4 upgraded, 1 normal"
expected = 33
comment = "Take all: 4 best, 1 upgraded, 1 normal"
expected = 69
6 changes: 3 additions & 3 deletions tasks/easy/greedy/maximum_cars_to_finish.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ description_ru = """
"""

limits = """
- $1 \leq x \leq 10^4$
- $1 \leq \text{len}(a) \leq 10^5$
- $0 \leq a_i \leq 10^4$
- $1 \\leq x \\leq 10^4$
- $1 \\leq \\text{len}(a) \\leq 10^5$
- $0 \\leq a_i \\leq 10^4$
"""

solution = """
Expand Down
4 changes: 2 additions & 2 deletions tasks/easy/math/add_two_fractions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ description_ru = """
"""

limits = """
- $-1000 \leq a, c \leq 1000$
- $1 \leq b, d \leq 1000$
- $-1000 \\leq a, c \\leq 1000$
- $1 \\leq b, d \\leq 1000$
"""

solution = """
Expand Down
4 changes: 2 additions & 2 deletions tasks/easy/strings/five_letter_palindromes.toml
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,9 @@ comment = "Numbers should be ignored"
expected = []

[[asserts]]
arguments = ["abcde1edcba"]
arguments = ["radar1civic"]
comment = "Numbers acting as word separators"
expected = ["abcde", "edcba"]
expected = ["civic", "radar"]

[[asserts]]
arguments = ["-radar- *civic* 'kayak'"]
Expand Down
4 changes: 2 additions & 2 deletions tasks/hard/algo/knight_phone_dialer.toml
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ expected = 4
[[asserts]]
arguments = ["0618349270"]
comment = "Circular path around the keypad"
expected = 9
expected = 10

[[asserts]]
arguments = ["55555"]
Expand Down Expand Up @@ -226,7 +226,7 @@ expected = 2
[[asserts]]
arguments = ["004466"]
comment = "Moves mixed with repeats"
expected = 2
expected = 3

[[asserts]]
arguments = ["73"]
Expand Down
6 changes: 3 additions & 3 deletions tasks/hard/bitmasks/min_team_combinations.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ description_ru = """
"""

limits = """
- $1 \leq \text{len}(\text{people}) \leq 15$
- $0 \leq \text{people}[i] \leq 65535$
- $1 \leq \text{target\_skills} \leq 65535$
- $1 \\leq \\text{len}(\\text{people}) \\leq 15$
- $0 \\leq \\text{people}[i] \\leq 65535$
- $1 \\leq \\text{target\\_skills} \\leq 65535$
"""

solution = """
Expand Down
60 changes: 30 additions & 30 deletions tasks/hard/graphs/is_bipartite_graph.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ description_ru = """
"""

limits = """
- $1 \leq \text{len}(\text{graph}) \leq 100$
- $0 \leq \text{graph}[i][j] < \text{len}(\text{graph})$
- $i \neq \text{graph}[i][j]$
- $1 \\leq \\text{len}(\\text{graph}) \\leq 100$
- $0 \\leq \\text{graph}[i][j] < \\text{len}(\\text{graph})$
- $i \\neq \\text{graph}[i][j]$
"""

solution = """
Expand Down Expand Up @@ -73,136 +73,136 @@ comment = "Two disconnected nodes"
expected = true

[[asserts]]
arguments = [[[[1], [0]]]]
arguments = [[[1], [0]]]
comment = "Two connected nodes"
expected = true

[[asserts]]
arguments = [[[[1, 2], [0, 2], [0, 1]]]]
arguments = [[[1, 2], [0, 2], [0, 1]]]
comment = "Triangle (Not bipartite)"
expected = false

[[asserts]]
arguments = [[[[1, 3], [0, 2], [1, 3], [0, 2]]]]
arguments = [[[1, 3], [0, 2], [1, 3], [0, 2]]]
comment = "Cycle of 4"
expected = true

[[asserts]]
arguments = [[[[1, 2, 3], [0, 2], [0, 1, 3], [0, 2]]]]
arguments = [[[1, 2, 3], [0, 2], [0, 1, 3], [0, 2]]]
comment = "Cycle of 4 with a chord (contains triangle)"
expected = false

[[asserts]]
arguments = [[[[1], [0, 2], [1]]]]
arguments = [[[1], [0, 2], [1]]]
comment = "Path of 3"
expected = true

[[asserts]]
arguments = [[[[1], [0, 2], [1, 3], [2]]]]
arguments = [[[1], [0, 2], [1, 3], [2]]]
comment = "Path of 4"
expected = true

[[asserts]]
arguments = [[[[1, 3], [0, 2], [1, 3], [0, 2], []]]]
arguments = [[[1, 3], [0, 2], [1, 3], [0, 2], []]]
comment = "Cycle of 4 + isolated node"
expected = true

[[asserts]]
arguments = [[[[1, 4], [0, 2], [1, 3], [2, 4], [0, 3]]]]
arguments = [[[1, 4], [0, 2], [1, 3], [2, 4], [0, 3]]]
comment = "Cycle of 5 (Not bipartite)"
expected = false

[[asserts]]
arguments = [[[[1, 5], [0, 2], [1, 3], [2, 4], [3, 5], [0, 4]]]]
arguments = [[[1, 5], [0, 2], [1, 3], [2, 4], [3, 5], [0, 4]]]
comment = "Cycle of 6"
expected = true

[[asserts]]
arguments = [[[[1, 2, 3], [0], [0], [0]]]]
arguments = [[[1, 2, 3], [0], [0], [0]]]
comment = "Star graph with 4 nodes"
expected = true

[[asserts]]
arguments = [[[[1, 2, 3, 4], [0], [0], [0], [0]]]]
arguments = [[[1, 2, 3, 4], [0], [0], [0], [0]]]
comment = "Star graph with 5 nodes"
expected = true

[[asserts]]
arguments = [[[[1, 2], [0, 3], [0, 3], [1, 2]]]]
arguments = [[[1, 2], [0, 3], [0, 3], [1, 2]]]
comment = "Bipartite graph with overlapping edges"
expected = true

[[asserts]]
arguments = [[[[3, 4, 5], [3, 4, 5], [3, 4, 5], [0, 1, 2], [0, 1, 2], [0, 1, 2]]]]
arguments = [[[3, 4, 5], [3, 4, 5], [3, 4, 5], [0, 1, 2], [0, 1, 2], [0, 1, 2]]]
comment = "Complete bipartite graph K_3,3"
expected = true

[[asserts]]
arguments = [[[[1, 2, 3, 4], [0, 2, 3, 4], [0, 1, 3, 4], [0, 1, 2, 4], [0, 1, 2, 3]]]]
arguments = [[[1, 2, 3, 4], [0, 2, 3, 4], [0, 1, 3, 4], [0, 1, 2, 4], [0, 1, 2, 3]]]
comment = "Complete graph K_5"
expected = false

[[asserts]]
arguments = [[[[1], [0, 2], [1, 3], [2, 4], [3, 5], [4, 6], [5, 7], [6]]]]
arguments = [[[1], [0, 2], [1, 3], [2, 4], [3, 5], [4, 6], [5, 7], [6]]]
comment = "Path of 8"
expected = true

[[asserts]]
arguments = [[[[1], [0, 2], [1, 3], [2, 4], [3, 5], [4, 6], [5, 7], [6, 0]]]]
arguments = [[[1], [0, 2], [1, 3], [2, 4], [3, 5], [4, 6], [5, 7], [6, 0]]]
comment = "Cycle of 8"
expected = true

[[asserts]]
arguments = [[[[1, 2], [0, 2], [0, 1, 3, 4], [2, 4], [2, 3]]]]
arguments = [[[1, 2], [0, 2], [0, 1, 3, 4], [2, 4], [2, 3]]]
comment = "Two triangles joined at an edge"
expected = false

[[asserts]]
arguments = [[[[ ], [ ], [ ], [ ]]]]
arguments = [[[ ], [ ], [ ], [ ]]]
comment = "Four isolated nodes"
expected = true

[[asserts]]
arguments = [[[[1], [0], [3], [2]]]]
arguments = [[[1], [0], [3], [2]]]
comment = "Two disjoint edges"
expected = true

[[asserts]]
arguments = [[[[1], [0, 2], [1], [4, 5], [3, 5], [3, 4]]]]
arguments = [[[1], [0, 2], [1], [4, 5], [3, 5], [3, 4]]]
comment = "Path of 3 + disconnected triangle"
expected = false

[[asserts]]
arguments = [[[[1, 2, 3], [0, 2], [0, 1], [0]]]]
arguments = [[[1, 2, 3], [0, 2], [0, 1], [0]]]
comment = "Triangle with an attached node"
expected = false

[[asserts]]
arguments = [[[[3], [2], [1], [0]]]]
arguments = [[[3], [2], [1], [0]]]
comment = "Two disjoint edges crossing over indices"
expected = true

[[asserts]]
arguments = [[[[1, 2], [0], [0]]]]
arguments = [[[1, 2], [0], [0]]]
comment = "V shape"
expected = true

[[asserts]]
arguments = [[[[1], [0], [3], [2], [5], [4]]]]
arguments = [[[1], [0], [3], [2], [5], [4]]]
comment = "Three disjoint edges"
expected = true

[[asserts]]
arguments = [[[[1], [0, 2], [1, 3], [2, 4], [3, 5], [4, 6], [5, 0]]]]
arguments = [[[1], [0, 2], [1, 3], [2, 4], [3, 5], [4, 6], [5, 0]]]
comment = "Cycle of 7"
expected = false

[[asserts]]
arguments = [[[[2, 3], [3, 4], [0], [0, 1], [1]]]]
arguments = [[[2, 3], [3, 4], [0], [0, 1], [1]]]
comment = "Path of length 5"
expected = true

[[asserts]]
arguments = [[[[1], [0], [3, 5], [2, 4], [3, 5], [2, 4]]]]
arguments = [[[1], [0], [3, 5], [2, 4], [3, 5], [2, 4]]]
comment = "Two separate bipartite components"
expected = true
6 changes: 3 additions & 3 deletions tasks/hard/graphs/minimum_tree_cover.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ description_ru = """
"""

limits = """
- $1 \leq n \leq 10^5$
- $\text{len}(\text{edges}) = n - 1$
- $0 \leq \text{edges}[i][0], \text{edges}[i][1] < n$
- $1 \\leq n \\leq 10^5$
- $\\text{len}(\\text{edges}) = n - 1$
- $0 \\leq \\text{edges}[i][0], \\text{edges}[i][1] < n$
"""

solution = """
Expand Down
8 changes: 4 additions & 4 deletions tasks/medium/graphs/lowest_common_ancestor.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ description_ru = """
"""

limits = """
- $1 \leq \text{len}(\text{parent}) \leq 1000$
- $-1 \leq \text{parent}[i] < \text{len}(\text{parent})$
- $0 \leq u < \text{len}(\text{parent})$
- $0 \leq v < \text{len}(\text{parent})$
- $1 \\leq \\text{len}(\\text{parent}) \\leq 1000$
- $-1 \\leq \\text{parent}[i] < \\text{len}(\\text{parent})$
- $0 \\leq u < \\text{len}(\\text{parent})$
- $0 \\leq v < \\text{len}(\\text{parent})$
"""

solution = """
Expand Down
Loading
Loading