prithivMLmods/Coder-Stat
Coder-Stat Dataset Overview The Coder-Stat dataset is a collection of programming-related data, including problem IDs, programming languages, original statuses, and source code snippets. This dataset is designed to assist in the analysis of coding patterns, error types, and performance metrics. Dataset Details Modalities Tabular: The dataset is structured in a tabular format. Text: Contains text data, including source code snippets.… See the full description on the dataset page: https://huggingface.co/datasets/prithivMLmods/Coder-Stat.
3139
1 2<script type="text/x-mathjax-config">3 MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});4</script>5<script type='text/javascript' src='http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML'></script>6</script>7 8<h2>Problem D:9Space Golf10</h2>11 12<p>13You surely have never heard of this new planet surface exploration scheme, as it is being carried out in a project with utmost secrecy. The scheme is expected to cut costs of conventional rovertype mobile explorers considerably, using projected-type equipment nicknamed "observation bullets".14</p>15 16<p>17 Bullets do not have any active mobile abilities of their own, which is the main reason of their cost-efficiency. Each of the bullets, after being shot out on a launcher given its initial velocity, makes a parabolic trajectory until it touches down. It bounces on the surface and makes another parabolic trajectory. This will be repeated virtually infinitely.18</p>19 20<p>21 We want each of the bullets to bounce precisely at the respective spot of interest on the planet surface, adjusting its initial velocity. A variety of sensors in the bullet can gather valuable data at this instant of bounce, and send them to the observation base. Although this may sound like a conventional target shooting practice, there are several issues that make the problem more difficult.22</p>23 24<ul>25 <li> There may be some obstacles between the launcher and the target spot. The obstacles stand upright and are very thin that we can ignore their widths. Once the bullet touches any of the obstacles, we cannot be sure of its trajectory thereafter. So we have to plan launches to avoid these obstacles.</li>26<li> Launching the bullet almost vertically in a speed high enough, we can easily make it hit the target without touching any of the obstacles, but giving a high initial speed is energyconsuming. Energy is extremely precious in space exploration, and the initial speed of the bullet should be minimized. Making the bullet bounce a number of times may make the bullet reach the target with lower initial speed.</li>27 <li> The bullet should bounce, however, no more than a given number of times. Although the body of the bullet is made strong enough, some of the sensors inside may not stand repetitive shocks. The allowed numbers of bounces vary on the type of the observation bullets.</li>28</ul>29 30<p>31 You are summoned engineering assistance to this project to author a smart program that tells the minimum required initial speed of the bullet to accomplish the mission.32</p>33 34<p>35Figure D.1 gives a sketch of a situation, roughly corresponding to the situation of the Sample36Input 4 given below.37</p>38 39<center>40<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_ICPCAsia2014_D1" width="600"><br>41<p>Figure D.1. A sample situation</p>42</center>43 44<p>45 You can assume the following.46</p>47 48<ul>49<li> The atmosphere of the planet is so thin that atmospheric resistance can be ignored.</li>50<li> The planet is large enough so that its surface can be approximated to be a completely flat plane.</li>51<li> The gravity acceleration can be approximated to be constant up to the highest points a bullet can reach.</li>52</ul>53 54<p>55 These mean that the bullets fly along a perfect parabolic trajectory.56</p>57 58<p>59 You can also assume the following.60</p>61 62<ul>63<li> The surface of the planet and the bullets are made so hard that bounces can be approximated as elastic collisions. In other words, loss of kinetic energy on bounces can be ignored. As we can also ignore the atmospheric resistance, the velocity of a bullet immediately after a bounce is equal to the velocity immediately after its launch.</li>64<li> The bullets are made compact enough to ignore their sizes.</li>65<li> The launcher is also built compact enough to ignore its height.</li>66</ul>67 68<p>69 You, a programming genius, may not be an expert in physics. Let us review basics of rigid-body dynamics.70</p>71 72<p>73We will describe here the velocity of the bullet $v$ with its horizontal and vertical components $v_x$ and $v_y$ (positive meaning upward). The initial velocity has the components $v_{ix}$ and $v_{iy}$, that is, immediately after the launch of the bullet, $v_x = v_{ix}$ and $v_y = v_{iy}$ hold. We denote the horizontal distance of the bullet from the launcher as $x$ and its altitude as $y$ at time $t$.74</p>75 76<ul>77 <li>78 The horizontal velocity component of the bullet is kept constant during its flight when atmospheric resistance is ignored. Thus the horizontal distance from the launcher is proportional to the time elapsed.79 80 \[81 x = v_{ix}t82\tag{1}83 \]84 </li>85 <li>86 The vertical velocity component $v_y$ is gradually decelerated by the gravity. With the gravity acceleration of $g$, the following differential equation holds during the flight.87 88 \[89 \frac{dv_y}{dt} = −g90 \tag{2}91\]92 93Solving this with the initial conditions of $v_y = v_{iy}$ and $y = 0$ when $t = 0$, we obtain the94 following.95 \[96 y = −\frac{1}{2} gt^2 + v_{iy}t97 \tag{3}98 \]99 \[100= −(\frac{1}{2}gt − v_{iy})t101 \tag{4}102 \]103 104 The equation (4) tells that the bullet reaches the ground again when $t = 2v_{iy}/g$. Thus, the distance of the point of the bounce from the launcher is $2v_{ix}v_{iy}/g$. In other words, to make the bullet fly the distance of $l$, the two components of the initial velocity should satisfy $2v_{ix}v_{iy} = lg$.105 </li>106 <li>107 Eliminating the parameter $t$ from the simultaneous equations above, we obtain the following equation that describes the parabolic trajectory of the bullet.108 \[109 y = −(\frac{g}{2v^2_{ix}})x^2 + (\frac{v_{iy}}{v_{ix}})x110 \tag{5}111 \]112 </li>113</ul>114 115<p>116For ease of computation, a special unit system is used in this project, according to which the gravity acceleration $g$ of the planet is exactly 1.0.117</p>118 119 120<h3>Input</h3>121 122<p>123 The input consists of a single test case with the following format.<br>124 <br>125$d$ $n$ $b$<br>126$p_1$ $h_1$<br>127$p_2$ $h_2$<br>128.<br>129.<br>130.<br>131 $p_n$ $h_n$<br>132 <br>133 134The first line contains three integers, $d$, $n$, and $b$. Here, $d$ is the distance from the launcher135 to the target spot ($1 \leq d \leq 10000$), $n$ is the number of obstacles ($1 \leq n \leq 10$), and $b$ is the maximum number of bounces allowed, not including the bounce at the target spot ($0 \leq b \leq 15$).136</p>137 138<p>139Each of the following $n$ lines has two integers. In the $k$-th line, $p_k$ is the position of the $k$-th obstacle, its distance from the launcher, and $h_k$ is its height from the ground level. You can assume that $0 < p_1$, $p_k < p_{k+1}$ for $k = 1, . . . , n − 1$, and $p_n < d$. You can also assume that140$1 \leq h_k \leq 10000$ for $k = 1, . . . , n$.141</p>142 143 144<h3>Output</h3>145 146<p>147 Output the smallest possible initial speed $v_i$ that makes the bullet reach the target. The initial speed $v_i$ of the bullet is defined as follows.148 149 \[150v_i = \sqrt{v_{ix}^2 + v_{iy}^2}151 \]152 153The output should not contain an error greater than 0.0001154</p>155 156 157<h3>Sample Input 1</h3>158 159<pre>100 1 016050 100</pre>161 162<h3>Sample Output 1</h3>163 164<pre>14.57738</pre>165 166<h3>Sample Input 2</h3>167 168<pre>10 1 01694 2</pre>170 171<h3>Sample Output 2</h3>172 173<pre>3.16228</pre>174 175<h3>Sample Input 3</h3>176 177<pre>100 4 317820 1017930 1018040 1018150 10</pre>182 183<h3>Sample Output 3</h3>184 185<pre>7.78175</pre>186 187<h3>Sample Input 4</h3>188 189<pre>343 3 219056 42191190 27192286 34</pre>193 194<h3>Sample Output 4</h3>195 196<pre>11.08710</pre>