Team Ai
Datasetpublic

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.

sourceHugging Faceapache-2.0updated 2y agoView on Hugging Face
3likes139downloads
p00903.html105 linesDownload Raw Back to problem_descriptions
1 2<H1><font color="#000">Problem J:</font>Round Trip</H1>3 4<p>5Jim is planning to visit one of his best friends in a town in the mountain area. First, he leaves his hometown and goes to the destination town. This is called the go phase. Then, he comes back to his hometown. This is called the return phase. You are expected to write a program to find the minimum total cost of this trip, which is the sum of the costs of the go phase and the return phase.6</p>7 8<p>9There is a network of towns including these two towns. Every road in this network is one-way, i.e., can only be used towards the specified direction. Each road requires a certain cost to travel.10</p>11 12<p>13In addition to the cost of roads, it is necessary to pay a specified fee to go through each town on the way. However, since this is the visa fee for the town, it is not necessary to pay the fee on the second or later visit to the same town.14</p>15 16<p>17The altitude (height) of each town is given. On the go phase, the use of descending roads is inhibited. That is, when going from town <i>a</i> to <i>b</i>, the altitude of <i>a</i> should not be greater than that of <i>b</i>. On the return phase, the use of ascending roads is inhibited in a similar manner. If the altitudes of <i>a</i> and <i>b</i> are equal, the road from <i>a</i> to <i>b</i> can be used on both phases.18</p>19 20<H2>Input</H2>21 22<p>23The input consists of multiple datasets, each in the following format.24</p>25 26<p>27<i>n m<br>28d<sub>2</sub> e<sub>2</sub><br>29d<sub>3</sub> e<sub>3</sub><br>30.<br>31.<br>32.<br>33d<sub>n-1</sub>	e<sub>n-1</sub><br>34a<sub>1</sub> b<sub>1</sub> c<sub>1</sub><br>35a<sub>2</sub> b<sub>2</sub> c<sub>2</sub><br>36.<br>37.<br>38.<br> 39a<sub>m</sub> b<sub>m</sub> c<sub>m</sub>40</i>41</p>42 43<p>44Every input item in a dataset is a non-negative integer. Input items in a line are separated by a space.45</p>46 47<p>48<i>n</i> is the number of towns in the network. <i>m</i> is the number of (one-way) roads. You can assume the inequalities 2 &le; <i>n</i> &le; 50 and 0 &le; <i>m</i> &le; <i>n</i>(<i>n</i>&minus;1) hold. Towns are numbered from 1 to <i>n</i>, inclusive. The town 1 is Jim's hometown, and the town <i>n</i> is the destination town.49</p>50 51<p>52<i>d<sub>i</sub></i> is the visa fee of the town <i>i</i>, and <i>e<sub>i</sub></i> is its altitude. You can assume 1 &le; <i>d<sub>i</sub></i> &le; 1000 and 1&le;<i>e<sub>i</sub></i> &le; 999 for 2&le;<i>i</i>&le;<i>n</i>&minus;1. The towns 1 and <i>n</i> do not impose visa fee. The altitude of the town 1 is 0, and that of the town n is 1000. Multiple towns may have the same altitude, but you can assume that there are no more than 10 towns with the same altitude.53</p>54 55<p>56The <i>j</i>-th road is from the town <i>a<sub>j</sub></i> to <i>b<sub>j</sub></i> with the cost <i>c<sub>j</sub></i> (1 &le; <i>j</i> &le; <i>m</i>). You can assume 1 &le; <i>a<sub>j</sub></i> &le; <i>n</i>, 1 &le; <i>b<sub>j</sub></i> &le; <i>n</i>, and 1 &le; <i>c<sub>j</sub></i> &le; 1000. You can directly go from <i>a<sub>j</sub></i> to <i>b<sub>j</sub></i>, but not from <i>b<sub>j</sub></i> to <i>a<sub>j</sub></i> unless a road from <i>b<sub>j</sub></i> to <i>a<sub>j</sub></i> is separately given. There are no two roads connecting the same pair of towns towards the same direction, that is, for any <i>i</i> and <i>j</i> such that <i>i</i> &ne; <i>j</i>, <i>a<sub>i</sub></i> &ne; <i>a<sub>j</sub></i> or <i>b<sub>i</sub></i> &ne; <i>b<sub>j</sub></i>. There are no roads connecting a town to itself, that is, for any <i>j</i>, <i>a<sub>j</sub></i> &ne; <i>b<sub>j</sub></i>.57</p>58 59<p>60The last dataset is followed by a line containing two zeros (separated by a space).61</p>62 63<H2>Output</H2>64<p>65For each dataset in the input, a line containing the minimum total cost, including the visa fees, of the trip should be output. If such a trip is not possible, output &ldquo;-1&rdquo;.66</p>67 68<H2>Sample Input</H2>69<pre>703 6713 1721 2 1732 3 1743 2 1752 1 1761 3 4773 1 4783 6795 1801 2 1812 3 1823 2 1832 1 1841 3 4853 1 4864 5873 1883 1891 2 5902 3 5913 4 5924 2 5933 1 5942 1952 1 1960 097</pre>98 99<H2>Output for the Sample Input</H2>100<pre>1017102810336104-1105</pre>