codeforces-scrape

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

37A.md (1018B)


      1 Source: https://codeforces.com/problemset/problem/37/A
      2 
      3 A. Towers
      4 
      5 time limit per test
      6 
      7 2 seconds
      8 
      9 memory limit per test
     10 
     11 256 megabytes
     12 
     13 input
     14 
     15 stdin
     16 
     17 output
     18 
     19 stdout
     20 
     21 Little Vasya has received a young builder’s kit. The kit consists of several wooden bars, the lengths of all of them are known. The bars can be put one on the top of the other if their lengths are the same.
     22 
     23 Vasya wants to construct the minimal number of towers from the bars. Help Vasya to use the bars in the best way possible.
     24 
     25 Input
     26 
     27 The first line contains an integer *N* (1 ≤ *N* ≤ 1000) — the number of bars at Vasya’s disposal. The second line contains *N* space-separated integers *l**i* — the lengths of the bars. All the lengths are natural numbers not exceeding 1000.
     28 
     29 Output
     30 
     31 In one line output two numbers — the height of the largest tower and their total number. Remember that Vasya should use all the bars.
     32 
     33 Examples
     34 
     35 Input
     36 
     37 ```
     38 3  
     39 1 2 3
     40 ```
     41 
     42 Output
     43 
     44 ```
     45 1 3
     46 ```
     47 
     48 Input
     49 
     50 ```
     51 4  
     52 6 5 6 7
     53 ```
     54 
     55 Output
     56 
     57 ```
     58 2 3
     59 ```