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
p00926.html118 linesDownload Raw Back to problem_descriptions
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 9<h2>Problem C:10Shopping11</h2>12 13<p>14  Your friend will enjoy shopping. She will walk through a mall along a straight street, where $N$ individual shops (numbered from 1 to $N$) are aligned at regular intervals. Each shop has one door and is located at the one side of the street. The distances between the doors of the adjacent shops are the same length, i.e. a unit length. Starting shopping at the entrance of the mall, she visits shops in order to purchase goods. She has to go to the exit of the mall after shopping.15</p>16 17<p>18  She requires some restrictions on visiting order of shops. Each of the restrictions indicates that she shall visit a shop before visiting another shop. For example, when she wants to buy a nice dress before choosing heels, she shall visit a boutique before visiting a shoe store. When the boutique is farther than the shoe store, she must pass the shoe store before visiting the boutique, and go back to the shoe store after visiting the boutique.19</p>20 21<p>22  If only the order of the visiting shops satisfies all the restrictions, she can visit other shops in any order she likes.23</p>24 25<p>26  Write a program to determine the minimum required walking length for her to move from the entrance to the exit.27</p>28 29<p>30  Assume that the position of the door of the shop numbered $k$ is $k$ units far from the entrance, where the position of the exit is $N + 1$ units far from the entrance.31</p>32 33<h3>Input</h3>34 35<p>36  The input consists of a single test case.<br>37  <br>38$N$ $m$<br>39$c_1$ $d_1$<br>40.<br>41.<br>42.<br>43$c_m$ $d_m$<br>44  <br>45  46  The first line contains two integers $N$ and $m$, where $N$ ($1 \leq N \leq 1000$) is the number of shops, and $m$ ($0 \leq m \leq 500$) is the number of restrictions. Each of the next $m$ lines contains two integers $c_i$ and $d_i$ ($1 \leq c_i < d_i \leq N$) indicating the $i$-th restriction on the visiting order, where she must visit the shop numbered $c_i$ after she visits the shop numbered $d_i$ ($i = 1, . . . , m$).47																														       </p>48<p>49  There are no pair of $j$ and $k$ that satisfy $c_j = c_k$ and $d_j = d_k$.50</p>51 52 53<h3>Output</h3>54 55<p>56Output the minimum required walking length for her to move from the entrance to the exit. You should omit the length of her walk in the insides of shops.57</p>58 59 60<h3>Sample Input 1</h3>61 62<pre>10 3633 7648 9652 5</pre>66 67<h3>Sample Output 1</h3>68 69<pre>23</pre>70 71<h3>Sample Input 2</h3>72 73<pre>10 3748 9756 7762 4</pre>77 78<h3>Sample Output 2</h3>79 80<pre>19</pre>81 82<h3>Sample Input 3</h3>83 84<pre>10 0</pre>85 86<h3>Sample Output 3</h3>87 88<pre>11</pre>89 90<h3>Sample Input 4</h3>91 92<pre>10 6936 7944 5952 5966 9973 5986 8</pre>99 100<h3>Sample Output 4</h3>101 102<pre>23</pre>103 104<h3>Sample Input 5</h3>105 106<pre>1000 81073 41086 10001095 10001107 10001118 10001124 10001139 10001141 2</pre>115 116<h3>Sample Output 5</h3>117 118<pre>2997</pre>