nickel2halide

Radio

Sep 23rd, 2012
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1. Problem 1: Radio Towers
  2. =======================
  3.  
  4. Bessy is placing two radio towers in the mountain range near Farmer
  5. John's farms. In order to get the best transmission, the radio towers
  6. need to be within certain distances horizontally and vertically.
  7.  
  8. Bessy has measured out the height of the mountain range at 1-meter intervals.
  9. She has N measurements (1 <= N <= 10^5). She needs the horizontal distance
  10. between towers to be less than or equal to W (1 <= W < N) and the vertical
  11. distance to be less than or equal to H (1 <= H <= 10^5).
  12.  
  13. The horizontal distance between a tower at position i and a tower at position
  14. j is |i - j|. The vertical distance is |h_i - h_j|.
  15.  
  16. Find the number of ways to place the two _indistinguishable_ towers while
  17. staying within the specified horizontal and vertical distances. Since this
  18. number could be very large, output the answer modulo 1000007.
  19.  
  20. In test cases worth 50% of the points, h_i will be nondecreasing.
  21.  
  22. PROBLEM NAME: radio
  23.  
  24. INPUT
  25. -----
  26. * Line 1: The number of heights, N, the maximum width, W, and maximum
  27. height, H.
  28. * Line 2..1+N: Line i+1 contains h_i (1 <= h_i <= 10^5), height of peak i.
  29.  
  30. SAMPLE INPUT (file radio.in)
  31. ----------------------------
  32. 5 2 2
  33. 1
  34. 3
  35. 4
  36. 5
  37. 8
  38.  
  39. OUTPUT
  40. ------
  41. * Line 1: The number of valid ways to position the towers.
  42.  
  43. SAMPLE OUTPUT (file radio.out)
  44. ------------------------------
  45. 5
Advertisement
Add Comment
Please, Sign In to add comment