codeforces-scrape

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

372A.md (1169B)


      1 Source: https://codeforces.com/problemset/problem/372/A
      2 
      3 A. Counting Kangaroos is Fun
      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 stdin
     16 
     17 output
     18 
     19 stdout
     20 
     21 There are *n* kangaroos with pockets. Each kangaroo has a size (integer number). A kangaroo can go into another kangaroo's pocket if and only if the size of kangaroo who hold the kangaroo is at least twice as large as the size of kangaroo who is held.
     22 
     23 Each kangaroo can hold at most one kangaroo, and the kangaroo who is held by another kangaroo cannot hold any kangaroos.
     24 
     25 The kangaroo who is held by another kangaroo cannot be visible from outside. Please, find a plan of holding kangaroos with the minimal number of kangaroos who is visible.
     26 
     27 Input
     28 
     29 The first line contains a single integer — *n* (1 ≤ *n* ≤ 5·105). Each of the next *n* lines contains an integer *s**i* — the size of the *i*-th kangaroo (1 ≤ *s**i* ≤ 105).
     30 
     31 Output
     32 
     33 Output a single integer — the optimal number of visible kangaroos.
     34 
     35 Examples
     36 
     37 Input
     38 
     39 ```
     40 8  
     41 2  
     42 5  
     43 7  
     44 6  
     45 9  
     46 8  
     47 4  
     48 2
     49 ```
     50 
     51 Output
     52 
     53 ```
     54 5
     55 ```
     56 
     57 Input
     58 
     59 ```
     60 8  
     61 9  
     62 1  
     63 6  
     64 2  
     65 6  
     66 5  
     67 8  
     68 3
     69 ```
     70 
     71 Output
     72 
     73 ```
     74 5
     75 ```