Skip to content

Commit

Permalink
Re-run markdown
Browse files Browse the repository at this point in the history
  • Loading branch information
captn3m0 committed May 1, 2018
1 parent f1e9904 commit 690dbd0
Show file tree
Hide file tree
Showing 1,663 changed files with 2,420 additions and 3,117 deletions.
2 changes: 1 addition & 1 deletion _problems/challenge/L2GRAPH.md
Expand Up @@ -67,8 +67,8 @@ Each test case will be given a score d\*L/K where d is the dimension provided in
2
3


</pre>### Explanation Of Sample Data

The provided answers are certainly not optimal for either test case, but they are valid solutions according to the output specification and such output would be accepted. The score for this output would be as follows.

In the first test case, we would have K = 1 since the Euclidean distance from the point representing node 2 to the points representing either 0 or 1 is exactly 2 and the Euclidean distance between the points representing nodes 0 and 1 exceeds 1. We also have L = sqrt(8)/1 since sqrt(8) is the distance between the points representing nodes 0 and 1 and 1 is distance between nodes 0 and 1 in the original graph. Thus, the score for this case is d\*L/K = 2\*sqrt(8) = 5.6568542.
Expand Down
3 changes: 1 addition & 2 deletions _problems/easy/A1.md
Expand Up @@ -132,5 +132,4 @@ Yes
Yes
No
Yes

</pre>**Explanation:** For example, in the last case you have to pay up, since: 6+3+123=132.
</pre>**Explanation:** For example, in the last case you have to pay up, since: 6+3+123=132.
1 change: 0 additions & 1 deletion _problems/easy/A2.md
Expand Up @@ -91,5 +91,4 @@ For each test case, output a line containing exactly one of the words 'Yes' or '
<b>Output:</b>
Yes
No

</pre>
3 changes: 1 addition & 2 deletions _problems/easy/A3.md
Expand Up @@ -113,5 +113,4 @@ For each test case output a line containing a single integer, equal to the minim
0
1
2

</pre>**Explanation:** for the respective test cases, the number picked by Johnny could have been e.g. _n_=100, _n_=5, and _n_=1.
</pre>**Explanation:** for the respective test cases, the number picked by Johnny could have been e.g. _n_=100, _n_=5, and _n_=1.
1 change: 0 additions & 1 deletion _problems/easy/A4.md
Expand Up @@ -87,5 +87,4 @@ For each test case, print out one line containing two numbers, separated by a sp
<b>Output</b>
25 56
387 489

</pre>
2 changes: 1 addition & 1 deletion _problems/easy/ABABAABA.md
Expand Up @@ -108,8 +108,8 @@ BAB
<b>Output:</b>
-1
B

</pre>### Explanation

**Test case #1**:

- The string "AAAA" appears once as a subsequence in itself.
Expand Down
2 changes: 1 addition & 1 deletion _problems/easy/ABREPEAT.md
Expand Up @@ -111,8 +111,8 @@ abzbabzbazab
6
2
64197148392731290

</pre>### Explanation

**Test case 1.** Limak repeated the string "abcb" 2 times, and so he got "abcbabcb". There are 6 occurrences of the subsequence "ab":

- ABcbabcb (the two letters marked uppercase)
Expand Down
2 changes: 1 addition & 1 deletion _problems/easy/ABROADS.md
Expand Up @@ -130,8 +130,8 @@ D 3</tt>
6
13
10</tt>

</pre>### Explanation

- After the first query, the populations are **(3, 2, 3)** and the most populated region is **{1, 2, 3}**.
- After the second query the populations and the regions remain the same.
- After the third query the populations are **(3, 3, 3)** and the most populated region is again **{1, 2, 3}**.
Expand Down
2 changes: 1 addition & 1 deletion _problems/easy/ABX01.md
Expand Up @@ -128,8 +128,8 @@ For each test case, print a single line containing one integer — the value of
7
4
1

</pre>### Explanation

**Example case 1:** F(5 · 5) = F(25) = F(2+5) = F(7) = 7

**Example case 2:** F(7 · 7) = F(49) = F(4+9) = F(13) = F(1+3) = F(4) = 4
Expand Down
2 changes: 1 addition & 1 deletion _problems/easy/ABX02.md
Expand Up @@ -135,8 +135,8 @@ For each test case, print a single line containing one integer — the number of

2
1024

</pre>### Explanation

**Example case 1:** We have 2 sweets in box 1 and 2 sweets in box 2. All possible sequences **P1..4** are: 1122, 2211, 1212, 2121, 1221 and 2112. Out of them, only 1212 and 2121 are valid, since **S1** = **S2** = 1.

**Example case 2:** All possible 210 sequences are valid.
14 changes: 7 additions & 7 deletions _problems/easy/ADDMUL.md
Expand Up @@ -82,23 +82,23 @@ You are given a one dimensional integer array **A** of length **N**. You need to
for (i = x; i <= y; i++)
<b>A</b><sub>i</sub> += v;
<b>A</b><sub>i</sub> %= M;
<pre>**Query 2** : 2 x y v This implies multiplying the scalar v with the array **A** for all the indices from x to y, i.e.,
<pre>**Query 2** : 2 x y v
This implies multiplying the scalar v with the array **A** for all the indices from x to y, i.e.,
``
```
for (i = x; i <= y; i++)
<b>A</b><sub>i</sub> *= v
<b>A</b><sub>i</sub> %= M

</pre>**Query 3** : 3 x y v This implies initializing the array **A** at all the indices from x to y with the value v, i.e.,
</pre>**Query 3** : 3 x y v
This implies initializing the array **A** at all the indices from x to y with the value v, i.e.,
``

```
for (i = x; i <= y; i++)
<b>A</b><sub>i</sub> = v
<pre>**Query 4** : 4 x y
This is a report query which needs to find the sum of the values in **A** from x to y, i.e.,
``
Expand All @@ -108,8 +108,8 @@ for (i = x; i <= y; i++)
sum += <b>A</b><sub>i</sub>
sum %= M
Output sum.

</pre>**Note:** a%b represents the remainder of a when divided by b.

### Input

- First line contains two space separated integers **N**, **Q**.
Expand Down Expand Up @@ -149,8 +149,8 @@ Output sum.
10
69
<pre>### Explanation
Initial **A** : \[1, 2, 3, 4\]
Result of first query : 1 + 2 + 3 + 4 = 10
**A** after second query: \[ 11, 12, 13, 4\]
Expand Down
6 changes: 2 additions & 4 deletions _problems/easy/ADIGIT.md
Expand Up @@ -76,7 +76,7 @@ All submissions for this problem are available.### Read problems statements in

- On each step he choose an index **x** from **1** to **n**.
- For all indices **y (y < x)** he calculated the difference **by** = **ax** - **ay**.
- Then he calculated **B1** - sum of all **by** which are greater than and **B2** - sum of all **by** which are less than .
- Then he calculated **B1** - sum of all **by** which are greater than 0 and **B2** - sum of all **by** which are less than 0.
- The answer for this step is **B1 - B2**.

Chef remembers the game, but forgot the answer. Please, help him!
Expand All @@ -93,7 +93,7 @@ Chef remembers the game, but forgot the answer. Please, help him!
### Constraints

- **1****n, m****10^5**
-**ai****9**
- 0 **ai****9**
- **1****x****n**

### Example
Expand All @@ -110,7 +110,6 @@ Chef remembers the game, but forgot the answer. Please, help him!
7
9


</pre><pre>
<p> </p>
<h3>Explanation</h3>
Expand All @@ -135,5 +134,4 @@ and the answer is <b>7</b>.</p>
so <b>B1 = 2 + 1 = 3</b>,
<b>B2 = -1 -2 -3 = -6</b>
and the answer is <b>9</b>.</p>

</pre>
2 changes: 1 addition & 1 deletion _problems/easy/ADMAG.md
Expand Up @@ -107,8 +107,8 @@ Seeing you thoroughly puzzled, she explains that she can apply the trick so fast
<b>Output:</b>
1
3

</pre>### Explanation

- **In example 1**, only **1** card containing **{1}** will work.
- **In example 2**, make **3** cards containing **{1,4}, {2}** and **{3,4}**.
- Assume you thought of **1**, then you will select the 1st card **{1,4}**, then she will correctly figure out the integer you thought being **1**.
Expand Down
2 changes: 1 addition & 1 deletion _problems/easy/ADTRI.md
Expand Up @@ -108,6 +108,6 @@ For each test case, output "YES" if the triangle transformation is possible, oth
<b>Output:</b>
<tt>YES
NO</tt>

</pre>### Explanation

- In test case 1, make the length of any one side **6**, and it will suffice.
3 changes: 2 additions & 1 deletion _problems/easy/AEHASH.md
Expand Up @@ -24,6 +24,7 @@ The pseudocode of the hash function is as below. hash(S) is the hash value of a
return result
end function
</pre>The function split in the above pseudocode takes a binary string S as the parameter and returns a pair of binary strings (S1, S2) such that:

- |S1| <= |S2|.
- The difference of |S1| and |S2| is at most 1.
- The concatenation of S1 and S2 (in that order) is S.
Expand Down Expand Up @@ -62,8 +63,8 @@ For each test case, output a single line consisting the number of different bina
1
3
4

</pre>### Explanation

For the last test case, the solutions are: - AAEAAE
- AEAAAE
- AAEAEA
Expand Down
4 changes: 2 additions & 2 deletions _problems/easy/ALETHIO.md
Expand Up @@ -72,7 +72,7 @@ All submissions for this problem are available.Lyra Belacqua is a very gifted gi

The alethiometer had four needles, out of which the user would direct three of them to lie over symbols on the face of the device to ask a question. The fourth needle then swung into action and pointed to various symbols one after another, thus telling the answer.

For this problem, consider the alethiometer consisting of symbols : digits ''-'**9**' and letters '**A**'-'**Z**'. Learned scholars were debating the age of the Universe, and they requested Lyra to find out the age from the alethiometer. Having asked the question, the fourth needle started spouting out symbols, which Lyra quickly recorded. In that long string of characters, she knows that some substring corresponds to the age of the Universe. She also knows that the alethiometer could have wrongly pointed out atmost one digit (0-9) as a letter (A-Z). She then wonders what is the maximum possible age of the Universe.
For this problem, consider the alethiometer consisting of symbols : digits '0'-'**9**' and letters '**A**'-'**Z**'. Learned scholars were debating the age of the Universe, and they requested Lyra to find out the age from the alethiometer. Having asked the question, the fourth needle started spouting out symbols, which Lyra quickly recorded. In that long string of characters, she knows that some substring corresponds to the age of the Universe. She also knows that the alethiometer could have wrongly pointed out atmost one digit (0-9) as a letter (A-Z). She then wonders what is the maximum possible age of the Universe.

Given the set of symbols the alethiometer pointed out, help her find the maximum age of the Universe, which could correspond to a substring of the original string with atmost one letter changed.

Expand Down Expand Up @@ -107,8 +107,8 @@ C0D3C43F

<b>Output2:</b>
3943

</pre>### Explanation

In the first example, there is no choice as to what the number can be. It has to be 6,454.

In the second example, there are a total of 41 possible strings (one for the original, and 10 for changing each letter). You can verify that the maximum number as a substring is got by making the string "C0D3943F".
6 changes: 3 additions & 3 deletions _problems/easy/ALEXNUMB.md
Expand Up @@ -85,7 +85,7 @@ For each test case, output a single line containing number of pairs for correspo

- **1****T****4**
- **1****n****100000**
-**ai****109**
- 0 **ai****109**
- All the ai are distinct

### Example
Expand All @@ -96,13 +96,13 @@ For each test case, output a single line containing number of pairs for correspo
2 1
3
3 1 2

</pre>**Output:**

<pre>
1
3

</pre>### Explanation

Case 1: Only one such pair: (2,1)

Case 2: 3 possible pairs: (2,1), (2,3), (3,1)
Expand Down
2 changes: 1 addition & 1 deletion _problems/easy/AMMEAT.md
Expand Up @@ -96,6 +96,6 @@ For each test case, output an integer, denoting the minimum number of plates. If

<b>Output:</b>
2

</pre>### Explanation

If he takes **3**rd and **4**th plates, then we may eat **P3 + P4 = 7** meatballs in Las Vegas. This is the only way for eating at least **M = 7** meatballs with **2** plates.
2 changes: 1 addition & 1 deletion _problems/easy/AMMEAT2.md
Expand Up @@ -99,8 +99,8 @@ For each test case, output **K** distinct integers, denoting the number of selec
<b>Output:</b>
45 63 35
-1

</pre>### Explanation

**Example case 1**: One of the possible choices is that he takes **45**th plate, **63**rd plate, and **35**th plate. Because
**GCD(45, 63) = 9**,
**GCD(45, 35) = 5**,
Expand Down
4 changes: 2 additions & 2 deletions _problems/easy/AMR15D.md
Expand Up @@ -93,7 +93,7 @@ Output exactly **Q** integers on separate lines, where the output on the **ith**

- **1****N****105**
- **1****Q****105**
-**K****N-1**
- 0 **K****N-1**
- **1****Ai****104**

### Example
Expand All @@ -108,8 +108,8 @@ Output exactly **Q** integers on separate lines, where the output on the **ith**
<b>Output:</b>
10
3

</pre>### Explanation

**For the first query**, **K = 0**. Hence, Bhallaladeva cannot take gold plates from any of the houses for free. It will cost him 3 + 2 + 1 + 4 = **10** nimbdas.

**For the second query**, **K = 2**. In the first step Bhallaladeva can pay **2** nimbdas for gold plates in house number 2, and take the gold in houses 1 and 4 for free (Note that house 1 has 3 gold plates and house 4 has 4 gold plates). Now, he has looted houses 1, 2 & 4. Now in the second step, he loots house 3, by paying **1** nimbda. Hence, the total cost = 1 + 2 = **3**. Note that there might be multiple ways to achieve the minimum cost, and we have explained only one of them.
2 changes: 1 addition & 1 deletion _problems/easy/AMSGAME1.md
Expand Up @@ -109,8 +109,8 @@ For each test case, **output a single integer** - the value of all the numbers w
1
1


</pre>### Explanation

**Test Case 1:** Since there are only two numbers, the operations are forced.

- { 10, 12 } => Replace 12 with ( 12 - 10 = 2 ) => { 10, 2 }
Expand Down
2 changes: 1 addition & 1 deletion _problems/easy/AMSGAME2.md
Expand Up @@ -112,8 +112,8 @@ For each test case, **output a single integer** - the number of **sub-sequences*
7
1


</pre>### Explanation

**Test Case 1:** The following 11 sub-sequences are counted.

- { 2, 3 }
Expand Down
4 changes: 2 additions & 2 deletions _problems/easy/ANKGAME.md
Expand Up @@ -107,14 +107,14 @@ For each test case, output a single integer corresponding to the answer for that
2
2 3


</pre>**Sample Output:**

<pre>
2
2


</pre>**Explanation:**

**Case 1:**
The following different orders are possible:

Expand Down
4 changes: 2 additions & 2 deletions _problems/easy/ANKPAL.md
Expand Up @@ -111,15 +111,15 @@ ababa
1 3 3 5
2 4 1 5


</pre>**Sample Output:**

<pre>
Yes
No
Yes
Yes

</pre>### Explanation:

**Query 1:**The string becomes a**ab**ba. The queried substring is _bb_, which is a palindrome.

**Query 2:**The string becomes **ba**aba. The queried substring is _ab_, which is not a palindrome.
Expand Down
14 changes: 7 additions & 7 deletions _problems/easy/ANKPAREN.md
Expand Up @@ -118,17 +118,17 @@ Output exactly **T** lines, each containing answer to the corresponding query.
(())
3


</pre>**Sample Output:**

<pre>
)
(()
-1
())
-1


</pre>### Explanation:

**Case 1:**Following are the subsequences:

<pre>
Expand All @@ -138,8 +138,8 @@ Length Subsequence Regular/Non-Regular
1 ) Non-regular
2 () Regular


</pre>There are two non-regular subsequences of equal length:'(' and ')'.We are asked for the lexicographically 2nd, so output should be ')'.
</pre>There are two non-regular subsequences of equal length:'(' and ')'.
We are asked for the lexicographically 2nd, so output should be ')'.

**Case 2:**Following are the subsequences:

Expand All @@ -151,8 +151,8 @@ Length Subsequence Regular/Non-Regular
2 () Regular
3 (() Non-Regular


</pre>In this case, there are non-regular subsequences of lengths 1, 2, and 3. But, as 3 is the maximum among these, we choose, **(()**.

**Case 3:**
The string is same as Case 2, and we realize that there is only one subsequence of the maximum length 3, thus we must output -1.

Expand All @@ -164,8 +164,8 @@ Length Subsequence
3 ())
3 (()


</pre>In lexicographical order, we have following subsequences: \[ ((), ()) \]The query asks for 2nd subsequence, thus the required output is ()).
</pre>In lexicographical order, we have following subsequences: \[ ((), ()) \]
The query asks for 2nd subsequence, thus the required output is ()).

**Case 5:**
This is the same sequence as last case, and we know that there are exactly 2 distinct subsequences of maximum length. Thus, answer should be -1.
Expand Down

0 comments on commit 690dbd0

Please sign in to comment.