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
p00922.html81 linesDownload Raw Back to problem_descriptions
1 2<H1><font color="#000">Problem I: </font>Hidden Tree</H1>3 4<p>5Consider a binary tree whose leaves are assigned integer weights. Such a tree is called <i>balanced</i> if, for every non-leaf node, the sum of the weights in its left subtree is equal to that in the right subtree. For instance, the tree in the following figure is balanced.6</p>7 8 9<center>10<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_hiddenTree" style="aling:center"><br/>11<span>12Figure I.1. A balanced tree13</span>14</center>15<br/>16 17 18 19<p>20A balanced tree is said to be hidden in a sequence <var>A</var>, if the integers obtained by listing the weights of all leaves of the tree from left to right form a subsequence of <var>A</var>. Here, a subsequence is a sequence that can be derived by deleting zero or more elements from the original sequence without changing the order of the remaining elements.21</p>22 23<p>24For instance, the balanced tree in the figure above is hidden in the sequence 3 4 1 3 1 2 4 4 6, because 4 1 1 2 4 4 is a subsequence of it.25</p>26 27<p>28Now, your task is to find, in a given sequence of integers, the balanced tree with the largest number of leaves hidden in it. In fact, the tree shown in Figure I.1 has the largest number of leaves among the balanced trees hidden in the sequence mentioned above.29</p>30 31 32 33<H2>Input</H2>34 35<p>36The input consists of multiple datasets. Each dataset represents a sequence <var>A</var> of integers in the format37</p>38 39<pre>40<var>N</var>41<var>A<sub>1</sub></var> <var>A<sub>2</sub></var> . . . <var>A<sub>N</sub></var>42</pre>43 44<p>45where 1 &le; <var>N</var> &le; 1000 and 1 &le; <var>A<sub>i</sub></var> &le; 500 for 1 &le; <var>i</var> &le; <var>N</var>. <var>N</var> is the length of the input sequence, and <var>A<sub>i</sub></var> is the <var>i</var>-th element of the sequence.46</p>47 48<p>49The input ends with a line consisting of a single zero. The number of datasets does not exceed 50.50</p>51 52 53<H2>Output</H2>54 55<p>56For each dataset, find the balanced tree with the largest number of leaves among those hidden in <var>A</var>, and output, in a line, the number of its leaves.57</p>58 59<H2>Sample Input</H2>60<pre>619623 4 1 3 1 2 4 4 6634643 12 6 365106610 9 8 7 6 5 4 3 2 167116810 9 8 7 6 5 4 3 2 1 1698701 1 1 1 1 1 1 171072</pre>73 74<H2>Output for the Sample Input</H2>75<pre>76677278179580881</pre>