1809
Educational Codeforces Round 145 (Rated for Div. 2)
TODO: B+
A_Garland
1 2 3 4 5 6 7 8 9 10 11 12 13 |
|
B_Points_on_Plane
1 2 3 4 5 6 7 8 9 10 |
|
C_Sum_on_Subarrays
Explanation
You are given two numbers, 'n' and 'k'. Your task is to create an array of length 'n' with the sum of the elements equal to 'k'. The array can contain any integer numbers, but there is a condition - the sum of any contiguous subarray should be non-positive (less than or equal to 0).
You need to find an array that satisfies the given condition.
Example:
Input:
n = 3, k = 5
Output:
[-1, 2, -6]
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
|
D_Binary_String_Sorting
Explanation
The idea of this solution is to iterate through the binary string, tracking the counts of zeros and ones. It evaluates the cost of sorting the string by considering various operations, such as swapping consecutive elements or removing elements.
By comparing the costs of these different operations, the solution determines the minimum number of coins required to sort the string in non-decreasing order.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
|