|
|||
Bricks
You are given a sequence of white ( Of course, one can always “partition” the sequence into one single block (which is not very interesting). We want, however, to have as many blocks as possible. Consider, for example, the following sequences and their partitions:
Note that both of these partitions are optimal with respect to the number of blocks. Input SpecificationThe first line of the input contains the number of test cases T. The descriptions of the test cases follow:
Each test case starts with a line containing an integer n
(1 ≤ n ≤ 105), which is the length of the
description of a sequence. Each of the following n lines consists of an integer
k (1 ≤ k ≤ 109) and one of the
characters Output SpecificationFor each test case, output a single line containing the largest possible number of blocks. Sample Input
Output for Sample Input
Original Problem |
|||
University of Debrecen; Faculty of Informatics; v. 09/30/2024 |