F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Coin Piles

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 251    Accepted Submission(s): 97


Problem Description
We have some coins on the table. Each coin is characterized by its size. We want to arrange these coins into successive piles so that the following hold:

1. The size of the top coin in each pile is strictly greater than the size of all the other coins in the same pile.
2. The size of the top coin in each pile is strictly greater than the size of the top coin in the previous pile.
3. The number of coins in each pile is strictly greater than the number of coins in the previous pile.

You will be given the size of each coin. You are to calculate the maximal number of piles that we can organize according to the given rules. Each coin should be used in exactly one pile.
 

Input
There are multiple cases (no more than 100).

There is two lines for each case. The first line is a number n (1 <= n <= 50), indicating the number of coins. A line with n integers follows, giving the sizes of the coins.

Note that the maximal of the sizes will be unique, so it's always possible to form at least one pile.
 

Output
For each case, output the maximal number of piles that we can organize.
 

Sample Input
6 1 2 2 2 2 3 6 1 1 2 2 2 3 6 1 2 2 2 3 4
 

Sample Output
2 3 3
 

Author
hhanger@zju
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-11-22 18:54:06, Gzip enabled