2015
05-23

Slalom

In spite of the scarcity of snowfall in Syria, interest in winter sports is growing in the country, especially with regard to skiing. Many people spend several weekends or even full weeks improving their skills in the mountains.
In this problem we deal with only one of the multiple alpine skiing disciplines: slalom. A course is constructed by laying out a series of gates, which are formed by two poles. The skier must pass between the two poles forming each gate. The winner is the skier who takes the least time to complete the course while not missing any of the gates.
You have recently started to learn to ski, but you have already set yourself the goal of taking part in the Winter Olympic Games of 2022, for which Syria will presumably present a candidature. As part of the theoretical training, you need to write a program that calculates, given a starting point and a series of gates, the minimum-length path starting from the point given and passing through each gate until you reach the last one, which is the finish line. You may assume that the gates are horizontal and are ordered from highest to lowest, so that you need to pass through them in order. You consider yourself an accomplished skier, so you can make any series of turns, no matter how difficult, and your only concern is minimizing the total length of the path.

The first line of each case gives the number of gates n (1 ≤ n ≤ 1 000). The next line contains two floating point numbers, the Cartesian coordinates x and y of the starting position, in that order. Next come n lines with three floating point numbers each, y x1 x2, meaning that the next gate is a horizontal line from (x1,y) to (x2,y). You can safely assume that x1 <x2. The values of y are strictly decreasing and are always smaller than that of the starting position.The last gate represents the finish line. All coordinates are between -500 000 and 500 000,inclusive. A value of 0 for n means the end of the input. A blank line follows each case.

The first line of each case gives the number of gates n (1 ≤ n ≤ 1 000). The next line contains two floating point numbers, the Cartesian coordinates x and y of the starting position, in that order. Next come n lines with three floating point numbers each, y x1 x2, meaning that the next gate is a horizontal line from (x1,y) to (x2,y). You can safely assume that x1 <x2. The values of y are strictly decreasing and are always smaller than that of the starting position.The last gate represents the finish line. All coordinates are between -500 000 and 500 000,inclusive. A value of 0 for n means the end of the input. A blank line follows each case.

2
0 2
1 1 2
0 0.5 3

3
0 4
3 1 2
2 -1 0
1 1 2

0

2.41421356237
4.24264068712

1. Pingback: Crack Sealant

2. Pingback: Portugal

3. Pingback: 11 inch dildo

4. Pingback: تعمیر یخچال در محل

5. Pingback: strapless dildo

6. Pingback: how often should couples have sex

7. Pingback: ترمیم مو، کاشت مو ، مو طبیعی

8. Pingback: ترمیم مو و کاشت مو

9. Pingback: فروش دوربین های مدار بسته مخفی

10. Pingback: نصب و اجرای دوربین مداربسته

11. Pingback: sex toys for couples

12. Pingback: طراحی سایت

13. Pingback: فروش دوربین های مدار بسته مخفی

14. Pingback: نصب و اجرای دوربین مداربسته

15. Pingback: ترمیم مو و کاشت مو

16. Pingback: نصب دوربین های مدار بسته

17. Pingback: glass candy juicer dildo

18. Pingback: magic wand massager

19. Pingback: طراحی وب سایت

20. Pingback: Vneck middleweight gi

21. Pingback: sex toys

22. Pingback: نصب دوربین های مدار بسته

23. Pingback: discount sex toy

24. Pingback: sticky carpet protector

25. Pingback: Magnet paper

26. Pingback: ساخت اپل ایدی

27. Pingback: stimulating gel

28. Pingback: کفسابی

29. Pingback: وکیل پایه یک

30. Pingback: toys for couples

31. Pingback: strap sex toys

32. Pingback: strap on dildo

33. Pingback: best adult sex games

36. Pingback: cock masturbator

37. Pingback: G Vibrator

38. Pingback: tokaido white martial arts uniform

40. Pingback: driving tips

41. Pingback: Mikemaid7447

43. Pingback: Cock ring

44. Pingback: Nipple Toys

45. Pingback: Anal toys

46. Pingback: مقالات دوربین مدار بسته

49. Pingback: Butt plugs

50. Pingback: Dildo

51. Pingback: accounting

52. Pingback: the rabbit vibrator

53. Pingback: آموزش نصب دوربین مدار بسته

54. Pingback: personal lubricant reviews

55. Pingback: triple stimulation

56. Pingback: couple watching porn

57. Pingback: XXXL sizes martial arts uniforms

58. Pingback: php online store

59. Pingback: manufactured

60. Pingback: online auction

61. Pingback: resolume serial keys

62. Pingback: Greenwood

64. Pingback: Sage Gemini

65. Pingback: Dizzee Rascal

66. Pingback: bar display liquor bottles

67. Pingback: Tam Coc Day Tour

68. Pingback: port

69. Pingback: revize zdvihacich zarizeni

70. Pingback: 50 Cent

72. Pingback: http://pouyabin.com

73. Pingback: urgent care los angeles

74. Pingback: foreplay for him

75. Pingback: ترمیم مو بیماران

76. Pingback: sex lotion

79. Pingback: rechargeable bullet vibrator

80. Pingback: new things to try in bed for couples

81. Pingback: real feel vibrator

82. Pingback: vibrating bullet

83. Pingback: اسکی فضایی

84. Pingback: خرید اپل ایدی تحویل انی

85. Pingback: male p spot toys

86. Pingback: اجاره ويلا در لواسان

88. Pingback: real skin feel dildo

90. Pingback: خرید اپل ایدی تحویل انی

91. Pingback: worktop protection

92. Pingback: magnets

93. Pingback: مشخصات تردمیل خانگی

94. Pingback: tamper evident tape

95. Pingback: polythene manufacturer

96. Pingback: best male masturbator

97. Pingback: Sex Toys

99. Pingback: nude

102. Pingback: php web programming

103. Pingback: خرید اپل ایدی

104. Pingback: before oral sex

105. Pingback: colorful dildos

106. Pingback: bullet vibrator review

107. Pingback: what is the best

108. Pingback: biotech stocks

110. Pingback: vpn خرید ارزان

111. Pingback: Punching bag with scoring zones

112. Pingback: realistic dong

113. Pingback: adam and eve sex toy

114. Pingback: sex toys for couples

115. Pingback: clitoral stimulation

116. Pingback: ترمیم مو

117. Pingback: Minihaziko

118. Pingback: tratamento de Alcoolismo

120. Pingback: Masturbator Review

121. Pingback: anal trainer toy

122. Pingback: adam and eve sex toys

123. Pingback: Precision

124. Pingback: relative strength

125. Pingback: How to Use Ben Wa Balls

126. Pingback: Best Male Stroker

127. Pingback: femalelibidoreviews

128. Pingback: lifelike dildo

129. Pingback: Vibrator G Spot

130. Pingback: g spot

131. Pingback: male masterbator

132. Pingback: glass toys

133. Pingback: vibe

134. Pingback: wireless massager

135. Pingback: anal vibrator review

137. Pingback: sauerkraut juice

138. Pingback: Service

143. Pingback: anal butt plug

144. Pingback: sex dildo

145. Pingback: babydoll lingerie

148. Pingback: make penis harder

149. Pingback: Vibrator Kit

150. Pingback: Vibrating Cock Ring

151. Pingback: A\u0026E Beginner's Power Pump

152. Pingback: best g spot massager

153. Pingback: Waterproof Vibrator

154. Pingback: penis sleeve

155. Pingback: jbeatz

156. Pingback: sex toys

157. Pingback: vibrator pink

158. Pingback: magic wand

159. Pingback: g-spot massager

160. Pingback: anal sex vibrators

162. Pingback: sex toys

163. Pingback: Fuel injector

164. Pingback: دوربین مداربسته

166. Pingback: robert

168. Pingback: pc games for windows xp

169. Pingback: longer sex

170. Pingback: Sripatum university

171. Pingback: best sex gel

173. Pingback: Personal Lubricant

174. Pingback: Bondage Toys

175. Pingback: Masturbator

176. Pingback: Dolphin Dildo

177. Pingback: Best Female Arousal Products

178. Pingback: Rabbit Vibrator

179. Pingback: Adam and Eve Butterfly Kiss

180. Pingback: Magic Wand Vibrator

181. Pingback: what is the best luxury sex toys

182. Pingback: rabbit vibrator