Codeforces Round 698 A 题解
Nezzar and Colorful Balls
Nezzar has
Nezzar wants to color the balls using the minimum number of colors, such that the following holds.
- For any color, numbers on balls will form a strictly increasing sequence if he keeps balls with this chosen color and discards all other balls.
Note that a sequence with the length at most
Please help Nezzar determine the minimum number of colors.
Input
The first line contains a single integer
The first line of each test case contains a single integer
The second line of each test case contains
Output
For each test case, output the minimum number of colors Nezzar can use.
Example
input
output
Note
Let's match each color with some numbers. Then:
In the first test case, one optimal color assignment is
In the second test case, one optimal color assignment is
题目大意
有
分析
这是典型的贪心算法,使用最少的颜色,一种很方便的想法是使编号相同的球满足
AC代码
1 |
|
Codeforces Round 698 A 题解