codeforces-scrape

Codeforces scraped problems and editorials
git clone git://git.laack.co/codeforces-scrape.git
Log | Files | Refs | README

903C.md (1380B)


      1 Source: https://codeforces.com/problemset/problem/903/C
      2 
      3 C. Boxes Packing
      4 
      5 time limit per test
      6 
      7 1 second
      8 
      9 memory limit per test
     10 
     11 256 megabytes
     12 
     13 input
     14 
     15 standard input
     16 
     17 output
     18 
     19 standard output
     20 
     21 Mishka has got *n* empty boxes. For every *i* (1 ≤ *i* ≤ *n*), *i*-th box is a cube with side length *a**i*.
     22 
     23 Mishka can put a box *i* into another box *j* if the following conditions are met:
     24 
     25 * *i*-th box is not put into another box;
     26 * *j*-th box doesn't contain any other boxes;
     27 * box *i* is smaller than box *j* (*a**i* < *a**j*).
     28 
     29 Mishka can put boxes into each other an arbitrary number of times. He wants to minimize the number of visible boxes. A box is called visible iff it is not put into some another box.
     30 
     31 Help Mishka to determine the minimum possible number of visible boxes!
     32 
     33 Input
     34 
     35 The first line contains one integer *n* (1 ≤ *n* ≤ 5000) — the number of boxes Mishka has got.
     36 
     37 The second line contains *n* integers *a*1, *a*2, ..., *a**n* (1 ≤ *a**i* ≤ 109), where *a**i* is the side length of *i*-th box.
     38 
     39 Output
     40 
     41 Print the minimum possible number of visible boxes.
     42 
     43 Examples
     44 
     45 Input
     46 
     47 ```
     48 3  
     49 1 2 3
     50 ```
     51 
     52 Output
     53 
     54 ```
     55 1
     56 ```
     57 
     58 Input
     59 
     60 ```
     61 4  
     62 4 2 4 3
     63 ```
     64 
     65 Output
     66 
     67 ```
     68 2
     69 ```
     70 
     71 Note
     72 
     73 In the first example it is possible to put box 1 into box 2, and 2 into 3.
     74 
     75 In the second example Mishka can put box 2 into box 3, and box 4 into box 1.