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 F:9There is No Alternative10</h2>11 12<p>13 ICPC (Isles of Coral Park City) consist of several beautiful islands.14</p>15 16<p>17 The citizens requested construction of bridges between islands to resolve inconveniences of using boats between islands, and they demand that all the islands should be reachable from any other islands via one or more bridges.18</p>19 20<p>21 The city mayor selected a number of pairs of islands, and ordered a building company to estimate the costs to build bridges between the pairs. With this estimate, the mayor has to decide the set of bridges to build, minimizing the total construction cost.22</p>23 24<p>25 However, it is difficult for him to select the most cost-efficient set of bridges among those connecting all the islands. For example, three sets of bridges connect all the islands for the Sample Input 1. The bridges in each set are expressed by bold edges in Figure F.1.26</p>27 28<center>29<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_ICPCAsia2014_F1" width="600"><br>30<p>Figure F.1. Three sets of bridges connecting all the islands for Sample Input 1</p>31</center>32 33<p>34 As the first step, he decided to build only those bridges which are contained in all the sets of bridges to connect all the islands and minimize the cost. We refer to such bridges as <i>no alternative bridges</i>. In Figure F.2, no alternative bridges are drawn as thick edges for the Sample Input 1, 2 and 3.35</p>36 37<center>38<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_ICPCAsia2014_F2" width="600"><br>39<p>Figure F.2. No alternative bridges for Sample Input 1, 2 and 3</p>40</center>41 42 43 44<p>45Write a program that advises the mayor which bridges are no alternative bridges for the given input.46</p>47 48 49<h3>Input</h3>50 51<p>52The input consists of a single test case.53 <br>54<br>55$N$ $M$<br>56$S_1$ $D_1$ $C_1$<br>57.<br>58.<br>59.<br>60$S_M$ $D_M$ $C_M$<br>61<br>62 63The first line contains two positive integers $N$ and $M$. $N$ represents the number of islands and each island is identified by an integer 1 through $N$. $M$ represents the number of the pairs of islands between which a bridge may be built.64</p>65 66<p>67Each line of the next $M$ lines contains three integers $S_i$, $D_i$ and $C_i$ ($1 \leq i \leq M$) which represent that it will cost $C_i$ to build the bridge between islands $S_i$ and $D_i$. You may assume $3 \leq N \leq 500$, $N − 1 \leq M \leq min(50000, N(N − 1)/2)$, $1 \leq S_i < D_i \leq N$, and $1 \leq C_i \leq 10000$. No two bridges connect the same pair of two islands, that is, if $i \ne j$ and $S_i = S_j$, then $D_i \ne D_j$ . If all the candidate bridges are built, all the islands are reachable from any other islands via one or more bridges.68</p>69 70 71<h3>Output</h3>72 73<p>74Output two integers, which mean the number of no alternative bridges and the sum of their construction cost, separated by a space.75</p>76 77 78 79<h3>Sample Input 1</h3>80 81<pre>4 4821 2 3831 3 3842 3 3852 4 3</pre>86 87<h3>Sample Output 1</h3>88 89<pre>1 3</pre>90 91<h3>Sample Input 2</h3>92 93<pre>4 4941 2 3951 3 5962 3 3972 4 3</pre>98 99<h3>Sample Output 2</h3>100 101<pre>3 9</pre>102 103<h3>Sample Input 3</h3>104 105<pre>4 41061 2 31071 3 11082 3 31092 4 3</pre>110 111<h3>Sample Output 3</h3>112 113<pre>2 4</pre>114 115<h3>Sample Input 4</h3>116 117<pre>3 31181 2 11192 3 11201 3 1</pre>121 122<h3>Sample Output 4</h3>123 124<pre>0 0</pre>125 