#K36492. Tallest Lookout Tower
Tallest Lookout Tower
Tallest Lookout Tower
You are given n blocks, each described by three integers: id, length, and weight capacity. Blocks that have the same length can be stacked on top of each other to form a lookout tower.
The objective is to build the tallest tower possible by stacking blocks with identical lengths. In other words, you need to find the maximum number of blocks among all groups of blocks that share the same length. Formally, if there are groups of blocks with counts \(c_1, c_2, \ldots, c_k\), the answer is:
[ \max_{1 \le i \le k} c_i ]
Note that you are to read the input from stdin
and print your output to stdout
.
inputFormat
The input is given via standard input (stdin
) in the following format:
n id1 length1 weightCapacity1 id2 length2 weightCapacity2 ... idn lengthn weightCapacityn
Here, n
(an integer) is the number of blocks. Then follow n
lines each containing three integers separated by spaces.
outputFormat
Output a single integer which is the height of the tallest tower (i.e. the maximum number of blocks with the same length) that can be built.
## sample3
1 2 100
2 2 200
3 3 150
2