algorithms

Algorithm implementations
git clone git://git.laack.co/algorithms.git
Log | Files | Refs | README

problem.txt (693B)


      1 Time limit per test: 2 seconds
      2 Memory limit per test: 256 megabytes
      3 
      4 There are buildings in front of you with heights [a_0,a_1,...,a_{n-1}], where a_i is an integer. Assume each building has a depth of 100 units, there is a 10 unit gap between each of them, they are all directly in front of you, and the ground is flat.
      5 
      6 The first building is 100 units in front of you, and your eyes are 6 units above ground level. How many buildings are visible?
      7 
      8 Constraints:
      9 
     10 - 10 <= a_i <= 10^6
     11 - 1 <= n <= 2*10^5
     12 
     13 Inputs:
     14 
     15 - first line: n
     16 - second line: the n integers of a
     17 
     18 Examples:
     19 
     20 Input 1:
     21 
     22 6
     23 10 47 500 1000 2783 4616
     24 
     25 Output 1:
     26 
     27 6
     28 
     29 Input 2:
     30 
     31 8
     32 100 187 100 1000 1250 10000 1238 47100
     33 
     34 Output 2:
     35 
     36 4