Beginner Beginners Problems > Ad-hoc

**Burj Khalifa** in Dubai is the Tallest Building in the World. Lets consider there are **N** floors and every floor is occupied with a person. Every person has their own height. The distance between two consecutive floor is 1 meter. Your task is to calculate how many **taller** (strictly greater in height) people you will encounter if you are a person at **Xth** floor and You begin to walk **K** distance to upper side from **X** position as well as **K** distance to the lower side from **X** position. If sometimes you reach at position 1 or position N, you can still walk but you **will not find any people** there after. You always make two journey from position X, one K distance upwards and another K distance downwards. Input: ------ Input starts with an integer **N (3 ≤ N ≤ 1000)** denoting total floors. The next line will contain N integers separated by spaces, denoting the height of person reside on the floor at position from 1 to N. The next line will contain a two integers **X** and **K** denoting respectively your position and walking distance. X will be any integer number between 1 to N and K will be a positive integer greater than 0 and upto **1000000000000**. Output: ------- For each input, output a single line denoting total number of taller people you will encounter. Sample Input ------------ 5 1 2 4 3 5 3 5 Sample Output ------------- 1

Bishal Gautam

Language |
Time Limit (seconds) |

C | 0.50 |

C++ | 0.50 |

C++14 | 0.50 |

C# | 1.00 |

Go | 1.00 |

Java | 1.00 |

JavaScript | 1.00 |

Objective-C | 1.00 |

Perl | 1.00 |

PHP | 1.00 |

Python | 1.00 |

Python3 | 1.00 |

Ruby | 1.00 |

VB.Net | 1.00 |

Solve/Submission

# | User | Language | Timing |
---|---|---|---|

01 | Dreamy_Idler | Cpp14 | 0.00s |

02 | souravvv | Cpp14 | 0.00s |

03 | imAnik | Cpp14 | 0.00s |

04 | habib_rahman | Cpp14 | 0.00s |

05 | Pure_Protea | Cpp14 | 0.00s |

06 | 7Mahfuz | Cpp14 | 0.00s |

07 | fearless_hasan | Cpp14 | 0.00s |

08 | MAD_coder | Cpp14 | 0.00s |

09 | susmoys | Cpp14 | 0.00s |

10 | motaleb_ICT | Cpp14 | 0.00s |

11 | lazyfahim | Cpp14 | 0.00s |

12 | Himon_PUST | Cpp14 | 0.00s |

13 | Not_Found0001 | Cpp14 | 0.00s |

14 | sazal_dev | Cpp14 | 0.00s |

15 | emrul | Cpp14 | 0.00s |

16 | ssavi | Cpp14 | 0.00s |

17 | iamsadee | Cpp14 | 0.00s |

18 | _GhOstMan_ | Cpp14 | 0.00s |

19 | feodorv | Cpp14 | 0.00s |

20 | _dipu | Cpp14 | 0.00s |

21 | Nabila_ | Cpp14 | 0.00s |

22 | mohibur | Cpp | 0.00s |

23 | CSE1604084_Mahir | C | 0.00s |

24 | Saimum_140128 | Cpp14 | 0.00s |

25 | neel71 | Cpp | 0.00s |

26 | muntasir10mu | Cpp | 0.01s |

27 | Ehsanul_Fahad | Cpp | 0.01s |

28 | tariqiitju | Cpp | 0.01s |

29 | milon019 | Cpp | 0.01s |

30 | Bruteforcekid | Cpp | 0.01s |

31 | Morass | Cpp14 | 0.01s |

32 | Nasif | Cpp14 | 0.01s |

33 | onucsecu | Cpp14 | 0.01s |

34 | Sleep_Mode | Cpp14 | 0.01s |

35 | Jobayer__ | Cpp14 | 0.01s |

36 | Arpan_cse_2k14 | Cpp14 | 0.01s |

37 | jayed_al_hasan | Cpp14 | 0.01s |

38 | rayhan50001 | Cpp14 | 0.01s |

39 | MRITuhin | Cpp14 | 0.01s |

40 | maxhasan | Cpp14 | 0.01s |

41 | saiful130104 | Cpp14 | 0.01s |

42 | AlaminJust | Cpp14 | 0.01s |

43 | subhashis_cse | Cpp14 | 0.01s |

44 | Nazmul0092 | Cpp14 | 0.01s |

45 | tlcakash | Cpp14 | 0.01s |

46 | Ishraq_Nibir | Cpp14 | 0.01s |

47 | gazi93 | Cpp14 | 0.01s |

48 | akash_23 | Cpp14 | 0.01s |

49 | prodipdatta7 | Cpp14 | 0.01s |

50 | badhansen123 | Cpp14 | 0.01s |

Copyright © 2015-2016 Dev Skill.

Feedback
#### Your feedback is our precious!

## Thank you for providing feedback! Our developers will be happy :)

## Sorry there was a problem when submitting the feedback. Please try again. :(