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 | trifiasco | Cpp14 | 0.00s |

04 | imAnik | Cpp14 | 0.00s |

05 | habib_rahman | Cpp14 | 0.00s |

06 | Pure_Protea | Cpp14 | 0.00s |

07 | 7Mahfuz | Cpp14 | 0.00s |

08 | fearless_hasan | Cpp14 | 0.00s |

09 | MAD_coder | Cpp14 | 0.00s |

10 | susmoys | Cpp14 | 0.00s |

11 | motaleb_ICT | Cpp14 | 0.00s |

12 | lazyfahim | Cpp14 | 0.00s |

13 | Himon_PUST | Cpp14 | 0.00s |

14 | Not_Found0001 | Cpp14 | 0.00s |

15 | sazal_dev | Cpp14 | 0.00s |

16 | emrul | Cpp14 | 0.00s |

17 | ssavi | Cpp14 | 0.00s |

18 | iamsadee | Cpp14 | 0.00s |

19 | _GhOstMan_ | Cpp14 | 0.00s |

20 | feodorv | Cpp14 | 0.00s |

21 | _dipu | Cpp14 | 0.00s |

22 | Nabila_ | Cpp14 | 0.00s |

23 | mohibur | Cpp | 0.00s |

24 | CSE1604084_Mahir | C | 0.00s |

25 | Saimum_140128 | Cpp14 | 0.00s |

26 | neel71 | Cpp | 0.00s |

27 | muntasir10mu | Cpp | 0.01s |

28 | Ehsanul_Fahad | Cpp | 0.01s |

29 | tariqiitju | Cpp | 0.01s |

30 | milon019 | Cpp | 0.01s |

31 | Bruteforcekid | Cpp | 0.01s |

32 | Morass | Cpp14 | 0.01s |

33 | Nasif | Cpp14 | 0.01s |

34 | onucsecu | Cpp14 | 0.01s |

35 | Sleep_Mode | Cpp14 | 0.01s |

36 | Jobayer__ | Cpp14 | 0.01s |

37 | Arpan_cse_2k14 | Cpp14 | 0.01s |

38 | jayed_al_hasan | Cpp14 | 0.01s |

39 | rayhan50001 | Cpp14 | 0.01s |

40 | MRITuhin | Cpp14 | 0.01s |

41 | maxhasan | Cpp14 | 0.01s |

42 | saiful130104 | Cpp14 | 0.01s |

43 | AlaminJust | Cpp14 | 0.01s |

44 | subhashis_cse | Cpp14 | 0.01s |

45 | Nazmul0092 | Cpp14 | 0.01s |

46 | tlcakash | Cpp14 | 0.01s |

47 | Ishraq_Nibir | Cpp14 | 0.01s |

48 | gazi93 | Cpp14 | 0.01s |

49 | akash_23 | Cpp14 | 0.01s |

50 | prodipdatta7 | 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. :(