Codeforces Round 923 (Div. 3)

Solutions are presented as using the least memory and the fastest execution time. It also takes the top 10 most recent solutions from each language. If you want to limit to a specific index, click the "Solved" button and go to that problem.

ContestId
Name
Phase
Frozen
Duration (Seconds)
Relative Time
Start Time
1927 Codeforces Round 923 (Div. 3) FINISHED False 8100 24592499 Feb. 6, 2024, 2:45 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 1703 ) G Paint Charges PROGRAMMING data structures dp greedy math

B'A horizontal grid strip of n cells is given. In the i -th cell, there is a paint charge of size a_i . This charge can be: Note that a charge can be used no more than once (that is, it cannot be used simultaneously to the left and to the right). It is allowed for a cell to be painted more than once. What is the minimum number of times a charge needs to be used to paint all the cells of the strip? The first line of the input contains an integer t ( 1 <= t <= 100 ) -- the number of test cases in the test. This is followed by descriptions of t test cases. Each test case is specified by two lines. The first one contains an integer n ( 1 <= n <= 100 ) -- the number of cells in the strip. The second line contains n positive integers a_1, a_2, ... , a_n ( 1 <= a_i <= n ), where a_i is the size of the paint charge in the i -th cell from the left of the strip. It is guaranteed that the sum of the values of n in the test does not exceed 1000 . For each test case, output the minimum number of times the charges need to be used to paint all the cells of the strip. In the third test case of the example, it is sufficient to use the charge from the 1 -st cell to the right, then it will cover both cells 1 and 2 . In the ninth test case of the example, you need to: In the eleventh test case of the example, you need to: '...

Tutorials

125597

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
245259654 Gassa G Feb. 6, 2024, 8:22 p.m. OK D TESTS 37 202 24883200

remove filters

Back to search problems