`_ for an
39 | explanation of what that means, and what formats of real numbers we accept.
40 |
41 | Limits
42 | ------
43 | 1 ≤ **T** ≤ 100.
44 |
45 | Small dataset
46 | -------------
47 | 0 ≤ **M** < **N** ≤ 10.
48 |
49 | Large dataset
50 | -------------
51 | 0 ≤ **M** < **N** ≤ 2000.
52 |
53 | Sample
54 | ------
55 |
56 | ::
57 |
58 | Input Output
59 |
60 | 2 Case #1: 0.33333333
61 | 2 1 Case #2: 1.00000000
62 | 1 0
63 |
64 | In sample case #1, there are 3 voters. Two of them support A -- we will call
65 | them A1 and A2 -- and one of them supports B. They can come to vote in six
66 | possible orders: A1 A2 B, A2 A1 B, A1 B A2, A2 B A1, B A1 A2, B A2 A1.
67 | Only the first two of those orders guarantee that Candidate A is winning after
68 | every vote. (For example, if the order is A1 B A2, then Candidate A is winning
69 | after the first vote but tied after the second vote.)
70 | So the answer is 2/6 = 0.333333...
71 |
72 | In sample case #2, there is only 1 voter, and that voter supports A.
73 | There is only one possible order of arrival, and A will be winning after the
74 | one and only vote.
75 |
--------------------------------------------------------------------------------
/2016/Round D/Problem A/A-small-practice-solution.txt:
--------------------------------------------------------------------------------
1 | Case #1: 0.17647058823529413
2 | Case #2: 0.6363636363636364
3 | Case #3: 0.2
4 | Case #4: 1.0
5 | Case #5: 0.3333333333333333
6 | Case #6: 0.5
7 | Case #7: 0.125
8 | Case #8: 0.6
9 | Case #9: 0.5
10 | Case #10: 0.09090909090909091
11 | Case #11: 0.75
12 | Case #12: 0.7142857142857143
13 | Case #13: 1.0
14 | Case #14: 0.6
15 | Case #15: 0.05263157894736842
16 | Case #16: 1.0
17 | Case #17: 0.07692307692307693
18 | Case #18: 0.5
19 | Case #19: 0.6
20 | Case #20: 0.14285714285714285
21 | Case #21: 0.5
22 | Case #22: 0.45454545454545453
23 | Case #23: 0.23076923076923078
24 | Case #24: 1.0
25 | Case #25: 0.06666666666666667
26 | Case #26: 0.14285714285714285
27 | Case #27: 0.6363636363636364
28 | Case #28: 0.42857142857142855
29 | Case #29: 0.07692307692307693
30 | Case #30: 0.5
31 | Case #31: 0.42857142857142855
32 | Case #32: 0.3333333333333333
33 | Case #33: 1.0
34 | Case #34: 1.0
35 | Case #35: 0.8
36 | Case #36: 0.5
37 | Case #37: 0.1111111111111111
38 | Case #38: 0.2727272727272727
39 | Case #39: 0.2727272727272727
40 | Case #40: 0.6
41 | Case #41: 0.2857142857142857
42 | Case #42: 0.2
43 | Case #43: 0.5555555555555556
44 | Case #44: 0.42857142857142855
45 | Case #45: 1.0
46 | Case #46: 0.25
47 | Case #47: 0.8181818181818182
48 | Case #48: 0.14285714285714285
49 | Case #49: 1.0
50 | Case #50: 0.17647058823529413
51 | Case #51: 0.3333333333333333
52 | Case #52: 0.3333333333333333
53 | Case #53: 1.0
54 | Case #54: 0.14285714285714285
55 | Case #55: 0.7142857142857143
56 | Case #56: 1.0
57 | Case #57: 0.5
58 | Case #58: 0.07692307692307693
59 | Case #59: 0.42857142857142855
60 | Case #60: 1.0
61 | Case #61: 0.42857142857142855
62 | Case #62: 0.8181818181818182
63 | Case #63: 0.2727272727272727
64 | Case #64: 0.5
65 | Case #65: 0.3333333333333333
66 | Case #66: 0.14285714285714285
67 | Case #67: 0.05263157894736842
68 | Case #68: 0.25
69 | Case #69: 0.5555555555555556
70 | Case #70: 0.2857142857142857
71 | Case #71: 0.3333333333333333
72 | Case #72: 0.3333333333333333
73 | Case #73: 0.16666666666666666
74 | Case #74: 0.25
75 | Case #75: 0.25
76 | Case #76: 1.0
77 | Case #77: 1.0
78 | Case #78: 0.3333333333333333
79 | Case #79: 1.0
80 | Case #80: 0.14285714285714285
81 | Case #81: 0.5384615384615384
82 | Case #82: 1.0
83 | Case #83: 0.058823529411764705
84 | Case #84: 0.09090909090909091
85 | Case #85: 1.0
86 | Case #86: 0.5555555555555556
87 | Case #87: 0.42857142857142855
88 | Case #88: 0.6666666666666666
89 | Case #89: 0.8
90 | Case #90: 0.6666666666666666
91 | Case #91: 0.25
92 | Case #92: 0.2
93 | Case #93: 1.0
94 | Case #94: 0.7142857142857143
95 | Case #95: 0.3333333333333333
96 | Case #96: 0.8181818181818182
97 | Case #97: 0.07692307692307693
98 | Case #98: 0.09090909090909091
99 | Case #99: 0.1111111111111111
100 | Case #100: 1.0
101 |
--------------------------------------------------------------------------------
/2016/Round E/Problem A/README.rst:
--------------------------------------------------------------------------------
1 | .. _Problem A. Diwali lightings:
2 | https://code.google.com/codejam/contest/5264487/dashboard#s=p0
3 |
4 | ==============================
5 | `Problem A. Diwali lightings`_
6 | ==============================
7 |
8 | Problem
9 | -------
10 | Diwali is the festival of lights. To celebrate it, people decorate their
11 | houses with multi-color lights and burst crackers. Everyone loves Diwali,
12 | and so does Pari. Pari is very fond of lights, and has transfinite powers,
13 | so she buys an infinite number of red and blue light bulbs. As a programmer,
14 | she also loves patterns, so she arranges her lights by infinitely repeating a
15 | given finite pattern **S**.
16 |
17 | For example, if **S** is ``BBRB``, the infinite sequence Pari builds would be
18 | ``BBRBBBRBBBRB...``
19 |
20 | Blue is Pari's favorite color, so she wants to know the number of blue bulbs
21 | between the **I**\ th bulb and **J**\ th bulb, inclusive, in the infinite sequence
22 | she built (lights are numbered with consecutive integers starting from 1).
23 | In the sequence above, the indices would be numbered as follows::
24 |
25 | B B R B B B R B B B R B...
26 | 1 2 3 4 5 6 7 8 9 10 11 12
27 |
28 | So, for example, there are 4 blue lights between the 4th and 8th positions,
29 | but only 2 between the 10th and 12th.
30 |
31 | Since the sequence can be very long, she wrote a program to do the count for
32 | her. Can you do the same?
33 |
34 | Input
35 | -----
36 | | The first line of the input gives the number of test cases, **T**. **T** test cases follow.
37 | | First line of each test case consists of a string S, denoting the initial finite pattern.
38 | | Second line of each test case consists of two space separated integers **I** and **J**, defined above.
39 |
40 | Output
41 | ------
42 | For each test case, output one line containing ``Case #x: y``, where ``x`` is
43 | the test case number (starting from 1) and ``y`` is number of blue bulbs
44 | between the **I**\ th bulb and **J**\ th bulb of Pari's infinite sequence,
45 | inclusive.
46 |
47 | Limits
48 | ------
49 | | 1 ≤ **T** ≤ 100.
50 | | 1 ≤ length of **S** ≤ 100.
51 | | Each character of **S** is either uppercase ``B`` or uppercase ``R``.
52 |
53 | Small dataset
54 | -------------
55 | 1 ≤ **I** ≤ **J** ≤ 10\ :sup:`6`.
56 |
57 | Large dataset
58 | -------------
59 | 1 ≤ **I** ≤ **J** ≤ 10\ :sup:`18`.
60 |
61 | Sample
62 | ------
63 |
64 | ::
65 |
66 | Input Output
67 |
68 | 3 Case #1: 4
69 | BBRB Case #2: 2
70 | 4 8 Case #3: 500000
71 | BBRB
72 | 10 12
73 | BR
74 | 1 1000000
75 |
76 | Cases #1 and #2 are explained above.
77 |
78 | In Case #3, bulbs at odd indices are always blue, and bulbs at even indices
79 | are always red, so there are half a million blue bulbs between positions 1 and
80 | 10\ :sup:`6`.
81 |
--------------------------------------------------------------------------------
/2019/Round A/Training/ANALYSIS.rst:
--------------------------------------------------------------------------------
1 | Analysis
2 | --------
3 | | To make a fair team, we have to train the members of the team to the same
4 | skill level as the most skillful member of the team.
5 | | For any **P** students we pick, the time required to make a fair team is =
6 | Σ(max(**S**\ :sub:`i`, **S**\ :sub:`i+1`... **S**\ :sub:`P`)
7 | - **S**\ :sub:`i`), for all students i = 1 to **P** in the team.
8 | Our goal is to minimize this value.
9 | | One possible approach could be to go through all possible subsets of **P**
10 | students, from the given **N** students. But there exists |N|\ C\ |P| such
11 | subsets(here symbol C denotes Combination_) [sic]. Number [sic] of such
12 | subsets will be in the order of |Factorial(N)| and so enumerating through
13 | all of them will not fit within the time limit.
14 |
15 | .. |N| raw:: html
16 |
17 | N
18 |
19 | .. |P| raw:: html
20 |
21 | P
22 |
23 | .. _Combination: https://en.wikipedia.org/wiki/Combination/
24 |
25 | .. |Factorial(N)| raw:: html
26 |
27 | Factorial(N)
28 |
29 | Test set 1 (Visible)
30 | --------------------
31 | | We can start with the observation that once we fix the student with highest
32 | skill level x, to minimize our goal we should always choose students with
33 | skills as high as possible, but less than or equal to x. Hence we can sort
34 | students on the basis of skill level in decreasing order, and iterate over
35 | each student assuming they would have the highest skill level in the team.
36 | Say, this student is at position i in the sorted sequence; the team would be
37 | formed of students on positions i, i + 1, ..., i + **P** - 1
38 | (i.e. a contiguous subarray of size **P**).
39 | | For each subarray of size **P** in the sorted array, we can calculate the
40 | training time required to make a fair team using the aforementioned formula.
41 | There are **N** - **P** + 1 subarrays of size **P**, and the complexity of
42 | calculating training time of subarray size **P** is O(**P**). So the overall
43 | complexity of this approach is O(**N** × **P**), which will be sufficient
44 | for test set 1.
45 |
46 | Test set 2 (Hidden)
47 | -------------------
48 | | We need to go through all of the subarrays once,
49 | but can we calculate the training time of a subarray faster?
50 | | Let us assume the array is sorted in decreasing order.
51 | The training time formula for a subarray starting at position i is
52 | | = Σ(**S**\ [i] - **S**\ [j]) where j = i to i + **P** -1 [sic]
53 | | = **P** × **S**\ [i] - Σ(**S**\ [j]) where j = i to i + **P** - 1
54 | | As we always need sum [sic] of a contagious subarray, we can pre compute
55 | [sic] the prefix sum of the whole array in advance, and get the sum of any
56 | subarray in O(1) time, which makes the calculation of training time O(1).
57 | | So, the overall complexity of this approach is O(**N**).
58 |
--------------------------------------------------------------------------------
/2019/Round A/Training/PROBLEM.rst:
--------------------------------------------------------------------------------
1 | Problem
2 | -------
3 | As the football coach at your local school, you have been tasked with picking
4 | a team of exactly **P** students to represent your school.
5 | There are **N** students for you to pick from.
6 | The i-th student has a *skill rating* **S**\ |i|,
7 | which is a positive integer indicating how skilled they are.
8 |
9 | .. |i| raw:: html
10 |
11 | i
12 |
13 | You have decided that a team is *fair* if it has exactly **P** students on it
14 | and they all have the same skill rating. That way, everyone plays as a team.
15 | Initially, it might not be possible to pick a fair team, so you will give some
16 | of the students one-on-one coaching. It takes one hour of coaching to increase
17 | the skill rating of any student by 1.
18 |
19 | The competition season is starting very soon (in fact, the first match has
20 | already started!), so you'd like to find the minimum number of hours of
21 | coaching you need to give before you are able to pick a fair team.
22 |
23 | Input
24 | -----
25 | The first line of the input gives the number of test cases, **T**.
26 | **T** test cases follow.
27 | Each test case starts with a line containing the two integers **N** and **P**,
28 | the number of students and the number of students you need to pick,
29 | respectively. Then, another line follows containing **N** integers **S**\ |i|;
30 | the i-th of these is the skill of the i-th student.
31 |
32 | Output
33 | ------
34 | For each test case, output one line containing ``Case #x: y``,
35 | where ``x`` is the test case number (starting from 1)
36 | and ``y`` is the minimum number of hours of coaching needed,
37 | before you can pick a fair team of **P** students.
38 |
39 | Limits
40 | ------
41 | | Time limit: 15 seconds per test set.
42 | | Memory limit: 1 GB.
43 | | 1 ≤ **T** ≤ 100.
44 | | 1 ≤ **S**\ |i| ≤ 10000, for all i.
45 | | 2 ≤ **P** ≤ **N**.
46 |
47 | Test set 1 (Visible)
48 | ~~~~~~~~~~~~~~~~~~~~
49 | 2 ≤ **N** ≤ 1000.
50 |
51 | Test set 2 (Hidden)
52 | ~~~~~~~~~~~~~~~~~~~
53 | 2 ≤ **N** ≤ 10\ :sup:`5`.
54 |
55 | Sample
56 | ------
57 |
58 | ::
59 |
60 | Input Output
61 |
62 | 3
63 | 4 3
64 | 3 1 9 100 Case #1: 14
65 | 6 2 Case #2: 0
66 | 5 5 1 2 3 4 Case #3: 6
67 | 5 5
68 | 7 7 1 7 7
69 |
70 | In Sample Case #1, you can spend a total of 6 hours training the first student
71 | and 8 hours training the second one.
72 | This gives the first, second and third students a skill level of 9.
73 | This is the minimum time you can spend, so the answer is 14.
74 |
75 | In Sample Case #2, you can already pick a fair team
76 | (the first and second student) without having to do any coaching,
77 | so the answer is 0.
78 |
79 | In Sample Case #3, **P** = **N**, so every student will be on your team.
80 | You have to spend 6 hours training the third student,
81 | so that they have a skill of 7, like everyone else.
82 | This is the minimum time you can spend, so the answer is 6.
83 |
--------------------------------------------------------------------------------
/2014/Round A/Problem A/A-small-practice.in:
--------------------------------------------------------------------------------
1 | 100
2 | 5 1011011 1011111 1010000 1011111 1011011
3 | 1 1111111
4 | 5 0000000 0000000 0000000 0000100 0000000
5 | 4 0001000 0010000 0011010 0011010
6 | 1 1011110
7 | 5 1011110 1011011 1011111 1010000 1011111
8 | 2 0010011 1011001
9 | 4 0100001 1101001 1101101 0100000
10 | 5 0110000 1111000 1111001 1111001 1110000
11 | 5 0100000 1101110 1101010 1101110 1100000
12 | 2 1111011 1110000
13 | 2 1101000 0110000
14 | 5 0010011 0110011 0110001 0100101 0110000
15 | 2 0110000 1111100
16 | 2 1010111 1010000
17 | 2 0100001 1101001
18 | 4 1101001 1101001 0100000 1101010
19 | 1 0001011
20 | 3 0111011 0111111 0110000
21 | 1 0110000
22 | 4 1011010 1011010 0110010 1111000
23 | 3 1111001 1101001 0110000
24 | 2 1111010 1111110
25 | 1 0110000
26 | 3 1111001 1111101 1110000
27 | 5 1011001 1001101 0010000 1011100 1011001
28 | 1 0011111
29 | 3 1010110 1010011 1010111
30 | 5 1011101 1011001 0010001 1011001 1001101
31 | 5 1010011 0110011 1110001 1100101 0110000
32 | 2 1101001 0110000
33 | 4 1111010 1111110 1110000 1011110
34 | 1 0110000
35 | 4 0010111 0010011 0110011 0110001
36 | 2 0110010 1111000
37 | 1 1010000
38 | 5 0110000 1111110 1111010 1111110 1110000
39 | 4 0110001 1111001 1101101 0110000
40 | 1 1011100
41 | 3 1110000 1011100 1011000
42 | 3 1110001 1100101 0110000
43 | 3 1011011 0110011 1111001
44 | 5 1011010 1011010 0110010 1111000 1101000
45 | 3 1011011 0110011 1111001
46 | 2 1100100 0110000
47 | 1 1011000
48 | 5 0011011 0011011 0110011 0111001 0101001
49 | 1 0100000
50 | 4 1011010 1011010 0110010 1111000
51 | 2 0101101 0110000
52 | 2 1111111 1110000
53 | 5 1101001 0100000 1101010 1101011 1101011
54 | 2 0010111 0010011
55 | 1 0100000
56 | 1 0111001
57 | 3 0001111 0001011 0100011
58 | 4 1101101 0110000 1111100 1111001
59 | 1 0111000
60 | 3 0110000 0111110 0111011
61 | 2 0101100 0110000
62 | 4 1011100 1011000 0110000 1111000
63 | 4 0110011 0111001 0101101 0110000
64 | 4 0011111 0010000 0011111 0011011
65 | 5 1110000 1011011 1011011 0110011 1111001
66 | 4 1101100 0100000 1101110 1101010
67 | 1 1001111
68 | 1 0110011
69 | 4 0011001 0001101 0010000 0011110
70 | 2 0100000 1101110
71 | 2 0011101 0011001
72 | 5 1001110 1001010 0100010 1101000 1101100
73 | 1 0100010
74 | 1 1111110
75 | 1 1011101
76 | 2 1010111 1010011
77 | 5 0110000 1110100 1110001 1110101 1110000
78 | 2 1001001 1001101
79 | 5 0110011 0111001 0101001 0110000 0111010
80 | 2 1110000 1011100
81 | 5 0110001 1111001 1101001 0110000 1111000
82 | 1 0111011
83 | 2 1111001 1110000
84 | 1 0111010
85 | 4 1010000 1011101 1011001 0010001
86 | 3 0000011 1001001 1001101
87 | 2 1111001 1110000
88 | 5 1011011 1011111 1010000 1011111 1011011
89 | 2 1101011 1100000
90 | 2 0101011 0101111
91 | 3 0010000 0011111 0011011
92 | 5 0101001 0110000 0111010 0111011 0111011
93 | 4 0110000 1111110 1111011 1111111
94 | 3 1111010 1110000 1011010
95 | 1 1011011
96 | 2 1110000 1011001
97 | 2 0011111 0011011
98 | 1 1111001
99 | 1 0100000
100 | 1 0110000
101 | 5 1010110 1010010 0110010 1110000 1100100
102 |
--------------------------------------------------------------------------------
/2016/Round B/Problem A/README.rst:
--------------------------------------------------------------------------------
1 | .. _Problem A. Sherlock and Parentheses:
2 | https://code.google.com/codejam/contest/5254487/dashboard#s=p0
3 |
4 | ======================================
5 | `Problem A. Sherlock and Parentheses`_
6 | ======================================
7 |
8 | Problem
9 | -------
10 | Sherlock and Watson have recently enrolled in a computer programming course.
11 | Today, the tutor taught them about the balanced parentheses problem.
12 | A string ``S`` consisting only of characters ``(`` and/or ``)`` is *balanced*
13 | if:
14 |
15 | - It is the empty string, or:
16 | - It has the form ``(``\ S\ ``)``, where S is a balanced string, or:
17 | - It has the form |S1|\ |S2|, where |S1| is a balanced string and |S2| is a
18 | balanced string.
19 |
20 | .. |S1| replace:: S\ :sub:`1`
21 | .. |S2| replace:: S\ :sub:`2`
22 |
23 | Sherlock coded up the solution very quickly and started bragging about how
24 | good he is, so Watson gave him a problem to test his knowledge.
25 | He asked Sherlock to generate a string S of **L + R** characters, in which
26 | there are a total of **L** left parentheses ``(`` and a total of **R** right
27 | parentheses ``)``. Moreover, the string must have as many different balanced
28 | non-empty substrings as possible. (Two substrings are considered different as
29 | long as they start or end at different indexes of the string, even if their
30 | content happens to be the same). Note that S itself does not have to be
31 | balanced.
32 |
33 | Sherlock is sure that once he knows the maximum possible number of balanced
34 | non-empty substrings, he will be able to solve the problem.
35 | Can you help him find that maximum number?
36 |
37 | Input
38 | -----
39 | The first line of the input gives the number of test cases, **T**.
40 | **T** test cases follow.
41 | Each test case consists of one line with two integers: **L** and **R**.
42 |
43 | Output
44 | ------
45 | For each test case, output one line containing ``Case #x: y``,
46 | where ``x`` is the test case number (starting from 1) and ``y`` is the answer,
47 | as described above.
48 |
49 | Limits
50 | ------
51 | 1 ≤ **T** ≤ 100.
52 |
53 | Small dataset
54 | -------------
55 | | 0 ≤ **L** ≤ 20.
56 | | 0 ≤ **R** ≤ 20.
57 | | 1 ≤ **L + R** ≤ 20.
58 |
59 | Large dataset
60 | -------------
61 | | 0 ≤ **L** ≤ |10^5|.
62 | | 0 ≤ **R** ≤ |10^5|.
63 | | 1 ≤ **L + R** ≤ |10^5|.
64 |
65 | .. |10^5| replace:: 10\ :sup:`5`
66 |
67 | Sample
68 | ------
69 |
70 | ::
71 |
72 | Input Output
73 |
74 | 3 Case #1: 0
75 | 1 0 Case #2: 1
76 | 1 1 Case #3: 3
77 | 3 2
78 |
79 | | In Case 1, the only possible string is ``(``. There are no balanced non-empty substrings.
80 | | In Case 2, the optimal string is ``()``. There is only one balanced non-empty substring: the entire string itself.
81 | | In Case 3, both strings ``()()(`` and ``(()()`` give the same optimal answer.
82 | | For the case ``()()(``, for example, the three balanced substrings are ``()`` from indexes 1 to 2, ``()`` from indexes 3 to 4, and ``()()`` from indexes 1 to 4.
83 |
--------------------------------------------------------------------------------
/2014/Round D/Problem B/B-large-practice-solution.txt:
--------------------------------------------------------------------------------
1 | Case #1: 30 3 19 19 15 20 5 13 26 26 27 11 11 19 26 0 4 6 0 0 14 19 9 17 31
2 | Case #2: 76 110 102 103 38 48 51 63 86 75 38 2 97 86 3 0 20 84 91 5 103 95 66 59 6 26 77 46 82 63 95 101 96 29 87 72 16 19 101 6 95 59 45 72 0 88 16 0 97 110 3 33 52 7 110 19 25 68 1 1 4 6 29 54 74 20 88 47 94 23 6 23 57 54 15 1 87 45 93 80 49 45 6 7 75 85 1 3 32 23 92 102 94 10 53 7 7 25 88 15
3 | Case #3: 49 113 117 83 223 171 179 56 86 74 160 220 162 156 13 16 46 162 86 229 81 231 176 152 96 221 1 28 185 231 220 51 215 67 217 179 210 12 93 70 230 82 201 17 48 29 1 1 78 79 201 46 1 29 206 161 189 78 29 24 7 36 4 43 79 36 202 1 46 1 99 175 1 78 1 171 1 18 154 230 122 226 225 103 57 81 22 215 111 134 53 227 149 28 90 217 64 70 232 13 6 105 223 1 1 165 108 148 98 46 94 1 20 173 181 142 1 51 120 222 86 56 22 72 229 78 214 212 188 20 82 139 37 231 113 182 85 160 36 20 229 179 39 166 97 99 231 170 111 47 66 212 154 210 80 220 163 230 136 141 232 217 73 166 85 8 111 226 158 220 226 29 94 230 183 172 230 171 50 159 101 220 85 109 16 201 229 13 146 1 219 21 46 166 215 228 140 178 148 129 167 1 74 124 111 149 101 99 22 1 80 43 151 150 184 159 50 101 223 124 230 126 115 223 37 95 216 184 48 1 174 111 226 71 2 124 4 99 102 28 43 137 164 34 155 225 230 4 140 78 43 225 20 174 149 10 210 230 92 5 183 102 183 155 206 149 81 148 5 112 39 14 156 22 57 74 51 230 215 80 50 139 192 195 28 89 103 96 75 48 1 192 20 83 185 228 218 179 99 67 229 222 176 178 79 74 102 83 183 7 149 174 59 37 156 223 150 34 1 100 210 1 142 168 60 96 48 70 218 1 103 39 215 46 180 228 1 28 217 186 107 150 36 205 142 216 161 108 53 160 232 43 151 82 210 176 141 139 227 189 20 36 37 217 189 215 94 93 42 209 143 149 154 162 29 1 156 51 8 78 225 51 176 177 43 68 37 228 190 133 113 218 34 24 113 179 78 96 202 82 215 39 28 1 209 216 33 229 184 134 217 217 28 33 70 44 62 91 221 227 188 90 48 174 141 124 44 159 141 229 1 14 227 201 92 53 172 218 20 149 1 108 48 206 228 16 213 192 155 233 154 154 20 159 81 222 81 114 181 79 225 90 223 134 81 166 201 224 22 133 220 231 108 57 173 54 231 140 43 113 229 231 225 232 186 22 139 95 1 78 220 225 11 20 29 104 231 228 141 228
4 | Case #4: 38 38 40 58 49 4 37 39 74 40 9 23 6 1 24 13 67 30 19 42 9 0 31 48 69 63 43 0 63 2 63 47 73 37 15 19 11 12 25 61 1 1 74 48 30 25 63 31 6 37 1 71 74 3 0 52 26 0 31 69 67 68 6 11 6 70 24 48 71 53 37 72 38 52 0 1 48 71 30 64
5 | Case #5: 66 100 148 10 145 2 17 2 149 121 144 57 43 126 49 136 25 146 17 2 45 109 10 112 2 139 149 34 1 122 89 45 89 115 2 49 17 4 45 18 4 135 110 45 104 138 100 145 18 130 99 149 151 107 70 81 98 29 144 91 143 96 126 74 71 135 95 85 138 120 10 64 74 19 146 6 18 140 106 127 149 71 82 70 141 140 55 33 30 92 88 133 149 47 54 78 59 32 142 146 132 91 43 39 65 133 13 67 40 85 130 153 90 62 34 80 142 111 32 130 10 119 148 72 57 143 117 144 98 132 102 52 6 43 141 145 64 35 24 133 152 101 146 135 151 12 16 126 131 49
6 | Case #6: 76 39 59 0 0 0 70 42 72 72 6 72 60 12 4 14 17 59 34 17 69 73 9 12 30 18 0 59 70 6 41 55 7 62 45 55 76 71 72 39 9 9 38 32 48 25 72 24 54 72 55 59 41 8 38 67 6 0 41 69 13 72 10 75 65 40 6 63 62 15 67 55 0 7 12 60 2 38 0 53
7 |
--------------------------------------------------------------------------------
/2016/Round C/Problem B/README.rst:
--------------------------------------------------------------------------------
1 | .. _Problem B. Safe Squares:
2 | https://code.google.com/codejam/contest/6274486/dashboard#s=p1
3 |
4 | ==========================
5 | `Problem B. Safe Squares`_
6 | ==========================
7 |
8 | Problem
9 | -------
10 | Codejamon trainers are actively looking for monsters, but if you are not a
11 | trainer, these monsters could be really dangerous for you.
12 | You might want to find safe places that do not have any monsters!
13 |
14 | Consider our world as a grid, and some of the cells have been occupied by
15 | monsters. We define a *safe square* as a grid-aligned **D** × **D** square of
16 | grid cells (with **D** ≥ 1) that does not contain any monsters. Your task is
17 | to find out how many safe squares (of any size) we have in the entire world.
18 |
19 | Input
20 | -----
21 | The first line of the input gives the number of test cases, **T**.
22 | **T** test cases follow. Each test case starts with a line with three
23 | integers, **R**, **C**, and **K**. The grid has **R** rows and **C** columns,
24 | and contains **K** monsters. **K** more lines follow; each contains two
25 | integers **R**\ |i| and **C**\ |i|, indicating the row and column that the
26 | i-th monster is in. (Rows are numbered from top to bottom, starting from 0;
27 | columns are numbered from left to right, starting from 0.)
28 |
29 | .. |i| raw:: html
30 |
31 | i
32 |
33 | Output
34 | ------
35 | For each test case, output one line containing ``Case #x: y``,
36 | where ``x`` is the test case number (starting from 1)
37 | and ``y`` is the the total number of safe zones for this test case.
38 |
39 | Limits
40 | ------
41 | 1 ≤ **T** ≤ 20.
42 |
43 | (**R**\ |i|, **C**\ |i|) ≠ (**R**\ |j|, **C**\ |j|) for i ≠ j.
44 | (No two monsters are in the same grid cell.)
45 |
46 | 0 ≤ **R**\ |i| < **R**, i from 1 to **K**
47 |
48 | 0 ≤ **C**\ |i| < **C**, i from 1 to **K**
49 |
50 | .. |j| raw:: html
51 |
52 | j
53 |
54 | Small dataset
55 | -------------
56 | 1 ≤ **R** ≤ 10.
57 |
58 | 1 ≤ **C** ≤ 10.
59 |
60 | 0 ≤ **K** ≤ 10.
61 |
62 | Large dataset
63 | -------------
64 | 1 ≤ **R** ≤ 3000.
65 |
66 | 1 ≤ **C** ≤ 3000.
67 |
68 | 0 ≤ **K** ≤ 3000.
69 |
70 | Sample
71 | ------
72 |
73 | ::
74 |
75 | Input Output
76 |
77 | 2 Case #1: 10
78 | 3 3 1 Case #2: 51
79 | 2 1
80 | 4 11 12
81 | 0 1
82 | 0 3
83 | 0 4
84 | 0 10
85 | 1 0
86 | 1 9
87 | 2 0
88 | 2 4
89 | 2 9
90 | 2 10
91 | 3 4
92 | 3 10
93 |
94 | The grid of sample case #1 is:
95 |
96 | | ``0 0 0``
97 | | ``0 0 0``
98 | ``0 1 0``
99 |
100 | Here, 0 represents a cell with no monster, and 1 represents a cell with a
101 | monster. It has 10 safe squares: 8 1x1 and 2 2x2.
102 |
103 | The grid of sample case #2 is:
104 |
105 | | ``0 1 0 1 1 0 0 0 0 0 1``
106 | | ``1 0 0 0 0 0 0 0 0 1 0``
107 | | ``1 0 0 0 1 0 0 0 0 1 1``
108 | ``0 0 0 0 1 0 0 0 0 0 1``
109 |
110 | Note that sample case #2 will only appear in the Large dataset.
111 | It has 51 safe squares: 32 1x1, 13 2x2, 5 3x3, and 1 4x4.
112 |
--------------------------------------------------------------------------------
/2016/Round E/Problem A/A-large-practice-solution.txt:
--------------------------------------------------------------------------------
1 | Case #1: 466666666666663691
2 | Case #2: 146341463414632522
3 | Case #3: 0
4 | Case #4: 275862068965511877
5 | Case #5: 1000000000000000000
6 | Case #6: 289473684210524225
7 | Case #7: 399999999999995106
8 | Case #8: 468749999999997049
9 | Case #9: 374999999999997912
10 | Case #10: 536585365853651429
11 | Case #11: 499999999999996097
12 | Case #12: 95238095238094368
13 | Case #13: 499999999999997820
14 | Case #14: 829787234042545528
15 | Case #15: 606382978723396731
16 | Case #16: 346938775510202774
17 | Case #17: 235294117647056799
18 | Case #18: 655172413793093225
19 | Case #19: 0
20 | Case #20: 161290322580644459
21 | Case #21: 782608695652165414
22 | Case #22: 304347826086953741
23 | Case #23: 634146341463403681
24 | Case #24: 538461538461537077
25 | Case #25: 328571428571427122
26 | Case #26: 111111111111110788
27 | Case #27: 666666666666660294
28 | Case #28: 105263157894735750
29 | Case #29: 359550561797746204
30 | Case #30: 214285714285712374
31 | Case #31: 550000000000000000
32 | Case #32: 408602150537633340
33 | Case #33: 999999999999990485
34 | Case #34: 257142857142856158
35 | Case #35: 428571428571424185
36 | Case #36: 599999999999992056
37 | Case #37: 392857142857138022
38 | Case #38: 0
39 | Case #39: 148148148148147592
40 | Case #40: 466666666666662268
41 | Case #41: 854166666666663031
42 | Case #42: 865853658536575070
43 | Case #43: 492753623188397968
44 | Case #44: 275362318840575476
45 | Case #45: 444444444444442316
46 | Case #46: 431372549019604040
47 | Case #47: 550561797752800843
48 | Case #48: 595238095238088523
49 | Case #49: 596491228070166826
50 | Case #50: 803921568627438648
51 | Case #51: 395348837209298276
52 | Case #52: 862745098039207720
53 | Case #53: 374999999999999147
54 | Case #54: 0
55 | Case #55: 388888888888885659
56 | Case #56: 353658536585360811
57 | Case #57: 649999999999993328
58 | Case #58: 540540540540535695
59 | Case #59: 1000000000000000000
60 | Case #60: 678571428571417656
61 | Case #61: 441176470588234536
62 | Case #62: 604651162790692066
63 | Case #63: 999999999999989088
64 | Case #64: 694117647058815279
65 | Case #65: 734939759036137531
66 | Case #66: 178571428571426112
67 | Case #67: 599999999999993551
68 | Case #68: 41666666666665973
69 | Case #69: 372549019607837232
70 | Case #70: 328358208955222390
71 | Case #71: 853932584269650632
72 | Case #72: 999999999999984086
73 | Case #73: 506493506493501911
74 | Case #74: 599999999999993819
75 | Case #75: 367346938775506970
76 | Case #76: 880434782608688298
77 | Case #77: 646341463414625039
78 | Case #78: 639999999999989779
79 | Case #79: 906666666666665747
80 | Case #80: 799999999999988111
81 | Case #81: 444444444444438898
82 | Case #82: 874999999999990871
83 | Case #83: 166666666666665998
84 | Case #84: 694444444444442347
85 | Case #85: 0
86 | Case #86: 217948717948717390
87 | Case #87: 478260869565213802
88 | Case #88: 421052631578942776
89 | Case #89: 714285714285707223
90 | Case #90: 617021276595735399
91 | Case #91: 209302325581393375
92 | Case #92: 511627906976738040
93 | Case #93: 919354838709663418
94 | Case #94: 360000000000000000
95 | Case #95: 1
96 | Case #96: 0
97 | Case #97: 864864864864851629
98 | Case #98: 426229508196719448
99 | Case #99: 666666666666656014
100 | Case #100: 882352941176468306
101 |
--------------------------------------------------------------------------------
/2016/Round D/Problem A/A-large-practice-solution.txt:
--------------------------------------------------------------------------------
1 | Case #1: 0.28683385579937304
2 | Case #2: 0.3572994300745287
3 | Case #3: 0.4934725848563969
4 | Case #4: 0.9654959950708565
5 | Case #5: 0.08252650991240203
6 | Case #6: 0.5295336787564767
7 | Case #7: 0.3489736070381232
8 | Case #8: 0.1571025399811853
9 | Case #9: 0.5630498533724341
10 | Case #10: 0.0494728304947283
11 | Case #11: 0.7071274298056156
12 | Case #12: 1.0
13 | Case #13: 0.6211812627291242
14 | Case #14: 0.23483438779307778
15 | Case #15: 0.3267950963222417
16 | Case #16: 0.22723253757736517
17 | Case #17: 0.08190171793847383
18 | Case #18: 0.16019575856443719
19 | Case #19: 0.5158254918733961
20 | Case #20: 0.27030625832223704
21 | Case #21: 0.11038430089942763
22 | Case #22: 0.09980430528375733
23 | Case #23: 0.5283136278780336
24 | Case #24: 0.17470760233918128
25 | Case #25: 0.4692218350754936
26 | Case #26: 0.09054093144344807
27 | Case #27: 0.03679885673454805
28 | Case #28: 0.2742835876442129
29 | Case #29: 0.3017667844522968
30 | Case #30: 0.6948275862068966
31 | Case #31: 0.41580381471389644
32 | Case #32: 0.36343772760378734
33 | Case #33: 0.2388362652232747
34 | Case #34: 0.14508580343213728
35 | Case #35: 0.33543903979785217
36 | Case #36: 0.4675
37 | Case #37: 0.780448717948718
38 | Case #38: 0.022988505747126436
39 | Case #39: 0.29844961240310075
40 | Case #40: 0.15578465063001146
41 | Case #41: 0.999000499750125
42 | Case #42: 0.9634464751958225
43 | Case #43: 0.5296094078118437
44 | Case #44: 0.05114029025570145
45 | Case #45: 0.3902027027027027
46 | Case #46: 0.7131147540983607
47 | Case #47: 0.04878048780487805
48 | Case #48: 0.776551724137931
49 | Case #49: 0.07751937984496124
50 | Case #50: 0.7863397548161121
51 | Case #51: 0.012840588787973693
52 | Case #52: 0.31368235811702594
53 | Case #53: 0.964248159831756
54 | Case #54: 0.0787518573551263
55 | Case #55: 0.3333333333333333
56 | Case #56: 0.41404358353510895
57 | Case #57: 0.14754098360655737
58 | Case #58: 0.046708348657594705
59 | Case #59: 0.34112792297111416
60 | Case #60: 0.8518518518518519
61 | Case #61: 0.08488063660477453
62 | Case #62: 0.749034749034749
63 | Case #63: 0.1833385926159672
64 | Case #64: 0.38995568685376664
65 | Case #65: 0.019279738086576938
66 | Case #66: 0.4915079773546063
67 | Case #67: 0.5584303579128935
68 | Case #68: 0.4425806451612903
69 | Case #69: 0.727810650887574
70 | Case #70: 0.1836734693877551
71 | Case #71: 0.6482084690553745
72 | Case #72: 0.11413454270597127
73 | Case #73: 0.043029259896729774
74 | Case #74: 1.0
75 | Case #75: 0.8512297540491902
76 | Case #76: 0.16636528028933092
77 | Case #77: 0.2625841615902533
78 | Case #78: 0.06534199465036301
79 | Case #79: 0.6512027491408935
80 | Case #80: 0.6408808582721626
81 | Case #81: 0.41508759385055416
82 | Case #82: 0.048818897637795275
83 | Case #83: 0.27481713688610243
84 | Case #84: 0.3045429052159282
85 | Case #85: 0.47551020408163264
86 | Case #86: 0.04818763326226013
87 | Case #87: 0.13368983957219252
88 | Case #88: 0.5942028985507246
89 | Case #89: 0.01607717041800643
90 | Case #90: 0.00025006251562890725
91 | Case #91: 0.20066889632107024
92 | Case #92: 0.23605150214592274
93 | Case #93: 0.6600826825907212
94 | Case #94: 0.07430997876857749
95 | Case #95: 0.2715551974214343
96 | Case #96: 0.7805405405405406
97 | Case #97: 0.9835345773874863
98 | Case #98: 0.23601973684210525
99 | Case #99: 0.6136528685548294
100 | Case #100: 0.46234509056244044
101 |
--------------------------------------------------------------------------------
/2016/Round B/Problem C/C-small-practice.in:
--------------------------------------------------------------------------------
1 | 50
2 | 1000 1 19 15 17 14 8 20
3 | 1000 8 19 14 16 1 4 20
4 | 1000 10 12 9 15 14 1 20
5 | 1000 0 999995001 1 0 10000 10000 1000000000
6 | 1 622295210 818961667 0 0 514209038 20631819 960988685
7 | 4 484116014 658268577 0 0 551601488 327939466 939080682
8 | 1 292232854 896894315 0 0 479061765 299210935 976175136
9 | 2 142502304 890235588 0 0 32541867 14121448 968211753
10 | 4 753617 882843865 0 0 72063687 624465689 987435521
11 | 1000 74657024 163822613 0 0 447425142 549710036 924477972
12 | 1000 281439273 961964542 0 0 61829024 639596734 955931073
13 | 1000 489295966 770776836 0 0 59732606 196543025 999772851
14 | 1000 803421 137144037 0 0 867311301 978625672 947666872
15 | 1000 36517779 679716007 0 0 594144585 835909261 967306529
16 | 1000 302080834 847224573 262459029 723757896 0 0 982271414
17 | 1000 377774953 553846558 294309496 531250518 0 0 982154319
18 | 1000 144962014 973489864 489216220 999517491 0 0 919484895
19 | 1000 319430434 762359205 639797997 577467273 0 0 972849382
20 | 1000 411587588 789855217 328434141 79490465 0 0 928062911
21 | 1000 266262474 628300813 769786402 441383498 484186986 723567466 940642240
22 | 1000 110352529 411439440 118867344 820027764 410584037 105045030 974963387
23 | 1000 29313008 375169227 135772217 28529115 83924639 352208254 982842777
24 | 1000 459715330 501130810 577575662 761703058 366391258 528873045 938942796
25 | 1000 439877045 674412426 88365719 720944764 593519237 622494146 844429447
26 | 1000 164459784 565374209 81049497 898723469 385411789 995041098 949295357
27 | 1000 187223497 697668143 56028582 367224336 973091218 14730443 972504359
28 | 1000 566209460 992915439 976426103 216773334 916411093 2379812 930701145
29 | 1000 140278796 289037769 700773258 435995583 841357022 339859173 981531718
30 | 1000 600548978 822748685 899465724 57125379 396503499 895468734 993888553
31 | 1000 262105786 287839606 985976333 859135343 732186259 66161028 982221799
32 | 1000 19694964 456733741 954341359 652151741 917885354 80946035 986829680
33 | 1000 62586094 348871376 276105028 644371240 123596680 128170092 946147730
34 | 1000 304110441 475411611 809999364 230978168 404737027 324279512 971648040
35 | 1000 7653517 55142560 908697213 693560278 353255692 651404461 946899652
36 | 1000 140535925 834996180 611201312 110205601 975311356 248440541 932552527
37 | 1000 334188374 921411473 955332558 388472884 16581108 862482734 944855746
38 | 1000 24642622 998041333 859095368 812843672 419808410 574445130 952629548
39 | 1000 205072304 413823218 664988198 495028229 996564056 209754889 975400156
40 | 1000 636667549 678201228 383261331 27290862 965153481 609382711 945647881
41 | 1000 517946350 972938742 390538189 854695546 366222472 59837307 982410008
42 | 1000 321497817 631904998 84518490 809986614 761347591 903294103 975677723
43 | 1000 72898102 211172132 488269818 274994160 233377913 928237751 962660123
44 | 997 178622196 282196639 217454409 333993639 370687882 713045549 967750417
45 | 995 266879862 704083174 621464846 139064822 53955913 968627703 913718057
46 | 948 531547564 796245442 751099374 470238435 828072769 400273742 903386330
47 | 952 227854771 935344149 201903631 337516161 880867662 309656832 943868603
48 | 1000 140747090 893149084 11836941 267259828 333735916 794529350 995166050
49 | 1000 66992513 426795422 386566889 671424446 621988107 556974781 984598569
50 | 1000 503580429 508539367 197990654 368399284 940181094 104854259 927618673
51 | 1000 504901682 973731461 636434916 384077141 224831334 730235134 951129510
52 |
--------------------------------------------------------------------------------
/2016/Round A/Problem A/A-large-practice-solution.txt:
--------------------------------------------------------------------------------
1 | Case #1: CJZFF SONVBXRKPSAGMX
2 | Case #2: IR XOPHCQ DTVCRDKGFI
3 | Case #3: AZOLQJ XCW QPWF SHZM
4 | Case #4: CA FTGTOCEGNSLVURC Y
5 | Case #5: BLCBJRJVEOVGMUIHFZMZ
6 | Case #6: LGGBKEW COVA HXNTY
7 | Case #7: GMACODMKY SWBTBVQG
8 | Case #8: VW SAILXNCFJB I YK
9 | Case #9: GYLHCAMSOLQOPX EVQ
10 | Case #10: S MTAHIEJMQSZFCWNVB
11 | Case #11: UPQCMTWHKPRZKIJNEJ
12 | Case #12: FUSTYWCCEBZGKLQTTP
13 | Case #13: IOV UGNVRQMWICRZUAEK
14 | Case #14: GKBVQFXMYJKOZ N P
15 | Case #15: GMKG BPRSDNFATKJVBYX
16 | Case #16: HE BGN XCIRJWQPWZ
17 | Case #17: HWLVTQOVCASWZXBKDOLE
18 | Case #18: ESLQ YKVCHXBGDS J D
19 | Case #19: ABEIYHTUP X OZNMVJ
20 | Case #20: BZHPJQYF JUQWCRO VE
21 | Case #21: YCBLRDHUSIJD YNEVK O
22 | Case #22: DJNTGSLZHDYQVEVYJRNC
23 | Case #23: BL IFZTIUXQMSCWVU O
24 | Case #24: GGVJKUQIYHPNSOZYP
25 | Case #25: INAUVMBXZX DETKZLHF
26 | Case #26: A Y EXFJSVRVWOOQHWNC
27 | Case #27: ICAW GTDTLRQVHYMCNEF
28 | Case #28: MQAJN GB CLVWFRKS
29 | Case #29: EXWACICYZSXXBBAOVZK
30 | Case #30: A AB C
31 | Case #31: WJLSIALFRKXAQ CYL ZT
32 | Case #32: EUZ PBAJCFKWRFMVQP
33 | Case #33: ZYBXIKZPSRVGLOSNDQAF
34 | Case #34: FHIMUDFNJEQ LMSWWVOM
35 | Case #35: MUNYUJJAOFLBGTFCUBR
36 | Case #36: WVIRUAHFPUEDZNLSEAX
37 | Case #37: BVUAZP EFLW QTKARGWE
38 | Case #38: CVL RKXKP IAJDZ RBF
39 | Case #39: NJLZSFQA OMUTEEBHC
40 | Case #40: KZNGDIOJAPVHCMJXUP
41 | Case #41: RBAEVSTVQFPMUJI SK
42 | Case #42: KDA NJUQHXGAISDCZ NV
43 | Case #43: EWRUPSFMUZINQLRZDVBX
44 | Case #44: GZNCSCHRQTWFIPEEJS
45 | Case #45: IKTM MRUE MVKRNJG BH
46 | Case #46: CJTBOEVUNAHWEG JKR
47 | Case #47: YMKIGTWZZSHIQBK DVU
48 | Case #48: JPGRXPDHIVZADUYK
49 | Case #49: JDGETB A YXINCKQOHV
50 | Case #50: BHBRZNAPVFFLWUEIQXH
51 | Case #51: HP FZVNKORIMLXGMPTV
52 | Case #52: PRAD KYZWCAGGXLROKQH
53 | Case #53: DBEMTTSAH NZOOH CUL
54 | Case #54: BHVMQEFWKU GYIDMUY
55 | Case #55: QHOVBPSU KDWYCEZYGU
56 | Case #56: DYACYDV OGTMYFIPHL
57 | Case #57: ZEICNDVRFGACLYWG
58 | Case #58: LAGTKU WVAAMRSHCXTR
59 | Case #59: PMS SIHRQKYLNPGPUXHB
60 | Case #60: LKQEBRLPGZRDYFIMX H
61 | Case #61: MKNBWQZG UODYZRAGALE
62 | Case #62: QMO TDTZACNHOEF XSWE
63 | Case #63: LSWLENINKPHVKQVYMXR
64 | Case #64: COEJ DFIISTFCRVXUEPK
65 | Case #65: AOEPJXDGBJWGIHZ
66 | Case #66: JRGNBFWD AMZCHOIARQ
67 | Case #67: LHDUPSLJMB RGGFDYQW
68 | Case #68: LGNKJBIX FQHLYCU
69 | Case #69: FMUWSKDCDEMRSHACMVIM
70 | Case #70: TZUNHP LQGCWTKQSTSDG
71 | Case #71: AMJZCDOTIFOUISWWRHS
72 | Case #72: MJYRVCXBARGNKBHEDHQ
73 | Case #73: RM NSEPSLCDVWQJMHJB
74 | Case #74: OAGVCEUX QFKWZNM
75 | Case #75: O QEWVRQ I YFDJNCKH
76 | Case #76: CTX YQTMSOFAH BIN VZ
77 | Case #77: JEOJ P VAWRZCENTGF
78 | Case #78: FUT XORMLBHHHKY ZJNC
79 | Case #79: JOHNSON
80 | Case #80: FCXZAUSJQWLXVZJWPMUE
81 | Case #81: YFMZOJQPLUCRUEHISN
82 | Case #82: EBKMRLOZQEGPPYZFHT
83 | Case #83: B ZJNOXQMGJACUFSORJD
84 | Case #84: U XRAPJHGWR BKIPQDDC
85 | Case #85: CUIDQWTS FHB PIDNG I
86 | Case #86: AMRIGSQUCIDNLVS WX
87 | Case #87: RTO HVYWB IKEDZASPC
88 | Case #88: LFTUSVQXH WXBJEUGG
89 | Case #89: EUBW KOACTN YMXD R
90 | Case #90: HWTELGICKUINESL BRO
91 | Case #91: OP VCOZAWTYU AAQNLXP
92 | Case #92: EPHZHARSQNTKXDIB TV
93 | Case #93: UZRHABLW DNCGMMYK
94 | Case #94: BNTNHGAIALSDUFLN WXE
95 | Case #95: ADNYWNUODRFVUEZKIQ
96 | Case #96: IEFLXC TMIURVQZVKSP
97 | Case #97: JD XMIWNHMOIGTCZ GYA
98 | Case #98: FMPPJEWBI OZBNFYXG
99 | Case #99: VO PFZFKHJXFYUAXTS
100 | Case #100: DUERQQO YAXMV CTI
101 |
--------------------------------------------------------------------------------
/2016/Round A/Problem A/A-small-practice-solution.txt:
--------------------------------------------------------------------------------
1 | Case #1: CMWGICOTZKVNXFJGPB
2 | Case #2: SNKLYGHSEAJNXOPHDIIU
3 | Case #3: CKLGNTVKPJUQVHFKOJYC
4 | Case #4: VKUZECHUBKDQSYIEGR
5 | Case #5: MYLXVXPROOQACCREXGNK
6 | Case #6: JDGETBAYXINCKQOHVAL
7 | Case #7: IESUGXPJKNYQTMZCVRK
8 | Case #8: KQLWBYJUXWMQZNBVRZIZ
9 | Case #9: XFYUAXTSOIPXJNTWEMVR
10 | Case #10: IOVUGNVRQMWICRZUAEKL
11 | Case #11: MDBPULJTNVIBPVKWICXY
12 | Case #12: LPGZRDYFIMXHMOKTGV
13 | Case #13: EMRVAZWTJNRCSTUOGUPP
14 | Case #14: NDBKMRKUOZSLZALHQTC
15 | Case #15: GDNERYKFLCEMFDGHBLIA
16 | Case #16: LYJTSODMNVPIGOZA
17 | Case #17: UBLFILHYXVAXRBVPTQSN
18 | Case #18: SJMKNBWQZGUODYZRAGA
19 | Case #19: EYTIFRXVXXHYMOPKQDLM
20 | Case #20: QKXGRHJSUENSBAVCW
21 | Case #21: JQFCGOGSYYUPVVRHTEHB
22 | Case #22: SQRXALITJVBJBKOGCNK
23 | Case #23: MXZEKVRXPZNGLGBRZDSC
24 | Case #24: OLZVNQRDOJACJIBTGVO
25 | Case #25: MQTLVPBSVWYUIELEZRN
26 | Case #26: SHDBQGVDATZNJGXMII
27 | Case #27: DHQACXDZOVTMQKRCBFEH
28 | Case #28: WZAZZEBRSFTYMKUHQT
29 | Case #29: GRXPDHIVZADUYKEB
30 | Case #30: FDYXFKCIQBHRJAWLAC
31 | Case #31: IWSMGCQOIKDVQXNLY
32 | Case #32: JOHNSON
33 | Case #33: JEOJPVAWRZCENTGFKI
34 | Case #34: FSCXCZVNTKGIJGGNPUAE
35 | Case #35: VVKFJMPMZOBITLREWDUK
36 | Case #36: NOHRGSWBSDZATZXPEYE
37 | Case #37: EKLVVCOWGCFMGYRQNJM
38 | Case #38: UMAWLBCOZUPOAIYXEQH
39 | Case #39: THKLUBIIJRQZXENQYAST
40 | Case #40: EXRCBRWAYEMNJQGIH
41 | Case #41: DRYTBDIDQYXKJPVEAMHF
42 | Case #42: SYXUWQKTDINJFGVZRXXB
43 | Case #43: LAZADBYKWMHVGXONHKOQ
44 | Case #44: BZHPJQYFJUQWCROVENVD
45 | Case #45: PMJBXUXTAVJCGLWZVSDB
46 | Case #46: DKOFVRRATZFQMHLYFZJ
47 | Case #47: ZKXZFIOALVYWJCMDNXSU
48 | Case #48: BCFTWBGTJNUVHBLRDANP
49 | Case #49: IAMGPYOLQRXBPWETMFUS
50 | Case #50: RCSAEOBQWZGVBJIUUGFH
51 | Case #51: HQDPQFJASYSNELVKQRIX
52 | Case #52: KYRFULXATNJNWVIJDM
53 | Case #53: CQGLORUCKTVNILVYBF
54 | Case #54: RIXQXPNUFZQHXTCKVI
55 | Case #55: VLEBPQDTDUSERAWWOZ
56 | Case #56: KZYRVCMEUUNPLNNYJOT
57 | Case #57: MQWFZORJAXYHCBV
58 | Case #58: TUHWOCETRPPADJKVLKNG
59 | Case #59: GUICHJCXRXEYPCWAMJTZ
60 | Case #60: MKZOUDFBJEGXMWBHCR
61 | Case #61: NZRYUQQLPPBLTKMIXDJ
62 | Case #62: BMEGRSHWTELGICKUINES
63 | Case #63: AFQMWIFUPALEXSCYMHQE
64 | Case #64: RGJSZANOPIDLFMIWEMDW
65 | Case #65: RGLOHVHKFIIURNWDZEPQ
66 | Case #66: LZUQIMFHPBFLTXRDKTSN
67 | Case #67: WUQCACYBPHKZJCHLMZVE
68 | Case #68: VMKBTAEAUGZOYSPDJLB
69 | Case #69: FUTXORMLBHHHKYZJNCLZ
70 | Case #70: HCLGMKOXSIPDJXJRWZHV
71 | Case #71: RDHGVYJAOPUCLTQKLIF
72 | Case #72: FTHDLNMSWJIHVAQQUK
73 | Case #73: CMTWHKPRZKIJNEJYO
74 | Case #74: GOINKYFXEFLCPMRAC
75 | Case #75: OCAQVKDDBUPZHHDYINW
76 | Case #76: GEFRIAAYXTMZQJOACLHB
77 | Case #77: SZKTFPYEOLETGJHRAGV
78 | Case #78: BECALENCOGVVXTJQZWYI
79 | Case #79: LUOPHLJCJNSTKEDMZA
80 | Case #80: PHBUTJJDFPIAKLRQEN
81 | Case #81: NFMSZXJCQDEFYHUFIIG
82 | Case #82: NDLPQRABTPNGENICJH
83 | Case #83: BBIGSRFDCYXVCRVHZRWL
84 | Case #84: MTAHIEJMQSZFCWNVBHR
85 | Case #85: CEWRDARJMIGLFAJKZSN
86 | Case #86: IUICJYOEHDDLSHPZZNTF
87 | Case #87: BMMJKKTWSSRPLYXNHSEU
88 | Case #88: NLWKASORQGNUVRKPFILZ
89 | Case #89: MMBYOLIKMAXPESTRHUYF
90 | Case #90: EJGDQGQBOXFPMZWTAR
91 | Case #91: ZJMUCAVPSAFMXHAQGIAR
92 | Case #92: QQZRAXPNKUCLBCLFVDLG
93 | Case #93: BDZHVEXHWIVRMULGA
94 | Case #94: PRKZNGDIOJAPVHCMJ
95 | Case #95: HTVGUTOACIZWSRGLZZJM
96 | Case #96: VRDDKNYPGLSGWAMQRCJO
97 | Case #97: YCHSETBJFOFMLDUIZ
98 | Case #98: PWUPMLZKFDVOIXHEYWQ
99 | Case #99: HLROMTPZKCCKVBQEJLVZ
100 | Case #100: GQMDJBECWISYPZHWOFA
101 |
--------------------------------------------------------------------------------
/2016/Round B/Problem C/C-large-practice.in:
--------------------------------------------------------------------------------
1 | 50
2 | 500000 5 85 39 61 72 97 100
3 | 500000 167 891 711 270 424 901 981
4 | 100000 0 999995001 1 0 10000 10000 1000000000
5 | 1 622295210 818961667 0 0 514209038 20631819 960988685
6 | 4 484116014 658268577 0 0 551601488 327939466 939080682
7 | 1 292232854 896894315 0 0 479061765 299210935 976175136
8 | 2 142502304 890235588 0 0 32541867 14121448 968211753
9 | 4 753617 882843865 0 0 72063687 624465689 987435521
10 | 1000 74657024 163822613 0 0 447425142 549710036 924477972
11 | 1000 281439273 961964542 0 0 61829024 639596734 955931073
12 | 1000 489295966 770776836 0 0 59732606 196543025 999772851
13 | 1000 803421 137144037 0 0 867311301 978625672 947666872
14 | 1000 36517779 679716007 0 0 594144585 835909261 967306529
15 | 1000 302080834 847224573 262459029 723757896 0 0 982271414
16 | 1000 377774953 553846558 294309496 531250518 0 0 982154319
17 | 1000 144962014 973489864 489216220 999517491 0 0 919484895
18 | 1000 319430434 762359205 639797997 577467273 0 0 972849382
19 | 1000 411587588 789855217 328434141 79490465 0 0 928062911
20 | 1000 266262474 628300813 769786402 441383498 484186986 723567466 940642240
21 | 1000 110352529 411439440 118867344 820027764 410584037 105045030 974963387
22 | 1000 29313008 375169227 135772217 28529115 83924639 352208254 982842777
23 | 1000 459715330 501130810 577575662 761703058 366391258 528873045 938942796
24 | 1000 439877045 674412426 88365719 720944764 593519237 622494146 844429447
25 | 1000 164459784 565374209 81049497 898723469 385411789 995041098 949295357
26 | 1000 187223497 697668143 56028582 367224336 973091218 14730443 972504359
27 | 1000 566209460 992915439 976426103 216773334 916411093 2379812 930701145
28 | 1000 140278796 289037769 700773258 435995583 841357022 339859173 981531718
29 | 1000 600548978 822748685 899465724 57125379 396503499 895468734 993888553
30 | 1000 262105786 287839606 985976333 859135343 732186259 66161028 982221799
31 | 1000 19694964 456733741 954341359 652151741 917885354 80946035 986829680
32 | 1000 62586094 348871376 276105028 644371240 123596680 128170092 946147730
33 | 1000 304110441 475411611 809999364 230978168 404737027 324279512 971648040
34 | 1000 7653517 55142560 908697213 693560278 353255692 651404461 946899652
35 | 1000 140535925 834996180 611201312 110205601 975311356 248440541 932552527
36 | 1000 334188374 921411473 955332558 388472884 16581108 862482734 944855746
37 | 1000 24642622 998041333 859095368 812843672 419808410 574445130 952629548
38 | 1000 205072304 413823218 664988198 495028229 996564056 209754889 975400156
39 | 1000 636667549 678201228 383261331 27290862 965153481 609382711 945647881
40 | 1000 517946350 972938742 390538189 854695546 366222472 59837307 982410008
41 | 1000 321497817 631904998 84518490 809986614 761347591 903294103 975677723
42 | 1000 72898102 211172132 488269818 274994160 233377913 928237751 962660123
43 | 474413 178622196 282196639 217454409 333993639 370687882 713045549 967750417
44 | 499455 266879862 704083174 621464846 139064822 53955913 968627703 913718057
45 | 495531 531547564 796245442 751099374 470238435 828072769 400273742 903386330
46 | 497006 227854771 935344149 201903631 337516161 880867662 309656832 943868603
47 | 500000 140747090 893149084 11836941 267259828 333735916 794529350 995166050
48 | 500000 66992513 426795422 386566889 671424446 621988107 556974781 984598569
49 | 500000 503580429 508539367 197990654 368399284 940181094 104854259 927618673
50 | 500000 504901682 973731461 636434916 384077141 224831334 730235134 951129510
51 | 500000 32185262 326226781 850130543 151076481 20906307 862105217 977403603
52 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # [Google Kick Start](https://codingcompetitions.withgoogle.com/kickstart)
2 |
3 | Previously known as [Google Code Jam Kickstart](https://code.google.com/codejam/kickstart/)
4 | and [Google APAC University Graduates Test](https://code.google.com/codejam/apactest)
5 |
6 | ## [2019](2019)
7 |
8 | Note: F-strings are not supported on the new platform,
9 | as it [uses Python 3.5](https://code.google.com/codejam/resources/faq#language-details).
10 |
11 | ### [Practice Round](https://codingcompetitions.withgoogle.com/kickstart/round/0000000000051060)
12 |
13 | - Mural (See [2018 Round H Problem B](2018/Round%20H/Problem%20B))
14 |
15 | ### [Round A](2019/Round%20A)
16 |
17 | - [Training](2019/Round%20A/Training)
18 |
19 | ## [2018](2018)
20 |
21 | ### [Practice Round](https://code.google.com/codejam/contest/4374486/dashboard)
22 |
23 | - Problem A. GBus count (See [2014 Round D Problem B](2014/Round%20D/Problem%20B))
24 |
25 | ### [Round H](2018/Round%20H)
26 |
27 | - [Problem A. Big Buttons](2018/Round%20H/Problem%20A)
28 | - [Problem B. Mural](2018/Round%20H/Problem%20B)
29 |
30 | ## [2017](2017)
31 |
32 | ### [Practice Round](https://code.google.com/codejam/contest/6304486/dashboard)
33 |
34 | - Problem A. Country Leader (See [2016 Round A Problem A](2016/Round%20A/Problem%20A))
35 | - Problem B. Vote (See [2016 Round D Problem A](2016/Round%20D/Problem%20A))
36 | - Problem C. Sherlock and Parentheses (See [2016 Round B Problem A](2016/Round%20B/Problem%20A))
37 |
38 | ### [Round A](2017/Round%20A)
39 |
40 | - [Problem A. Square Counting](2017/Round%20A/Problem%20A)
41 |
42 | ### [Round B](2017/Round%20B)
43 |
44 | - [Problem A. Math Encoder](2017/Round%20B/Problem%20A)
45 |
46 | ### [Practice Round 2](https://code.google.com/codejam/contest/12254486/dashboard)
47 |
48 | - Problem A. Diwali lightings (See [2016 Round E Problem A](2016/Round%20E/Problem%20A))
49 | - Problem B. Safe Squares (See [2016 Round C Problem B](2016/Round%20C/Problem%20B))
50 | - Problem C. Beautiful Numbers (See [2016 Round E Problem B](2016/Round%20E/Problem%20B))
51 | - Problem D. Watson and Intervals (See [2016 Round B Problem C](2016/Round%20B/Problem%20C))
52 |
53 | ## [2016](2016)
54 |
55 | ### [Practice Round](https://code.google.com/codejam/contest/5254486/dashboard)
56 |
57 | - Problem A. Lazy Spelling Bee (See [2015 Round E Problem A](2015/Round%20E/Problem%20A))
58 |
59 | ### [Round A](2016/Round%20A)
60 |
61 | - [Problem A. Country Leader](2016/Round%20A/Problem%20A)
62 |
63 | ### [Round B](2016/Round%20B)
64 |
65 | - [Problem A. Sherlock and Parentheses](2016/Round%20B/Problem%20A)
66 | - [Problem C. Watson and Intervals](2016/Round%20B/Problem%20C)
67 |
68 | ### [Round C](2016/Round%20C)
69 |
70 | - [Problem B. Safe Squares](2016/Round%20C/Problem%20B)
71 |
72 | ### [Round D](2016/Round%20D)
73 |
74 | - [Problem A. Vote](2016/Round%20D/Problem%20A)
75 |
76 | ### [Round E](2016/Round%20E)
77 |
78 | - [Problem A. Diwali lightings](2016/Round%20E/Problem%20A)
79 | - [Problem B. Beautiful Numbers](2016/Round%20E/Problem%20B)
80 |
81 | ## [2015](2015)
82 |
83 | ### [Round E](2015/Round%20E)
84 |
85 | - [Problem A. Lazy Spelling Bee](2015/Round%20E/Problem%20A)
86 |
87 | ## [2014](2014)
88 |
89 | ### [Round A](2014/Round%20A)
90 |
91 | - [Problem A. Seven-segment Display](2014/Round%20A/Problem%20A)
92 | - [Problem B. Super 2048](2014/Round%20A/Problem%20B)
93 | - [Problem C. Addition](2014/Round%20A/Problem%20C)
94 | - [Problem D. Cut Tiles](2014/Round%20A/Problem%20D)
95 |
96 | ### [Round D](2014/Round%20D)
97 |
98 | - [Problem B. GBus count](2014/Round%20D/Problem%20B)
99 |
--------------------------------------------------------------------------------
/2014/Round A/Problem D/D-small-practice.in:
--------------------------------------------------------------------------------
1 | 100
2 | 6 6 2 1 1 1 1 1
3 | 8 6 2 2 1 1 1 1 1 1
4 | 8 5 2 2 1 1 1 1 1 1
5 | 20 7 2 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
6 | 9 6 2 2 2 2 2 2 2 2 2
7 | 9 12 2 2 2 2 2 2 2 2 2
8 | 2 1 0 0
9 | 1 192 5
10 | 5 151 4 6 5 4 3
11 | 4 134217728 21 7 5 27
12 | 9 201 2 6 4 3 4 3 3 4 4
13 | 5 267 4 8 4 0 2
14 | 9 406 0 3 0 0 5 1 3 8 8
15 | 7 2 0 0 1 0 1 1 1
16 | 9 241 5 3 7 5 5 5 2 0 7
17 | 7 259 3 2 5 7 3 6 1
18 | 7 5 2 0 0 2 2 2 0
19 | 5 435 7 3 3 3 6
20 | 5 277 3 5 0 4 8
21 | 5 2 1 1 0 1 1
22 | 6 3 1 0 0 1 0 1
23 | 6 128 4 1 1 2 6 1
24 | 6 4 0 2 0 0 1 1
25 | 5 134217728 6 18 21 20 25
26 | 5 4 0 0 1 1 2
27 | 6 168 5 2 2 7 6 3
28 | 5 183 6 5 7 4 4
29 | 6 8 3 3 2 0 0 1
30 | 5 3 1 1 1 0 1
31 | 6 383 3 2 5 0 2 3
32 | 7 2048 10 9 2 7 2 3 6
33 | 8 1 0 0 0 0 0 0 0 0
34 | 9 434 5 8 8 3 4 1 2 2 2
35 | 8 310 2 8 5 0 8 8 2 8
36 | 9 312 5 3 6 3 5 1 8 1 6
37 | 9 404 2 8 4 8 5 3 1 6 0
38 | 6 2 0 0 1 0 0 0
39 | 8 193 7 1 4 6 4 4 4 6
40 | 6 238 1 0 1 6 2 2
41 | 7 5 0 0 2 2 0 2 1
42 | 9 433 4 3 3 5 2 3 3 4 0
43 | 8 8 2 1 1 0 1 3 0 3
44 | 7 2 1 1 0 1 0 1 1
45 | 6 64 5 2 3 1 4 5
46 | 5 256 2 7 6 1 6
47 | 9 1 0 0 0 0 0 0 0 0 0
48 | 6 281 5 0 6 6 3 7
49 | 8 131072 16 11 7 2 11 6 16 1
50 | 6 253 7 7 7 6 3 6
51 | 6 1 0 0 0 0 0 0
52 | 13 2 0 1 1 0 1 0 0 0 1 0 1 1 0
53 | 10 5 1 0 1 1 1 0 2 2 1 1
54 | 18 536870912 7 13 16 27 29 4 27 17 7 28 29 27 28 27 22 15 9 26
55 | 11 319 1 2 4 5 6 5 6 5 4 3 6
56 | 19 194 1 6 5 6 7 0 6 7 4 0 3 7 4 7 6 0 2 5 7
57 | 10 369 3 6 0 4 5 6 4 4 6 0
58 | 16 210 0 4 3 5 4 3 4 5 0 7 0 3 4 4 2 0
59 | 12 132 5 2 7 1 1 4 6 6 5 7 7 7
60 | 10 5 2 2 2 0 2 2 0 2 0 2
61 | 18 64 4 0 6 4 2 5 0 0 1 6 4 1 1 5 4 2 2 6
62 | 10 157 1 4 7 7 1 6 2 2 5 5
63 | 12 3 1 0 1 0 1 1 0 1 0 0 1 1
64 | 19 134217728 22 19 25 1 25 19 24 0 27 24 4 25 24 14 9 12 27 23 20
65 | 16 324 4 1 6 2 2 3 2 6 5 2 3 0 1 5 3 5
66 | 19 399 2 6 5 4 7 6 7 1 7 3 2 0 1 8 7 3 6 1 0
67 | 14 5 2 0 2 1 0 1 0 2 1 1 1 0 2 0
68 | 11 1 0 0 0 0 0 0 0 0 0 0 0
69 | 19 5 0 2 1 0 1 1 2 0 2 0 1 0 1 1 0 0 1 2 2
70 | 13 185 6 2 6 3 5 5 7 4 7 7 7 6 7
71 | 13 67108864 10 0 25 23 13 22 10 17 4 3 5 17 20
72 | 15 4 0 2 1 1 0 2 2 2 0 0 1 0 1 2 1
73 | 15 1048576 19 19 3 18 18 17 20 18 10 8 13 9 18 20 11
74 | 15 230 7 4 4 6 7 0 3 2 5 5 4 7 1 3 7
75 | 18 184 2 3 1 3 5 5 1 2 0 5 4 0 2 3 2 2 7 2
76 | 16 461 7 1 0 5 5 7 1 4 6 0 4 2 2 1 2 2
77 | 20 159 1 7 3 7 5 0 0 6 7 7 2 6 6 0 7 2 6 4 6 1
78 | 20 150 6 1 3 6 1 2 2 5 1 1 6 0 3 5 7 4 6 5 3 7
79 | 20 137 3 2 7 6 4 1 0 6 5 6 1 0 1 3 3 0 0 1 3 3
80 | 20 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
81 | 20 5 1 2 1 0 1 1 0 0 0 0 0 1 2 0 2 0 0 2 2 0
82 | 20 352 4 5 7 7 5 4 6 6 6 5 3 2 3 6 5 4 7 2 8 3
83 | 20 2 0 0 1 1 0 0 0 1 0 1 0 1 1 1 0 1 0 0 0 1
84 | 20 163 1 6 0 5 7 5 3 2 6 0 5 3 6 7 3 0 7 3 2 1
85 | 20 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
86 | 20 64 4 5 1 4 1 2 3 4 0 0 4 4 6 6 0 1 1 3 3 5
87 | 20 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
88 | 20 178 1 3 5 6 7 2 4 4 3 6 0 2 6 5 5 4 7 6 6 5
89 | 20 298 8 8 8 8 0 6 8 0 5 1 0 3 7 8 7 7 0 7 5 1
90 | 20 232 3 0 4 4 6 6 0 5 7 4 3 6 1 1 4 6 0 3 7 7
91 | 20 208 1 0 1 1 3 1 7 6 2 4 6 2 1 7 4 5 2 3 6 4
92 | 20 2 0 0 0 0 1 0 1 0 1 0 1 1 0 0 1 0 0 1 0 0
93 | 20 221 6 1 7 2 1 4 2 6 6 0 2 4 7 2 3 5 5 1 2 5
94 | 20 356 4 0 0 3 6 3 7 8 0 1 4 4 0 2 3 5 6 7 0 6
95 | 20 452 5 4 8 5 8 8 4 4 6 6 5 1 3 8 1 5 7 8 0 6
96 | 20 178 4 6 0 4 6 4 2 0 7 5 6 3 0 2 5 0 0 7 7 4
97 | 20 5 2 2 1 1 0 2 0 1 0 1 2 0 2 2 2 0 0 0 2 1
98 | 20 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
99 | 20 386 8 1 5 0 7 2 8 6 4 7 5 8 1 7 5 2 8 3 5 0
100 | 20 16777216 22 5 4 13 6 21 10 6 21 23 23 11 2 2 11 7 1 21 9 20
101 | 20 3 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 1 1 1 1 1
102 |
--------------------------------------------------------------------------------
/2017/Round B/Problem A/README.rst:
--------------------------------------------------------------------------------
1 | .. _Problem A. Math Encoder:
2 | https://code.google.com/codejam/contest/11304486/dashboard#s=p0
3 |
4 | ==========================
5 | `Problem A. Math Encoder`_
6 | ==========================
7 |
8 | Problem
9 | -------
10 | Professor Math is working on a secret project and is facing a challenge where
11 | a list of numbers need to be encoded into a single number in the most
12 | efficient manner. After much research, Professor Math finds a 3 step process
13 | that can best encode the numbers:
14 |
15 | 1. The first step is to find all possible non-empty subsets of the list of
16 | numbers and then, for each subset, find the difference between the largest
17 | and smallest numbers (that is, the largest minus the smallest) in that
18 | subset. Note that if there is only one number in a subset, it is both the
19 | largest and the smallest number in that subset. The complete set itself is
20 | also considered a subset.
21 | 2. Then add up all the differences to get the final encoded number.
22 | 3. As the number may be large, output the number modulo
23 | |10^9| + 7 (1000000007).
24 |
25 | .. |10^9| replace:: 10\ :sup:`9`
26 |
27 | The professor has shared an example and its explanation below.
28 | Given a list of numbers, can you help the professor build an efficient
29 | function to compute the final encoded number?
30 |
31 | Input
32 | -----
33 | The first line of the input gives the number of test cases, **T**.
34 | This is followed by T test cases where each test case is defined by 2 lines:
35 |
36 | 1. The first line gives a positive number **N**:
37 | the number of numbers in the list and
38 | 2. The second line contains a list of **N** positive integers |Ki|,
39 | sorted in non-decreasing order.
40 |
41 | .. |Ki| raw:: html
42 |
43 | Ki
44 |
45 | Output
46 | ------
47 | For each test case, output one line containing ``Case #x: y``,
48 | where ``x`` is the test case number (starting from 1)
49 | and ``y`` is the final encoded number.
50 |
51 | Since the output can be a really big number, we only ask you to output
52 | the remainder of dividing the result by the prime |10^9| + 7 (1000000007).
53 |
54 | Limits
55 | ------
56 | | 1 ≤ **T** ≤ 25.
57 | | 1 ≤ |Ki| ≤ 10000, for all i.
58 | | |Ki| ≤ |Ki+1|, for all i < **N** - 1.
59 |
60 | .. |Ki+1| raw:: html
61 |
62 | Ki+1
63 |
64 | Small dataset
65 | -------------
66 | 1 ≤ **N** ≤ 10.
67 |
68 | Large dataset
69 | -------------
70 | 1 ≤ **N** ≤ 10000.
71 |
72 | Sample
73 | ------
74 |
75 | ::
76 |
77 | Input Output
78 |
79 | 1 Case #1: 44
80 | 4
81 | 3 6 7 9
82 |
83 | **Explanation for the sample input**
84 |
85 | 1. | Find all subsets and get the difference between largest & smallest numbers:
86 | | [3], largest-smallest = 3 - 3 = 0.
87 | | [6], largest-smallest = 6 - 6 = 0.
88 | | [7], largest-smallest = 7 - 7 = 0.
89 | | [9], largest-smallest = 9 - 9 = 0.
90 | | [3, 6], largest-smallest = 6 - 3 = 3.
91 | | [3, 7], largest-smallest = 7 - 3 = 4.
92 | | [3, 9], largest-smallest = 9 - 3 = 6.
93 | | [6, 7], largest-smallest = 7 - 6 = 1.
94 | | [6, 9], largest-smallest = 9 - 6 = 3.
95 | | [7, 9], largest-smallest = 9 - 7 = 2.
96 | | [3, 6, 7], largest-smallest = 7 - 3 = 4.
97 | | [3, 6, 9], largest-smallest = 9 - 3 = 6.
98 | | [3, 7, 9], largest-smallest = 9 - 3 = 6.
99 | | [6, 7, 9], largest-smallest = 9 - 6 = 3.
100 | | [3, 6, 7, 9], largest-smallest = 9 - 3 = 6.
101 | 2. | Find the sum of the differences calculated in the previous step:
102 | | 3+4+6+1+3+2+4+6+6+3+6
103 | | = 44.
104 | 3. | Find the answer modulo |10^9| + 7 (1000000007):
105 | | 44 % 1000000007 = 44
106 |
--------------------------------------------------------------------------------
/2018/Round H/Problem B/README.rst:
--------------------------------------------------------------------------------
1 | .. _Problem B. Mural:
2 | https://codejam.withgoogle.com/codejam/contest/3324486/dashboard#s=p1
3 |
4 | ===================
5 | `Problem B. Mural`_
6 | ===================
7 |
8 | Problem
9 | -------
10 | Thanh wants to paint a wonderful mural on a wall that is **N** sections long.
11 | Each section of the wall has a *beauty score*, which indicates how beautiful
12 | it will look if it is painted. Unfortunately, the wall is starting to crumble
13 | due to a recent flood, so he will need to work fast!
14 |
15 | At the beginning of each day, Thanh will paint one of the sections of the
16 | wall. On the first day, he is free to paint any section he likes. On each
17 | subsequent day, he must paint a new section that is next to a section he has
18 | already painted, since he does not want to split up the mural.
19 |
20 | At the end of each day, one section of the wall will be destroyed.
21 | It is always a section of wall that is adjacent to only one other section and
22 | is unpainted (Thanh is using a waterproof paint, so painted sections can't be
23 | destroyed).
24 |
25 | The *total beauty* of Thanh's mural will be equal to the sum of the beauty
26 | scores of the sections he has painted. Thanh would like to guarantee that,
27 | no matter how the wall is destroyed, he can still achieve a total beauty of
28 | at least B.
29 | What's the maximum value of B for which he can make this guarantee?
30 |
31 | Input
32 | -----
33 | The first line of the input gives the number of test cases, **T**.
34 | **T** test cases follow.
35 | Each test case starts with a line containing an integer **N**.
36 | Then, another line follows containing a string of **N** digits from 0 to 9.
37 | The i-th digit represents the beauty score of the i-th section of the wall.
38 |
39 | Output
40 | ------
41 | For each test case, output one line containing ``Case #x: y``,
42 | where ``x`` is the test case number (starting from 1) and ``y`` is
43 | the maximum beauty score that Thanh can guarantee that he can achieve,
44 | as described above.
45 |
46 | Limits
47 | ------
48 | 1 ≤ **T** ≤ 100.
49 |
50 | Small dataset
51 | -------------
52 | 2 ≤ **N** ≤ 100.
53 |
54 | Large dataset
55 | -------------
56 | For exactly 1 case, **N** = 5 × 10\ :sup:`6`;
57 | for the other **T** - 1 cases, 2 ≤ **N** ≤ 100.
58 |
59 | Sample
60 | ------
61 |
62 | ::
63 |
64 | Input Output
65 |
66 | 4 Case #1: 6
67 | 4 Case #2: 14
68 | 1332 Case #3: 7
69 | 4 Case #4: 31
70 | 9583
71 | 3
72 | 616
73 | 10
74 | 1029384756
75 |
76 | In the first sample case, Thanh can get a total beauty of 6, no matter how
77 | the wall is destroyed. On the first day, he can paint either section of wall
78 | with beauty score 3. At the end of the day, either the 1st section or
79 | the 4th section will be destroyed, but it does not matter which one.
80 | On the second day, he can paint the other section with beauty score 3.
81 |
82 | In the second sample case, Thanh can get a total beauty of 14,
83 | by painting the leftmost section of wall (with beauty score 9).
84 | The only section of wall that can be destroyed is the rightmost one,
85 | since the leftmost one is painted. On the second day,
86 | he can paint the second leftmost section with beauty score 5.
87 | Then the last unpainted section of wall on the right is destroyed.
88 | Note that on the second day, Thanh cannot choose to paint the third section of
89 | wall (with beauty score 8), since it is not adjacent to any other painted
90 | sections.
91 |
92 | In the third sample case, Thanh can get a total beauty of 7.
93 | He begins by painting the section in the middle (with beauty score 1).
94 | Whichever section is destroyed at the end of the day,
95 | he can paint the remaining wall at the start of the second day.
96 |
--------------------------------------------------------------------------------
/2014/Round A/Problem C/README.rst:
--------------------------------------------------------------------------------
1 | .. _Problem C. Addition:
2 | https://code.google.com/codejam/contest/3214486/dashboard#s=p2
3 |
4 | ======================
5 | `Problem C. Addition`_
6 | ======================
7 |
8 | Problem
9 | -------
10 | Six years ago, a robot, Bob, with infant's intelligence has been [sic]
11 | invented by an evil scientist, Alice.
12 |
13 | Now the robot is six years old and studies in primary school.
14 | Addition is the first operation he learned in math.
15 | Due to his strong reasoning ability,
16 | he could now conclude a+b=12 from a=2 and b=10.
17 |
18 | Alice wanted to test Bob's addition skills.
19 | Some equations were given to Bob in form [sic] of a=2, b=10, c=4,
20 | and Bob has to find out the answers of questions like a+b, a+c, etc.
21 |
22 | Alice checked Bob's answers one by one in the test papers,
23 | and no mistake has been found so far,
24 | but Alice lost the given equations after a cup of coffee poured on them [sic].
25 | However she has some of Bob's correct answers, e.g. a+b=12, a+c=6, c+d=5.
26 | She wants to continue with the checkable equations,
27 | e.g. b+d=11 could be concluded by a+b=12, a+c=6, c+d=5,
28 | and thus the question b+d is checkable.
29 |
30 | To prevent the artificial intelligence technology from being under the control
31 | of Alice, you disguised yourself as her assistant. Now Alice wants you to
32 | figure out which of the rest of questions [sic] are checkable and their
33 | answers [sic].
34 |
35 | Input
36 | -----
37 | The first line of the input gives the number of test cases, **T**.
38 | **T** test cases follow.
39 |
40 | The first line of each test case contains a single integer **N**:
41 | the number of correctly answered questions.
42 | Each of the next **N** lines contain [sic] one correctly answered question
43 | in the form "**x**\ +\ **y**\ =\ **z**",
44 | where **x** and **y** are names of variables and **z** is a decimal integer.
45 |
46 | The next line contains a single integer **Q**:
47 | the number of remaining questions.
48 | Each of the next **Q** lines contain [sic] one question in the form
49 | "**x**\ +\ **y**", where **x** and **y** are names of variables.
50 |
51 | Output
52 | ------
53 | For each test case, the first line of output contains "Case #\ **x**:",
54 | where **x** is the test case number (starting from 1).
55 | For each question in the input that was checkable,
56 | output a single line with the answer in the form "**x**\ +\ **y**\ =\ **z**",
57 | where **x** and **y** are names of variables and **z** is a decimal integer.
58 | Questions should be listed in the same order as they were given in the input.
59 | Please do **NOT** ignore duplicated questions,
60 | since Alice would fire you if you pointed [sic] any mistake of hers.
61 |
62 | Limits
63 | ------
64 | Names of variables are strings of lowercase English letters.
65 | Each name contains at most 10 characters.
66 |
67 | -200000 ≤ **z** ≤ 200000
68 |
69 | There is no contradiction in the answered questions
70 | and if the answer is checkable, the result is an integer.
71 |
72 | Small dataset
73 | -------------
74 | **T** ≤ 10
75 |
76 | **N** ≤ 10
77 |
78 | **Q** ≤ 10
79 |
80 | Large dataset
81 | -------------
82 | **T** ≤ 3
83 |
84 | **N** ≤ 5000
85 |
86 | **Q** ≤ 5000
87 |
88 | Sample
89 | ------
90 |
91 | ::
92 |
93 | Input Output
94 |
95 | 2 Case #1:
96 | 2 apple+banana=10
97 | apple+banana=10 apple+banana=10
98 | coconut+coconut=12 banana+apple=10
99 | 5 Case #2:
100 | apple+banana a+d=3
101 | apple+banana b+c=3
102 | apple+apple
103 | banana+apple
104 | peach+apple
105 | 3
106 | a+b=3
107 | b+c=3
108 | c+d=3
109 | 4
110 | a+c
111 | a+d
112 | b+c
113 | b+d
114 |
--------------------------------------------------------------------------------
/2018/Round H/Problem A/README.rst:
--------------------------------------------------------------------------------
1 | .. _Problem A. Big Buttons:
2 | https://codejam.withgoogle.com/codejam/contest/3324486/dashboard#s=p0
3 |
4 | =========================
5 | `Problem A. Big Buttons`_
6 | =========================
7 |
8 | Problem
9 | -------
10 | You are a contestant on a popular new game show
11 | and are playing for the grand prize!
12 |
13 | There are two big buttons, a red one and a black one.
14 | You will make a sequence of exactly **N** button presses.
15 |
16 | There are lots of different sequences of presses you could make,
17 | but there are **P** forbidden prefixes, each of length no greater than **N**.
18 | If you make a sequence of presses which begins with *any* of the forbidden
19 | sequences, you will not win the grand prize. It is fine for your sequence to
20 | contain one or more forbidden prefixes as long as they do not appear at the
21 | start of your sequence.
22 |
23 | A *winning* sequence must consist of exactly **N** button presses and must not
24 | begin with one of the forbidden prefixes.
25 | How many different winning sequences are there?
26 |
27 | Input
28 | -----
29 | The first line of the input gives the number of test cases, **T**. **T** test
30 | cases follow. Each test case starts with a line containing two integers **N**
31 | and **P**, as described above. Then, there are **P** more lines, each of which
32 | contains a string of between 1 and **N** characters, inclusive, describing one
33 | of the forbidden sequences of presses. An ``R`` represents pressing the red
34 | button, whereas a ``B`` represents pressing the black button.
35 |
36 | Output
37 | ------
38 | For each test case, output one line containing ``Case #x: y``,
39 | where ``x`` is the test case number (starting from 1)
40 | and ``y`` is the number of winning sequences, as desribed [sic] above.
41 |
42 | Limits
43 | ------
44 | | 1 ≤ **T** ≤ 100.
45 | | 1 ≤ **P** ≤ min(2\ |N|, 100).
46 | | Each forbidden prefix is between 1 and **N** characters long, inclusive.
47 | | No two forbidden prefixes will be the same.
48 |
49 | .. |N| raw:: html
50 |
51 | N
52 |
53 | Small dataset
54 | -------------
55 | 1 ≤ **N** ≤ 10.
56 |
57 | Large dataset
58 | -------------
59 | 1 ≤ **N** ≤ 50.
60 |
61 | Sample
62 | ------
63 |
64 | ::
65 |
66 | Input Output
67 |
68 | 4 Case #1: 5
69 | 3 2 Case #2: 16
70 | BBB Case #3: 0
71 | RB Case #4: 1125556309458944
72 | 5 1
73 | R
74 | 4 3
75 | R
76 | B
77 | RBRB
78 | 50 5
79 | BRBRBBBRBRRRBBB
80 | BRBRBRRRBRRRBRB
81 | BBBRBBBRBRRRBBB
82 | BRBRBRRRBRRRB
83 | BRBRBBBRBBBRB
84 |
85 | Note that the last Sample case would not appear in the Small dataset.
86 |
87 | In the first case, you must make a sequence of 3 presses.
88 | There are 8 possible sequences of three presses,
89 | but some of them will cause you to lose the game.
90 | They are listed below:
91 |
92 | - ``RBB``. This is forbidden since it starts with the first forbidden sequence (``RB``).
93 | - ``RBR``. This is forbidden since it starts with the first forbidden sequence (``RB``).
94 | - ``BBB``. This is forbidden since it starts with the second forbidden sequence (``BBB``).
95 |
96 | Thus, there are only 5 winning sequences.
97 |
98 | In the second case, you must make a sequence of 5 presses.
99 | There is only one forbidden sequence, which is ``R``.
100 | This means that the first press must be ``B``,
101 | and the next 4 presses can be either button.
102 | This gives a total of 16 different button presses.
103 |
104 | In the third case, you must make a sequence of 4 presses.
105 | There are three forbidden sequences,
106 | but since every possible sequence begins with either
107 | ``R`` (the first forbidden sequence) or ``B`` (the second forbidden sequence),
108 | there are no winning sequences. So the answer is 0.
109 |
--------------------------------------------------------------------------------
/2014/Round D/Problem B/README.rst:
--------------------------------------------------------------------------------
1 | .. _Problem B. GBus count:
2 | https://code.google.com/codejam/contest/6214486/dashboard#s=p1
3 |
4 | ========================
5 | `Problem B. GBus count`_
6 | ========================
7 |
8 | Problem
9 | -------
10 | There exist some cities that are built along a straight road.
11 | The cities are numbered 1, 2, 3... from left to right.
12 |
13 | There are **N** GBuses that operate along this road.
14 | For each GBus, we know the range of cities that it serves:
15 | the i-th gBus serves the cities with numbers between
16 | **A**\ |i| and **B**\ |i|, inclusive.
17 |
18 | .. |i| raw:: html
19 |
20 | i
21 |
22 | We are interested in a particular subset of **P** cities.
23 | For each of those cities, we need to find out how many GBuses serve that
24 | particular city.
25 |
26 | Input
27 | -----
28 |
29 | The first line of the input gives the number of test cases, **T**.
30 | Then, **T** test cases follow; each case is separated from the next by one
31 | |blank| line. (Notice that this is unusual for Kickstart data sets.)
32 |
33 | .. |blank| raw:: html
34 |
35 | blank
36 |
37 | In each test case:
38 |
39 | - The first line contains one integer **N**: the number of GBuses.
40 | - The second line contains 2\ **N** integers representing the ranges of cities
41 | that the buses serve, in the form **A**\ |1| **B**\ |1|
42 | **A**\ |2| **B**\ |2| **A**\ |3| **B**\ |3| ... **A**\ |N| **B**\ |N|.
43 | That is, the first GBus serves the cities numbered from
44 | **A**\ |1| to **B**\ |1| (inclusive), and so on.
45 | - The third line contains one integer **P**: the number of cities we are
46 | interested in, as described above. (Note that this is not necessarily the
47 | same as the total number of cities in the problem, which is not given.)
48 | - Finally, there are **P** more lines; the i-th of these contains the number
49 | **C**\ |i| of a city we are interested in.
50 |
51 | .. |1| raw:: html
52 |
53 | 1
54 |
55 | .. |2| raw:: html
56 |
57 | 2
58 |
59 | .. |3| raw:: html
60 |
61 | 3
62 |
63 | .. |N| raw:: html
64 |
65 | N
66 |
67 | Output
68 | ------
69 | For each test case, output one line containing ``Case #x: y``, where ``x`` is
70 | the number of the test case (starting from 1), and ``y`` is a list of **P**
71 | integers, in which the i-th integer is the number of GBuses that serve city
72 | **C**\ |i|.
73 |
74 | Limits
75 | ------
76 | 1 ≤ **T** ≤ 10.
77 |
78 | Small dataset
79 | -------------
80 | | 1 ≤ **N** ≤ 50
81 | | 1 ≤ **A**\ |i| ≤ 500, for all i.
82 | | 1 ≤ **B**\ |i| ≤ 500, for all i.
83 | | 1 ≤ **C**\ |i| ≤ 500, for all i.
84 | | 1 ≤ **P** ≤ 50.
85 |
86 | Large dataset
87 | -------------
88 | | 1 ≤ **N** ≤ 500.
89 | | 1 ≤ **A**\ |i| ≤ 5000, for all i.
90 | | 1 ≤ **B**\ |i| ≤ 5000, for all i.
91 | | 1 ≤ **C**\ |i| ≤ 5000, for all i.
92 | | 1 ≤ **P** ≤ 500.
93 |
94 | Sample
95 | ------
96 |
97 | |sample_start|
98 | Input\ |newline|
99 | 2
100 | 4
101 | 15 25 30 35 45 50 10 20
102 | 2
103 | 15
104 | 25\ |newline|
105 | 10
106 | 10 15 5 12 40 55 1 10 25 35 45 50 20 28 27 35 15 40 4 5
107 | 3
108 | 5
109 | 10
110 | 27\ |newline|
111 | |hr|\ Output\ |newline|
112 | Case #1: 2 1
113 | Case #2: 3 3 4\ |newline|
114 | |sample_end|
115 |
116 | .. |sample_start| raw:: html
117 |
118 |
119 |
120 | .. |newline| raw:: html
121 |
122 |
123 |
124 | .. |hr| raw:: html
125 |
126 |
127 |
128 | .. |sample_end| raw:: html
129 |
130 |
131 |
132 | In Sample Case #1, there are four GBuses.
133 | The first serves cities 15 through 25,
134 | the second serves cities 30 through 35,
135 | the third serves cities 45 through 50,
136 | and the fourth serves cities 10 through 20.
137 | City 15 is served by the first and fourth buses,
138 | so the first number in our answer list is 2.
139 | City 25 is served by only the first bus,
140 | so the second number in our answer list is 1.
141 |
--------------------------------------------------------------------------------
/2014/Round A/Problem B/README.rst:
--------------------------------------------------------------------------------
1 | .. _Problem B. Super 2048:
2 | https://code.google.com/codejam/contest/3214486/dashboard#s=p1
3 |
4 | ========================
5 | `Problem B. Super 2048`_
6 | ========================
7 |
8 | Problem
9 | -------
10 | 2048 is a famous single-player game in which the objective is to slide tiles
11 | on a grid to combine them and create a tile with the number 2048.
12 |
13 | 2048 is played on a simple 4 x 4 grid with tiles that slide smoothly when a
14 | player moves them. For each movement, the player can choose to move all tiles
15 | in 4 directions, left, right, up, and down, as far as possible at the same
16 | time. If two tiles of the same number collide while moving, they will merge
17 | into a tile with the total value of the two tiles that collided. **In one
18 | movement, one newly created tile can not be merged again and always is merged
19 | with the tile next to it along the moving direction first.** E.g. if the three
20 | "2" are in a row "2 2 2" and the player choose to move left, it will become
21 | "4 2 0", the most left 2 "2" are merged.
22 |
23 | .. image:: https://code.google.com/codejam/contest/images/?image=2048.png&p=5742336445251584&c=3214486
24 |
25 | The above figure shows how 4 x 4 grid varies when player moves all tiles
26 | 'right'.
27 |
28 | Alice and Bob accidentally find this game and love the feel when two tiles are
29 | merged. After a few round [sic], they start to be bored about the size of the
30 | board and decide to extend the size of board to **N** x **N**, which they
31 | called [sic] the game "Super 2048".
32 |
33 | The big board then makes them dazzled (no zuo no die -_-| ). They ask you to
34 | write a program to help them figure out what the board will be looked [sic]
35 | like after all tiles move to one specific direction on a given board.
36 |
37 | Input
38 | -----
39 | The first line of the input gives the number of test cases, **T**.
40 | **T** test cases follow. The first line of each test case gives the side
41 | length of the board, **N**, and the direction the tiles will move to, **DIR**.
42 | **N** and **DIR** are separated by a single space.
43 | **DIR** will be one of four strings: "left", "right", "up", or "down".
44 |
45 | The next **N** lines each contain **N** space-separated integers describing
46 | the original state of the board. Each line represents a row of the board
47 | (from top to bottom); each integer represents the value of a tile
48 | (or 0 if there is no number at that position).
49 |
50 | Output
51 | ------
52 | For each test case, output one line containing "Case #x:",
53 | where x is the test case number (starting from 1).
54 | Then output **N** more lines, each containing **N** space-separated integers
55 | which describe the board after the move in the same format as the input.
56 |
57 | Limits
58 | ------
59 | Each number in the grid is either 0 or a power of two between 2 and 1024,
60 | inclusive.
61 |
62 | Small dataset
63 | -------------
64 | | 1 ≤ **T** ≤ 20
65 | | 1 ≤ **N** ≤ 4
66 |
67 | Large dataset
68 | -------------
69 | | 1 ≤ **T** ≤ 100
70 | | 1 ≤ **N** ≤ 20
71 |
72 | Sample
73 | ------
74 |
75 | ::
76 |
77 | Input Output
78 |
79 | 3 Case #1:
80 | 4 right 0 0 4 4
81 | 2 0 2 4 0 2 4 2
82 | 2 0 4 2 0 4 4 8
83 | 2 2 4 8 0 0 4 8
84 | 2 2 4 4 Case #2:
85 | 10 up 4 0 0 0 0 0 0 0 0 0
86 | 2 0 0 0 0 0 0 0 0 0 4 0 0 0 0 0 0 0 0 0
87 | 2 0 0 0 0 0 0 0 0 0 4 0 0 0 0 0 0 0 0 0
88 | 2 0 0 0 0 0 0 0 0 0 4 0 0 0 0 0 0 0 0 0
89 | 2 0 0 0 0 0 0 0 0 0 4 0 0 0 0 0 0 0 0 0
90 | 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
91 | 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
92 | 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
93 | 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
94 | 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
95 | 2 0 0 0 0 0 0 0 0 0 Case #3:
96 | 3 right 0 2 4
97 | 2 2 2 0 4 8
98 | 4 4 4 0 8 16
99 | 8 8 8
100 |
--------------------------------------------------------------------------------
/2014/Round A/Problem A/README.rst:
--------------------------------------------------------------------------------
1 | .. _Problem A. Seven-segment Display:
2 | https://code.google.com/codejam/contest/3214486/dashboard#s=p0
3 |
4 | ===================================
5 | `Problem A. Seven-segment Display`_
6 | ===================================
7 |
8 | Problem
9 | -------
10 | Tom is a boy whose dream is to become a scientist,
11 | he invented a lot in his spare time.
12 | He came up with a great idea several days ago: to make a stopwatch by himself!
13 | So he bought a seven-segment display immediately.
14 |
15 | The seven elements of the display are all light-emitting diodes (LEDs) and
16 | can be lit in different combinations to represent the arabic numerals like:
17 |
18 | .. image:: https://code.google.com/codejam/contest/images/?image=digits_30.png&p=5768691975192576&c=3214486
19 |
20 | However, just when he finished the programs and tried to test the stopwatch,
21 | some of the LEDs turned out to be broken!
22 | Some of the segments can never be lit while others worked fine.
23 | So the display kept on producing some ambiguous states all the time...
24 |
25 | Tom has recorded a continuous sequence of states which were produced by the
26 | display and is curious about whether it is possible to understand what this
27 | display was doing. He thinks the first step is to determine the state which
28 | the display will show **next**, could you help him?
29 |
30 | Please note that the display works well despite those broken segments,
31 | which means that the display will keep on counting down **cyclically**
32 | starting from a certain number
33 | (can be any one of 0-9 since we don't know where this record starts from).
34 | 'Cyclically' here means that each time when the display reaches 0,
35 | it will keep on counting down starting from 9 again.
36 |
37 | For convenience, we refer [sic] the seven segments of the display by
38 | the letters A to G as the picture below:
39 |
40 | .. image:: https://code.google.com/codejam/contest/images/?image=marks_40.png&p=5768691975192576&c=3214486
41 |
42 | For example, if the record of states is like:
43 |
44 | .. image:: https://code.google.com/codejam/contest/images/?image=example_in_30.png&p=5768691975192576&c=3214486
45 |
46 | It's not that hard to figure out that ONLY segment B is broken
47 | and the sequence of states the display is trying to produce is simply
48 | "9 -> 8 -> 7 -> 6 -> 5". Then the next number should be 4,
49 | but considering of [sic] the brokenness of segment B,
50 | the next state should be:
51 |
52 | .. image:: https://code.google.com/codejam/contest/images/?image=example_out_30.png&p=5768691975192576&c=3214486
53 |
54 | Input
55 | -----
56 | The first line of the input gives the number of test cases, **T**.
57 | Each test case is a line containing an integer **N**
58 | which is the number of states Tom recorded
59 | and a list of the **N** states separated by spaces.
60 | Each state is encoded into a 7-character string represent [sic]
61 | the display of segment A-G, from the left to the right.
62 | Characters in the string can either be '1' or '0',
63 | denoting the corresponding segment is on or off, respectively.
64 |
65 | Output
66 | ------
67 | For each test case, output one line containing "Case #x: y",
68 | where x is the test case number (starting from 1).
69 | If the input unambiguously determines the next state of the display,
70 | y should be that next state (in the same format as the input).
71 | Otherwise, y should be "ERROR!".
72 |
73 | Limits
74 | ------
75 | 1 ≤ **T** ≤ 2000.
76 |
77 | Small dataset
78 | -------------
79 | 1 ≤ **N** ≤ 5.
80 |
81 | Large dataset
82 | -------------
83 | 1 ≤ **N** ≤ 100.
84 |
85 | Sample
86 | ------
87 |
88 | |sample_start|
89 | Input\ |newline|
90 | 4
91 | 1 1111111
92 | 2 0000000 0001010
93 | 3 0100000 0000111 0000011
94 | 5 1011011 1011111 1010000 1011111 1011011
95 | |hr|\ Output\ |newline|
96 | Case #1: 1110000
97 | Case #2: ERROR!
98 | Case #3: 0100011
99 | Case #4: 0010011\ |newline|
100 | |sample_end|
101 |
102 | .. |sample_start| raw:: html
103 |
104 |
105 |
106 | .. |newline| raw:: html
107 |
108 |
109 |
110 | .. |hr| raw:: html
111 |
112 |
113 |
114 | .. |sample_end| raw:: html
115 |
116 |
117 |
--------------------------------------------------------------------------------
/2016/Round B/Problem C/README.rst:
--------------------------------------------------------------------------------
1 | .. _Problem C. Watson and Intervals:
2 | https://code.google.com/codejam/contest/5254487/dashboard#s=p2
3 |
4 | ==================================
5 | `Problem C. Watson and Intervals`_
6 | ==================================
7 |
8 | Problem
9 | -------
10 | Sherlock and Watson have mastered the intricacies of the language C++ in their
11 | programming course, so they have moved on to algorithmic problems. In today's
12 | class, the tutor introduced the problem of merging one-dimensional intervals.
13 | **N** intervals are given, and the ``i``\ th interval is defined by the
14 | inclusive endpoints [**L**\ |i|\ **, R**\ |i|], where **L**\ |i| **≤ R**\ |i|.
15 |
16 | .. |i| raw:: html
17 |
18 | i
19 |
20 | The tutor defined the *covered area* of a set of intervals as the number of
21 | integers appearing in at least one of the intervals. (Formally, an integer p
22 | contributes to the covered area if there is some j such that
23 | **L**\ |j| ≤ ``p`` ≤ **R**\ |j|.)
24 |
25 | .. |j| raw:: html
26 |
27 | j
28 |
29 | Now, Watson always likes to challenge Sherlock. He has asked Sherlock to
30 | remove exactly one interval such that the covered area of the remaining
31 | intervals is minimized. Help Sherlock find this minimum possible covered area,
32 | after removing exactly one of the **N** intervals.
33 |
34 | Input
35 | -----
36 | Each test case consists of one line with eight integers **N**,
37 | **L**\ |1|\ **, R**\ |1|, **A**, **B**, **C**\ |1|, **C**\ |2|, and **M**.
38 | **N** is the number of intervals, and the other seven values are parameters
39 | that you should use to generate the other intervals, as follows:
40 |
41 | .. |1| raw:: html
42 |
43 | 1
44 |
45 | .. |2| raw:: html
46 |
47 | 2
48 |
49 | First define |x_1| = **L**\ |1| and |y_1| = **R**\ |1|.
50 | Then, use the recurrences below to generate |x_i, y_i| for
51 | ``i`` = 2 to **N**:
52 |
53 | .. |x_1| raw:: html
54 |
55 | x1
56 |
57 | .. |y_1| raw:: html
58 |
59 | y1
60 |
61 | .. |x_i, y_i| raw:: html
62 |
63 | xi, yi
64 |
65 | - |x_i| = ( **A**\*\ |x_i-1| + **B**\*\ |y_i-1| + **C**\ |1| ) modulo **M**.
66 | - |y_i| = ( **A**\*\ |y_i-1| + **B**\*\ |x_i-1| + **C**\ |2| ) modulo **M**.
67 |
68 | .. |x_i| raw:: html
69 |
70 | xi
71 |
72 | .. |y_i| raw:: html
73 |
74 | yi
75 |
76 | .. |x_i-1| raw:: html
77 |
78 | xi-1
79 |
80 | .. |y_i-1| raw:: html
81 |
82 | yi-1
83 |
84 | We define **L**\ |i| = |min(x_i, y_i)| and **R**\ |i| = |max(x_i, y_i)|,
85 | for all ``i`` = 2 to **N**.
86 |
87 | .. |min(x_i, y_i)| raw:: html
88 |
89 | min(xi, yi)
90 |
91 | .. |max(x_i, y_i)| raw:: html
92 |
93 | max(xi, yi)
94 |
95 | Output
96 | ------
97 | For each test case, output one line containing ``Case #x: y``, where ``x`` is
98 | the test case number (starting from 1) and ``y`` is the minimum possible
99 | covered area of all of the intervals remaining after removing exactly one
100 | interval.
101 |
102 | Limits
103 | ------
104 | | 1 ≤ **T** ≤ 50.
105 | | 0 ≤ **L**\ |1| ≤ **R**\ |1| ≤ |10^9|.
106 | | 0 ≤ **A** ≤ |10^9|.
107 | | 0 ≤ **B** ≤ |10^9|.
108 | | 0 ≤ **C**\ |1| ≤ |10^9|.
109 | | 0 ≤ **C**\ |2| ≤ |10^9|.
110 | | 1 ≤ **M** ≤ |10^9|.
111 |
112 | .. |10^9| replace:: 10\ :sup:`9`
113 |
114 | Small dataset
115 | -------------
116 | 1 ≤ **N** ≤ 1000.
117 |
118 | Large dataset
119 | -------------
120 | 1 ≤ **N** ≤ 5 * 10\ :sup:`5`\ (500000).
121 |
122 | Sample
123 | ------
124 |
125 | ::
126 |
127 | Input Output
128 |
129 | 3 Case #1: 0
130 | 1 1 1 1 1 1 1 1 Case #2: 4
131 | 3 2 5 1 2 3 4 10 Case #3: 9
132 | 4 3 4 3 3 8 10 10
133 |
134 | In case 1, using the generation method, the set of intervals generated are:
135 | {[1, 1]}. Removing the only interval, the covered area is 0.
136 |
137 | In case 2, using the generation method, the set of intervals generated are:
138 | {[2, 5], [3, 5], [4, 7]}. Removing the first, second or third interval would
139 | cause the covered area of remaining intervals to be 5, 6 and 4, respectively.
140 |
141 | In case 3, using the generation method, the set of intervals generated are:
142 | {[3, 4], [1, 9], [0, 8], [2, 4]}. Removing the first, second, third or fourth
143 | interval would cause the covered area of remaining intervals to be
144 | 10, 9, 9 and 10, respectively.
145 |
--------------------------------------------------------------------------------
/2016/Round E/Problem A/A-small-practice.in:
--------------------------------------------------------------------------------
1 | 100
2 | BBBRRBBRBBBRRBRRRRBRRBRBBBRRRR
3 | 4391 998016
4 | BRRRRRBRRRRBRRRRRRRRRRRBBRRRRRRRRRRRRBRRR
5 | 8125 997021
6 | RR
7 | 3031 995356
8 | RBBRRBRRRRRRBRRRRRRRRBRBRBRBRBBRRRBRRBRBBRRRBRRRRRRRBRRRRR
9 | 9911 990469
10 | B
11 | 1 1000000
12 | RRBBBBRBRBBRRBRRRRRRRBBRRRRRRRRBRRRRRR
13 | 4214 996987
14 | RBRRBRBRRBBRRBR
15 | 8502 996266
16 | RRBRBRRBRBRBBBBBBRRBBRRRRBBRRRRB
17 | 3925 997632
18 | BBRRBRBRBRBBBRRRBBRRBRRRRRRRRBRR
19 | 2108 996534
20 | BRBBBRRRBBBBRRRRRRBBRRRBRBRBBBRRBBBRBRRRBBRRBBRBBBBBBBBBBBRRRBRBRRRBRRBBBRRBBRBBRR
21 | 7275 994035
22 | RRRBBBRBBR
23 | 4787 996983
24 | RRRRRRBRRRRRRRRRRRRRRRRRRRRRBRRRRRBRRRRRRRBRRRRRRRRBBRRRRRRRRRRRRRRRRRRRRBRRRRRRBRRR
25 | 7587 998450
26 | BRRRRBBBBBBBRBRRRBRRBBRBBRRBRBRRBRBBRRRB
27 | 3721 999360
28 | BBBBBRBBBBBBBRBBBBBBBBRBBBBBBBBBBBBBBBBBBBBRBBBBBRBBBBBBRRBBBBRBBBBBBRBRBBRBBBRRBBBBRBRBBRBBBB
29 | 4840 995605
30 | BBRBBRBBBBBBBBRBRBRRRRBBBRBRBBRBBBBRRRBBBBBBBBBBBRRBRBBBRRRRBBBRRRBBBBRRRRRBRRBRRRBBRBBBRBBRBB
31 | 7723 995313
32 | RRBRRRBRBRRRRRBRRRRBRRRBBRRRBBBBRRRBRRBBBBRRRRRRB
33 | 2197 998434
34 | BRRRRRRRRRRBRRBBRBBRRBBBRRRRRRBRRBRBRBRRRRRRRRRRRRRRRRRRRRBBRRRBRRRR
35 | 8350 999732
36 | RBBRRBBBBRRBBBBBRBRRRRRBBRBBBBBBRBBBRBBBBBBRBBRRBBBRBBBBRR
37 | 6418 990811
38 | R
39 | 1 1
40 | RRRRRRRRRRRBRRRRRRBRRRRBRRRBRRB
41 | 1750 997395
42 | RRBBBRBBRBRBBBBBBRBBBRBBBBBBBRBRRBBBBBBBBBBBBB
43 | 2339 991478
44 | BRBRRBRRBBBRRRRRRRRRBBRRRRBRRRBRRRBRRRBRRBRRBR
45 | 4189 995049
46 | RBBRBBBBRBRBBBBBBBBBBBRRRBBRRRBRBBRRBBRBR
47 | 8558 991286
48 | BRBRBRRBBBRBR
49 | 2116 999543
50 | BBBRRRBRRRRRRRRBRBBRRRRRRBBRRRBRRRRRRBRRRRRRRBRRRRBRRRBBBBRBBBBRRBBRRR
51 | 1036 996615
52 | RRRRRRRRRRRRRBRRRRRRRRBBRRR
53 | 1408 998507
54 | BRBBBBBBRBRBRBBBRRRRBBRBRBBBBB
55 | 5973 996415
56 | BRRRRRRRRRRBRRRRRRR
57 | 3766 993396
58 | RRRRBBRRRBBRBBRRBRRRRRRRRBBBRBBRRRRBBBBRRBBRRBBRRRRRRBRRRBBRRBBRBRRRBRBRRRRRRRBRRBRRRRBRB
59 | 8468 990097
60 | RRRRRRBRBBRRRR
61 | 6070 997145
62 | BRBRRBRRRBBBBRRRBBBBRBRBRBRBRRBRBRRBBRBBBRRBRRBRRRBRBBBBRBBBBRBRRBBBRBRBBBRRBBRBBBBRRRRRBBBBBRBBRBRR
63 | 1 1000000
64 | RRBRRBBRBBBRBRBRBRBBRBRRBBBBRBRBRBBRBRRRRRRRRBRBBRRBBRRRRBRRRRRBRBRBBBBRRRRBBRRRRRRRRRBRBBRRR
65 | 301 997684
66 | BB
67 | 57 990541
68 | BRRBRRBRBRRRRBBRRRRRRRBBRRRRBRRRRRR
69 | 3501 999668
70 | RRBRBBRRRRRBBRBBRBBRRRBRRBRB
71 | 359 990123
72 | RBRBBBBRRBRBBBR
73 | 9122 995881
74 | RRRBRRBRBRRBRBRBBRRBBBRRBRRR
75 | 5253 992947
76 | RRR
77 | 8196 998732
78 | RBBRRRRRRRBBRRRRRRRRRRRRRRR
79 | 1764 998011
80 | RRRBBBBBRRBBRRR
81 | 1095 991670
82 | BBBBBRRBBBBRBRBBBRBBBBBBBRBBBBBBBBBBBBBBBBRBBBBB
83 | 266 996008
84 | BBBBBBBRBBBRBBBRRBBBRBBBBBBBBRBBBBBBRBRBBBBBRBBBBBBBRBBRBBBBBBBBBBBBBBBBBBBBBBBBBB
85 | 6720 994827
86 | BBRBBRRRBBRBBRRBRBBBBBRBRBBRBRRBRRBRBRBRBRBRRRBRBRRRRBRBBRRBBRRBRRBBR
87 | 6872 990986
88 | RBRBRRBBBBRRBRBRRRRRRRRRRBBRRRRBBBRRRBRRRRRRRRRRRRRRRBBRBRRRRRBRRRBRR
89 | 9712 994321
90 | RBRRRBRBBRBBBRRBRR
91 | 2674 997884
92 | BRBRRRRRRRBRRBRRBBBRBBRBBBRBBBRBBRRRBRRBBRRRRRBBRRR
93 | 3733 994916
94 | BBBBBRBBRRBRRRRRRRBBBBRBBBBRBRBBRRRRBBBBRBBBBRBBBBBRBRRBBBRRRBRRRRRRRBBRRBRBRBBBRRRBRBBBB
95 | 5356 990561
96 | BBBRBBRBRBRBRRBRBRBBRBRRBRRRBBBBRBBRBBRBBB
97 | 8306 997025
98 | RRBBRRRBBBRBBRRBBRBRBRBBRBBRRBBRBBBBBBRBBRRBRBRBBBRBRBRBB
99 | 6084 991649
100 | BBBRBBBRBBBBBRBBBBBRRRBBBBBBRBBBBBRBBBRBBBBBBBBRBBB
101 | 7635 992293
102 | BRBRRRRRBBRRRRBRRBRBRRBRBBRRBBRRBBRRBBRRRRB
103 | 4965 994719
104 | BBBRBBBBBRBBBBBBBBBBBRBBBBBBBBBBRBBRBBBBRBBBRBBBBBB
105 | 600 991365
106 | RRRBRRBRRRRBRBRRRRBRBRBBRRBBBRRB
107 | 1205 998927
108 | RRRRRRRRRRRRR
109 | 140 995975
110 | RBRRBBRRRRRBBRBBRRRRRRRBRRBRRBBBBBRRRBBRBRBRRBRBBBRBBRRRRRRRBBRRRRBBRRRR
111 | 2957 994647
112 | BRRRRRBRBRRRBBRRBRRBRBRRRRBRRRRRBBBBBBRBRRRRRBBBRRBBRRRRRRRBBBRBRRRRBBRBRRRRRBRRRR
113 | 6798 992546
114 | RRBBRBBBBBRBBBRRBRBRBBRBBRBBRRBBBRRBBBBBBBBBRBBBBBBRBRBRBBBBBBRBBRRBRBRBBBRRRRBBBBBRRBRBRRRRBBBRBBBB
115 | 6338 996066
116 | RRRRBBBBBBRBBBBBRRBRBBRRBRRRRBBBBRBRBRRBRBRRBBRBRBBBRBBBBRRRRBRRBRBBRRBBBR
117 | 1587 992620
118 | BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
119 | 1 1000000
120 | RBBRRRBBBBRBBBBBRBBBBBBRRRBB
121 | 7002 990913
122 | RRRRRRRRRBRRRRBBBBBBRBRBRBRBBRBBBR
123 | 128 998411
124 | RBRRBRBBBRBBBRBBRRBBBBBBBBBBBRRBBRRRRBBBBBBBRBRRBBBRBRBRBRRBBBBRRBBBRRBBRRRBBBRRRBRBBR
125 | 3846 994572
126 | B
127 | 7130 996217
128 | RBBRBRRRBBRBBBBBRBBBBRBBRBBBBBBBBRBBRBBBBRRBBRBRBBBBRRBBBRBBBRBBBRBBBBBBRBRRBBRBBBBRR
129 | 2382 990494
130 | BBBBBRBBBBBBBBRRRBBBBRBBBBBRBRBRBBBBBBRRBBBRBBBBBRBBRRBBBBRBBBBBRBRBBRBRBRRBBBBRBBB
131 | 764 991175
132 | RRRRRBRRRBRRRRRRRRRRBRBRRRRB
133 | 9872 996099
134 | BBRBBRRBBRBBBBBRRRBBBRBBBBRRRRBBRRBBBRRRBRBRRBBBBBBRBBR
135 | 958 990212
136 | RRRRRRBRRRRRRRRRRRRRRRRR
137 | 7637 990986
138 | RBRRRRBRRBBBRBRBRBBRBRRBRBBRRRBBRRRRBBRBRRBRRRRRRRR
139 | 9038 993183
140 | BBRRRRRRRRRRRBRBBRBRBRRRRBRRRBRBRBRBRRRRRRRBRRBRRRRRBBBRBRBBBRBRRRR
141 | 945 996405
142 | BBBRBBRBBRBBBBBBBBRBRBBBBBBBRBBBBBBBBBBBBBBBBBRBRBBRBBBBBBBBBBBRBRBBBRBBBBBBBBBBRBBBBBBBB
143 | 8707 994314
144 | BBBBBBBBB
145 | 7730 991815
146 | RBRBRBRRBRBBBRRRRBBBRBRRBBBRRRBRRRRBRRRBRBBBRBBBRBRBBBBBBRBBRRRRBBBRBBRBRBRRR
147 | 1040 991983
148 | RRBBBBBRRRBRBRBBRBRBBRRBBBRRBBBBRBBRBRBB
149 | 4660 994356
150 | RRRBRBBRRRRRRRBRBRBRRBBRRRRRBRBBBRBBBRRRRRBBRRBRR
151 | 602 991792
152 | BBBRBBBBBBBBBBBRBBRBBBBBBBBRBBBBRRBBBBBBBBBBBBBBBBBBBRBBBBBBBBBBBBBRBBBBBRBBBBRBBBBBBBRBBBBB
153 | 7425 999072
154 | BRBBBBBBBBBBBBBRBRBBBBBBBBRBBRRRBRRRBBRBRBRRBRBBRRRRBRRBBRBRRRBBBRBBBBRRBBBBBBBRBB
155 | 4463 990381
156 | RBBBBBBRBBRBBRRBRRBBRBRBB
157 | 6936 990968
158 | BBBBBBRBBBBRBBBBRBBBBBBBBBRBBBBBBBBBBBBBBRBBBBBBBBBBBBBBBBBBBBBBBBBRBBBRBBB
159 | 415 999400
160 | BRBRBRBRBBBBBBBBBBBBBBBBBBRBRBBBBBBBBRBRBBBBR
161 | 5752 990890
162 | RBBRBBRRR
163 | 8811 996330
164 | BBRBBBBB
165 | 7365 996931
166 | RRRRRBRRBBRRRRRRRRRRRRRBRRRRBRBRRRRRRBRBRRRRRRRRRBRRRRRRRRBR
167 | 3300 999285
168 | RBBBBRBBRRBBRBBBBBBBBBBBBBBBBRBBBRBBRBRBBBBBBBBBBRRBRBBBRRBRRRBBRBRRBRBR
169 | 2724 999702
170 | R
171 | 1 1000000
172 | RRRRRRRBRRBRRBRRRBBRBRRRBRRRRRBBRRRRRRRRBRRRRRRRBRRBBRRRRRRRBRRRRRBRRRBBRRRRRR
173 | 620 998061
174 | RRRBBRRRRBRBRBBRRBRBRBBBRRBRBRBRRRBBRRBRBBRBBB
175 | 5984 998478
176 | RRBRRRRBRBBBRRBRBRRRRRBRBRRRRRBBRBBRRRRBRRRRRBBBRBBRRRBRBBBRRRBBBBRBRBBBRRBR
177 | 7710 996798
178 | BRRBRRBBBBBBBB
179 | 5776 995886
180 | BRRRBRBRRBRBBRRBBBBBRRBBBBRBBRBBBBBRRRBRBBBBBBR
181 | 9262 994217
182 | BRRRRRBRRRRRRRRBRRRRRRRBRBRRRRRBBBRRRRRBRRR
183 | 4751 995313
184 | RRBBRRBRRRBBBRRBBRRBBRBRRBBBBBRRRRRRBBBRBBB
185 | 3227 991212
186 | BBBBBBRBBBBBBRBBBBBBBBBBBBBBRBBBBBBBBBRBBBBBBBBBBBBRBBBBBBBBBB
187 | 6756 991525
188 | RRBBBRBBBBRBRRBRRBBRRRBBBRRBBRBBBRBRRRBRRRBRRRBRRRRRRBRBRRRBBBBRRRRRRRRRRBBRRRRRRBRRRRRRBRRRRBRRBRRB
189 | 1 1000000
190 | B
191 | 1 1
192 | RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR
193 | 1 1000000
194 | BBBRBBBBBBBBBBBRBBBBBBBBRBRBBRBBBBBBB
195 | 6034 990729
196 | RRRBBRBRRBRBRBRRRRRBBBBBBRRBRRBRBRRBRBBRBRRBRBRRRRBRRBBBRRRRB
197 | 3223 998847
198 | BBBBBBBRBRRBBRRRBRBBBRBBBRB
199 | 7860 991878
200 | BRBBRBBBBBBBBBBBB
201 | 732 998145
202 |
--------------------------------------------------------------------------------
/2016/Round E/Problem A/A-large-practice.in:
--------------------------------------------------------------------------------
1 | 100
2 | BBBRRBBRBBBRRBRRRRBRRBRBBBRRRR
3 | 4391 999999999999998016
4 | BRRRRRBRRRRBRRRRRRRRRRRBBRRRRRRRRRRRRBRRR
5 | 8125 999999999999997021
6 | RR
7 | 3031 999999999999995356
8 | RBBRRBRRRRRRBRRRRRRRRBRBRBRBRBBRRRBRRBRBBRRRBRRRRRRRBRRRRR
9 | 9911 999999999999990469
10 | B
11 | 1 1000000000000000000
12 | RRBBBBRBRBBRRBRRRRRRRBBRRRRRRRRBRRRRRR
13 | 4214 999999999999996987
14 | RBRRBRBRRBBRRBR
15 | 8502 999999999999996266
16 | RRBRBRRBRBRBBBBBBRRBBRRRRBBRRRRB
17 | 3925 999999999999997632
18 | BBRRBRBRBRBBBRRRBBRRBRRRRRRRRBRR
19 | 2108 999999999999996534
20 | BRBBBRRRBBBBRRRRRRBBRRRBRBRBBBRRBBBRBRRRBBRRBBRBBBBBBBBBBBRRRBRBRRRBRRBBBRRBBRBBRR
21 | 7275 999999999999994035
22 | RRRBBBRBBR
23 | 4787 999999999999996983
24 | RRRRRRBRRRRRRRRRRRRRRRRRRRRRBRRRRRBRRRRRRRBRRRRRRRRBBRRRRRRRRRRRRRRRRRRRRBRRRRRRBRRR
25 | 7587 999999999999998450
26 | BRRRRBBBBBBBRBRRRBRRBBRBBRRBRBRRBRBBRRRB
27 | 3721 999999999999999360
28 | BBBBBRBBBBBBBRBBBBBBBBRBBBBBBBBBBBBBBBBBBBBRBBBBBRBBBBBBRRBBBBRBBBBBBRBRBBRBBBRRBBBBRBRBBRBBBB
29 | 4840 999999999999995605
30 | BBRBBRBBBBBBBBRBRBRRRRBBBRBRBBRBBBBRRRBBBBBBBBBBBRRBRBBBRRRRBBBRRRBBBBRRRRRBRRBRRRBBRBBBRBBRBB
31 | 7723 999999999999995313
32 | RRBRRRBRBRRRRRBRRRRBRRRBBRRRBBBBRRRBRRBBBBRRRRRRB
33 | 2197 999999999999998434
34 | BRRRRRRRRRRBRRBBRBBRRBBBRRRRRRBRRBRBRBRRRRRRRRRRRRRRRRRRRRBBRRRBRRRR
35 | 8350 999999999999999732
36 | RBBRRBBBBRRBBBBBRBRRRRRBBRBBBBBBRBBBRBBBBBBRBBRRBBBRBBBBRR
37 | 6418 999999999999990811
38 | R
39 | 1 1
40 | RRRRRRRRRRRBRRRRRRBRRRRBRRRBRRB
41 | 1750 999999999999997395
42 | RRBBBRBBRBRBBBBBBRBBBRBBBBBBBRBRRBBBBBBBBBBBBB
43 | 2339 999999999999991478
44 | BRBRRBRRBBBRRRRRRRRRBBRRRRBRRRBRRRBRRRBRRBRRBR
45 | 4189 999999999999995049
46 | RBBRBBBBRBRBBBBBBBBBBBRRRBBRRRBRBBRRBBRBR
47 | 8558 999999999999991286
48 | BRBRBRRBBBRBR
49 | 2116 999999999999999543
50 | BBBRRRBRRRRRRRRBRBBRRRRRRBBRRRBRRRRRRBRRRRRRRBRRRRBRRRBBBBRBBBBRRBBRRR
51 | 1036 999999999999996615
52 | RRRRRRRRRRRRRBRRRRRRRRBBRRR
53 | 1408 999999999999998507
54 | BRBBBBBBRBRBRBBBRRRRBBRBRBBBBB
55 | 5973 999999999999996415
56 | BRRRRRRRRRRBRRRRRRR
57 | 3766 999999999999993396
58 | RRRRBBRRRBBRBBRRBRRRRRRRRBBBRBBRRRRBBBBRRBBRRBBRRRRRRBRRRBBRRBBRBRRRBRBRRRRRRRBRRBRRRRBRB
59 | 8468 999999999999990097
60 | RRRRRRBRBBRRRR
61 | 6070 999999999999997145
62 | BRBRRBRRRBBBBRRRBBBBRBRBRBRBRRBRBRRBBRBBBRRBRRBRRRBRBBBBRBBBBRBRRBBBRBRBBBRRBBRBBBBRRRRRBBBBBRBBRBRR
63 | 1 1000000000000000000
64 | RRBRRBBRBBBRBRBRBRBBRBRRBBBBRBRBRBBRBRRRRRRRRBRBBRRBBRRRRBRRRRRBRBRBBBBRRRRBBRRRRRRRRRBRBBRRR
65 | 301 999999999999997684
66 | BB
67 | 57 999999999999990541
68 | BRRBRRBRBRRRRBBRRRRRRRBBRRRRBRRRRRR
69 | 3501 999999999999999668
70 | RRBRBBRRRRRBBRBBRBBRRRBRRBRB
71 | 359 999999999999990123
72 | RBRBBBBRRBRBBBR
73 | 9122 999999999999995881
74 | RRRBRRBRBRRBRBRBBRRBBBRRBRRR
75 | 5253 999999999999992947
76 | RRR
77 | 8196 999999999999998732
78 | RBBRRRRRRRBBRRRRRRRRRRRRRRR
79 | 1764 999999999999998011
80 | RRRBBBBBRRBBRRR
81 | 1095 999999999999991670
82 | BBBBBRRBBBBRBRBBBRBBBBBBBRBBBBBBBBBBBBBBBBRBBBBB
83 | 266 999999999999996008
84 | BBBBBBBRBBBRBBBRRBBBRBBBBBBBBRBBBBBBRBRBBBBBRBBBBBBBRBBRBBBBBBBBBBBBBBBBBBBBBBBBBB
85 | 6720 999999999999994827
86 | BBRBBRRRBBRBBRRBRBBBBBRBRBBRBRRBRRBRBRBRBRBRRRBRBRRRRBRBBRRBBRRBRRBBR
87 | 6872 999999999999990986
88 | RBRBRRBBBBRRBRBRRRRRRRRRRBBRRRRBBBRRRBRRRRRRRRRRRRRRRBBRBRRRRRBRRRBRR
89 | 9712 999999999999994321
90 | RBRRRBRBBRBBBRRBRR
91 | 2674 999999999999997884
92 | BRBRRRRRRRBRRBRRBBBRBBRBBBRBBBRBBRRRBRRBBRRRRRBBRRR
93 | 3733 999999999999994916
94 | BBBBBRBBRRBRRRRRRRBBBBRBBBBRBRBBRRRRBBBBRBBBBRBBBBBRBRRBBBRRRBRRRRRRRBBRRBRBRBBBRRRBRBBBB
95 | 5356 999999999999990561
96 | BBBRBBRBRBRBRRBRBRBBRBRRBRRRBBBBRBBRBBRBBB
97 | 8306 999999999999997025
98 | RRBBRRRBBBRBBRRBBRBRBRBBRBBRRBBRBBBBBBRBBRRBRBRBBBRBRBRBB
99 | 6084 999999999999991649
100 | BBBRBBBRBBBBBRBBBBBRRRBBBBBBRBBBBBRBBBRBBBBBBBBRBBB
101 | 7635 999999999999992293
102 | BRBRRRRRBBRRRRBRRBRBRRBRBBRRBBRRBBRRBBRRRRB
103 | 4965 999999999999994719
104 | BBBRBBBBBRBBBBBBBBBBBRBBBBBBBBBBRBBRBBBBRBBBRBBBBBB
105 | 600 999999999999991365
106 | RRRBRRBRRRRBRBRRRRBRBRBBRRBBBRRB
107 | 1205 999999999999998927
108 | RRRRRRRRRRRRR
109 | 140 999999999999995975
110 | RBRRBBRRRRRBBRBBRRRRRRRBRRBRRBBBBBRRRBBRBRBRRBRBBBRBBRRRRRRRBBRRRRBBRRRR
111 | 2957 999999999999994647
112 | BRRRRRBRBRRRBBRRBRRBRBRRRRBRRRRRBBBBBBRBRRRRRBBBRRBBRRRRRRRBBBRBRRRRBBRBRRRRRBRRRR
113 | 6798 999999999999992546
114 | RRBBRBBBBBRBBBRRBRBRBBRBBRBBRRBBBRRBBBBBBBBBRBBBBBBRBRBRBBBBBBRBBRRBRBRBBBRRRRBBBBBRRBRBRRRRBBBRBBBB
115 | 6338 999999999999996066
116 | RRRRBBBBBBRBBBBBRRBRBBRRBRRRRBBBBRBRBRRBRBRRBBRBRBBBRBBBBRRRRBRRBRBBRRBBBR
117 | 1587 999999999999992620
118 | BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
119 | 1 1000000000000000000
120 | RBBRRRBBBBRBBBBBRBBBBBBRRRBB
121 | 7002 999999999999990913
122 | RRRRRRRRRBRRRRBBBBBBRBRBRBRBBRBBBR
123 | 128 999999999999998411
124 | RBRRBRBBBRBBBRBBRRBBBBBBBBBBBRRBBRRRRBBBBBBBRBRRBBBRBRBRBRRBBBBRRBBBRRBBRRRBBBRRRBRBBR
125 | 3846 999999999999994572
126 | B
127 | 7130 999999999999996217
128 | RBBRBRRRBBRBBBBBRBBBBRBBRBBBBBBBBRBBRBBBBRRBBRBRBBBBRRBBBRBBBRBBBRBBBBBBRBRRBBRBBBBRR
129 | 2382 999999999999990494
130 | BBBBBRBBBBBBBBRRRBBBBRBBBBBRBRBRBBBBBBRRBBBRBBBBBRBBRRBBBBRBBBBBRBRBBRBRBRRBBBBRBBB
131 | 764 999999999999991175
132 | RRRRRBRRRBRRRRRRRRRRBRBRRRRB
133 | 9872 999999999999996099
134 | BBRBBRRBBRBBBBBRRRBBBRBBBBRRRRBBRRBBBRRRBRBRRBBBBBBRBBR
135 | 958 999999999999990212
136 | RRRRRRBRRRRRRRRRRRRRRRRR
137 | 7637 999999999999990986
138 | RBRRRRBRRBBBRBRBRBBRBRRBRBBRRRBBRRRRBBRBRRBRRRRRRRR
139 | 9038 999999999999993183
140 | BBRRRRRRRRRRRBRBBRBRBRRRRBRRRBRBRBRBRRRRRRRBRRBRRRRRBBBRBRBBBRBRRRR
141 | 945 999999999999996405
142 | BBBRBBRBBRBBBBBBBBRBRBBBBBBBRBBBBBBBBBBBBBBBBBRBRBBRBBBBBBBBBBBRBRBBBRBBBBBBBBBBRBBBBBBBB
143 | 8707 999999999999994314
144 | BBBBBBBBB
145 | 7730 999999999999991815
146 | RBRBRBRRBRBBBRRRRBBBRBRRBBBRRRBRRRRBRRRBRBBBRBBBRBRBBBBBBRBBRRRRBBBRBBRBRBRRR
147 | 1040 999999999999991983
148 | RRBBBBBRRRBRBRBBRBRBBRRBBBRRBBBBRBBRBRBB
149 | 4660 999999999999994356
150 | RRRBRBBRRRRRRRBRBRBRRBBRRRRRBRBBBRBBBRRRRRBBRRBRR
151 | 602 999999999999991792
152 | BBBRBBBBBBBBBBBRBBRBBBBBBBBRBBBBRRBBBBBBBBBBBBBBBBBBBRBBBBBBBBBBBBBRBBBBBRBBBBRBBBBBBBRBBBBB
153 | 7425 999999999999999072
154 | BRBBBBBBBBBBBBBRBRBBBBBBBBRBBRRRBRRRBBRBRBRRBRBBRRRRBRRBBRBRRRBBBRBBBBRRBBBBBBBRBB
155 | 4463 999999999999990381
156 | RBBBBBBRBBRBBRRBRRBBRBRBB
157 | 6936 999999999999990968
158 | BBBBBBRBBBBRBBBBRBBBBBBBBBRBBBBBBBBBBBBBBRBBBBBBBBBBBBBBBBBBBBBBBBBRBBBRBBB
159 | 415 999999999999999400
160 | BRBRBRBRBBBBBBBBBBBBBBBBBBRBRBBBBBBBBRBRBBBBR
161 | 5752 999999999999990890
162 | RBBRBBRRR
163 | 8811 999999999999996330
164 | BBRBBBBB
165 | 7365 999999999999996931
166 | RRRRRBRRBBRRRRRRRRRRRRRBRRRRBRBRRRRRRBRBRRRRRRRRRBRRRRRRRRBR
167 | 3300 999999999999999285
168 | RBBBBRBBRRBBRBBBBBBBBBBBBBBBBRBBBRBBRBRBBBBBBBBBBRRBRBBBRRBRRRBBRBRRBRBR
169 | 2724 999999999999999702
170 | R
171 | 1 1000000000000000000
172 | RRRRRRRBRRBRRBRRRBBRBRRRBRRRRRBBRRRRRRRRBRRRRRRRBRRBBRRRRRRRBRRRRRBRRRBBRRRRRR
173 | 620 999999999999998061
174 | RRRBBRRRRBRBRBBRRBRBRBBBRRBRBRBRRRBBRRBRBBRBBB
175 | 5984 999999999999998478
176 | RRBRRRRBRBBBRRBRBRRRRRBRBRRRRRBBRBBRRRRBRRRRRBBBRBBRRRBRBBBRRRBBBBRBRBBBRRBR
177 | 7710 999999999999996798
178 | BRRBRRBBBBBBBB
179 | 5776 999999999999995886
180 | BRRRBRBRRBRBBRRBBBBBRRBBBBRBBRBBBBBRRRBRBBBBBBR
181 | 9262 999999999999994217
182 | BRRRRRBRRRRRRRRBRRRRRRRBRBRRRRRBBBRRRRRBRRR
183 | 4751 999999999999995313
184 | RRBBRRBRRRBBBRRBBRRBBRBRRBBBBBRRRRRRBBBRBBB
185 | 3227 999999999999991212
186 | BBBBBBRBBBBBBRBBBBBBBBBBBBBBRBBBBBBBBBRBBBBBBBBBBBBRBBBBBBBBBB
187 | 6756 999999999999991525
188 | RRBBBRBBBBRBRRBRRBBRRRBBBRRBBRBBBRBRRRBRRRBRRRBRRRRRRBRBRRRBBBBRRRRRRRRRRBBRRRRRRBRRRRRRBRRRRBRRBRRB
189 | 1 1000000000000000000
190 | B
191 | 1 1
192 | RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR
193 | 1 1000000000000000000
194 | BBBRBBBBBBBBBBBRBBBBBBBBRBRBBRBBBBBBB
195 | 6034 999999999999990729
196 | RRRBBRBRRBRBRBRRRRRBBBBBBRRBRRBRBRRBRBBRBRRBRBRRRRBRRBBBRRRRB
197 | 3223 999999999999998847
198 | BBBBBBBRBRRBBRRRBRBBBRBBBRB
199 | 7860 999999999999991878
200 | BRBBRBBBBBBBBBBBB
201 | 732 999999999999998145
202 |
--------------------------------------------------------------------------------
/2018/Round H/Problem B/B-small-attempt1.in:
--------------------------------------------------------------------------------
1 | 100
2 | 4
3 | 1332
4 | 4
5 | 9583
6 | 3
7 | 616
8 | 10
9 | 1029384756
10 | 98
11 | 12231141312113434434132233334443121324232122411113121111242214422133433324344411333413421141232313
12 | 92
13 | 55838488486585647737476537736533677585545456677378587846756358686744778858487678555757334364
14 | 100
15 | 3333332322222233323233232222223333323223233222333323322323232232223333222232233332233232232322322223
16 | 95
17 | 46654345344645536565354364546633345563535633363534356535536365453653436436354553456446366364536
18 | 7
19 | 9000555
20 | 90
21 | 663364546454535443554456433653635645534463636445363446634553656644445363454654456463665356
22 | 98
23 | 84467645563767569798935734977763888839863435859683673653635478843385647494434676988848775937875676
24 | 100
25 | 0987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321
26 | 3
27 | 211
28 | 96
29 | 684677774545343678455655494897833374998389463958466578358938773587688946749643543798838989747843
30 | 96
31 | 426433536133163442647722656336671215436551056422760334530013327720142347226014571642025646501772
32 | 100
33 | 9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
34 | 95
35 | 88594494494989666465874847647665689477857698467999666754948944764875784754755896887754787594877
36 | 95
37 | 36373388757838833865228287466263722676863347763574322664367526866877468822425626277466232633627
38 | 99
39 | 354445545434354545553433444444334334443454544333333343444443345355543433553534434444353535343454343
40 | 99
41 | 445444556466456644664455445466465645464565654655554454646545566545546556564454544465454664664565466
42 | 90
43 | 111112222111111111211122212222111111112211221121221121212112221211211111121211112211122222
44 | 97
45 | 6128555116128138654464417146851464451886375562856261736256682275362312172261276613487234262564384
46 | 94
47 | 2322233223332323322332232233322223222323222333332323322222333232233223333223233322232333332222
48 | 100
49 | 4346635755556636476534544436774673354367344375736667474464753376557466377676573457474474336533744463
50 | 3
51 | 112
52 | 91
53 | 7879798898978787788878977898978897777889978787979979898799978777988778979879998799899779789
54 | 99
55 | 337545556497959967936649376945377897734438539656364387368485543656388955994468436348363385353985438
56 | 93
57 | 565665655665565655666566666656555655556555666656665565566555655565565556565656666655655666666
58 | 99
59 | 444444444433333433443434444434434444444434334433334444343433334333333434344343444433444333344344344
60 | 94
61 | 6557676555655765656756776676665757765676655556665765577757757775667757675565567775566556565667
62 | 90
63 | 231322132313113321223131231323313232123223122113213211131311223132233223131112332212113233
64 | 3
65 | 110
66 | 2
67 | 00
68 | 2
69 | 01
70 | 100
71 | 4953256839924268983128257329172588911844921879697236587419133852756321531654483444469681533479411622
72 | 100
73 | 6293757398575767754219117727978878249583834948484995335726418411197978591415693874949211861377858264
74 | 90
75 | 443653274222622445324572647227766776346233276335435522533255327473357645645577743666277327
76 | 93
77 | 866548788574688745844484645546484746878845474858565745675455548578877474776446456665587646456
78 | 98
79 | 14350352010501243532542504325335325304041533540005100552502510350245253151122554044401311035103010
80 | 95
81 | 54344848435834873538448658768658877644576634463848684337744374838667635476574878585548347865558
82 | 97
83 | 6724532362437344764654262473327426645267252476432462666626636564426622664773756336755657772345237
84 | 90
85 | 453434445535535333455344353545543445343434534343345433545434533443535455433345544434433355
86 | 100
87 | 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
88 | 93
89 | 552223434352552533544522243242524235453424332544353235245253254352335445233422252224335452433
90 | 94
91 | 0000101010100011101101101100100101010000101111101111001101001100000000010000010000101101110101
92 | 91
93 | 5794499843798748775954565396968836835638334746794598883934783444873834856597769479936368558
94 | 97
95 | 8999898998988899998889888899998988899999888988989998889898888899889899998988898888888989889988989
96 | 91
97 | 1101101111111010100100101000001100111111011111001010011101111010000101111010010000001000100
98 | 97
99 | 2324222221000512610531062031222142601625214164422202600035210325310250130255136310020451623623663
100 | 97
101 | 3412311232443355255221433353216321361626451646123546132252515654545251323461213423265542421323165
102 | 100
103 | 0000000000111111111122222222223333333333444444444444444444443333333333222222222211111111110000000000
104 | 100
105 | 7643635563547635744567553453343456534653764453733374575753356653463437563334663647557735455634666655
106 | 94
107 | 2221012212022220000221211211212101121102221011102011002220201220001220010122221222220102002210
108 | 90
109 | 976969777976868969878678978978679999867689697987887889666669999679887979897976676988796986
110 | 98
111 | 37364657575374654657464757446346364456367657737755644355566353344666546457476665336655736566675643
112 | 90
113 | 887878766688788678766787667677778776876886866867677777667886676786767667686768888788777687
114 | 100
115 | 3234312245362634666413211551434351312635426363161321511164526344453622323655242654541213464466213442
116 | 97
117 | 4756696866555985557764989955579876659794789878758557748949865786579577669588955465889669454894776
118 | 100
119 | 7317321575460422231733170344143376306660423527167301171224763055142142415270477165412132757763521425
120 | 2
121 | 10
122 | 97
123 | 1231232344211343413312433341112131324233321121311244111321442112231143114232421222332344234334143
124 | 91
125 | 2636246774588762433246353645637768225325372778262344474668866472483355387874534428347636327
126 | 98
127 | 22122330221300312022222000300202002003030001231312312321221022000012213101131002120333021233011322
128 | 97
129 | 3563637553645453553445645447463456535763377335465675367655376676773556537545575566667337555573533
130 | 96
131 | 111001100011011001110000010010100000111001010010101010100110100000110100111011001000000010000011
132 | 90
133 | 644111067943681607851204617467653056614245769705452863329020561996389143541521223235216801
134 | 98
135 | 45445445445445454455455555444544545445544444544545444554554545544544545444445455544444455454445455
136 | 91
137 | 1122134242321413122434314214113221444343211142143334424213213331112141124234312142424223324
138 | 94
139 | 7178806421578251566436661875772233523684831008016443433606800634370273006173664442858753122767
140 | 15
141 | 222229888888811
142 | 98
143 | 56464454977454677958968948754687843363858456984348578484953567776799468795798958697754836333769999
144 | 95
145 | 01123322011103000212031120132102030000021221330131001100320023231221033200120310321111002201133
146 | 97
147 | 6666677777677667776676776676667777767667667777677776676767666777676766666777666666667667677776776
148 | 91
149 | 4044211231030403422431214213331224233431041442040111441410201422204402230201111030012123210
150 | 95
151 | 64434644355446665664443245625465625645356435223265453546346325324624366363322326344642243545465
152 | 90
153 | 332213321123321312112222131111113111311321122112123212333222212133311222123113123131321311
154 | 100
155 | 5488655747663846643373657467734444543544464875687858736866654484567643765767578853784448687473744378
156 | 98
157 | 37747766436435345777677867376643533776588748435836787536837737354348664754343476883543443885543777
158 | 92
159 | 22122112122211111221211122122121111211111111212111222212121211122121112121121212121111122111
160 | 99
161 | 533423278427628786673257832638325738754372272542862846245846644725856284288335342657262837235288486
162 | 92
163 | 31421434331123423423113311343223221333112334433421424331141123324333344124421313212234432322
164 | 94
165 | 4455445454444445554455444445544454455554454455444454554545544544555545445545455544544455545555
166 | 91
167 | 1123224442142413341123134244233123414211133112432311233312423344313114312323222233122313133
168 | 3
169 | 001
170 | 91
171 | 1221122212212112221211112122221211111222211122221211121212121221211122211121121122121212212
172 | 94
173 | 9878887788898777777887778889789899789888778797887999979779888988787977779879798898977787999799
174 | 100
175 | 1426937929453968597355354835543194517848842965573327454443554267875178831546871123776155739616775782
176 | 94
177 | 2333232223223232223322322332233333333233322323333322323232222332222233322223333333333222332332
178 | 98
179 | 02210000001022000010021011210222022202010022002212010200011112102212112112100121022201111101012012
180 | 100
181 | 8898998999898999988899888889899998999899889999889899889888989988888888899999999989888898889898888898
182 | 96
183 | 898666968989866777966699977976699769876867977766666877889698996766699766888799666997787797679696
184 | 5
185 | 19091
186 | 94
187 | 3232332222233332233322332322322323333223332222233232233332332323222333332233233222323322233222
188 | 98
189 | 76777767776767767666676677676766666666777776666777676667676667767777666777766666676666776777676676
190 | 92
191 | 78889988898988987899787997878989979788988887899788877798878997988978788978899988879987887888
192 | 100
193 | 0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
194 | 100
195 | 2111342142444213332421143232222234421233343114242113414214443321444343341223311344324413114214413422
196 | 3
197 | 011
198 | 90
199 | 543534354335355444533453345554333533335445535345543343443445355334354354534555554544535344
200 | 97
201 | 6846733564648453836853754866776747648468457888575886647486866536358887448487765858456587374433345
202 |
--------------------------------------------------------------------------------
/2018/Round H/Problem B/B-small-practice.in:
--------------------------------------------------------------------------------
1 | 100
2 | 4
3 | 1332
4 | 4
5 | 9583
6 | 3
7 | 616
8 | 10
9 | 1029384756
10 | 100
11 | 5323554121646233545624165556536142253331541461224246515413314131516646124633213431346351255243331622
12 | 99
13 | 455444566555466566645555446654446645544466564464544454554445556455455565554666466446666556455565464
14 | 100
15 | 8146222400584477547444645330888382832055768748617402632036323537474514622646180855452850113020323540
16 | 100
17 | 7889889787989877877798877787999788877788877899977898979877998989997877788998778899999898987778779779
18 | 96
19 | 543734335643443746776364663767454646746674746646563745475635776446736574363735437646376576576766
20 | 97
21 | 9776898669688678877978999796969999867868689988798967676986677688688787687778679967969999987776667
22 | 99
23 | 446665666646774474775475456545456746567544744564567644646544664476565655556455744655464756676454454
24 | 96
25 | 023021202322102332031333302211132231212322332313230123002232321333031211321121300332123203022210
26 | 94
27 | 0111021213030223300013132113232100210121302010201101220330201101012112313303110212033203303231
28 | 100
29 | 0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
30 | 2
31 | 01
32 | 91
33 | 7776577576557656756676656665777667676657565575665775757577766675577767755565675556557765576
34 | 90
35 | 323223322232323322223222222333322223232233323332223333323322323332233332332332333232233323
36 | 95
37 | 24381571534455554044625166584221175474524508821882265011847822224660774327683602056047767837682
38 | 93
39 | 334333223332332242433234424242424322322444343433223223234342432342344443322243343243444434234
40 | 99
41 | 001011011100010001011000011001100111000010010100011010000101111001111010000010011111111000110000110
42 | 100
43 | 0000000000111111111122222222223333333333444444444444444444443333333333222222222211111111110000000000
44 | 98
45 | 56755577755566575775556655665776675565776556775666557676767576577566657667755555565655767566767557
46 | 90
47 | 411444412411101021232202014101044424334142422203334142044300401201313014320441410022201142
48 | 3
49 | 001
50 | 97
51 | 7073032024264045651352045752676471317266033302550665465745742325542467347524574207450154705257740
52 | 99
53 | 875746466547738487846752222223674422425844445476658547364322877667345367365577767435462453676727873
54 | 98
55 | 85444127332737773217663237744627671467254576741238532813236133385464355517147378125444723175888646
56 | 90
57 | 465544564546645565655454446646654566465545454655566666556456545456556566565655664545555454
58 | 99
59 | 777667666776766767767677676676677767767677777676667676666676777776666666766677676677667666776766667
60 | 94
61 | 3223323332222233332322222223332223222322233232232232323232332323232323332232233233333332222323
62 | 93
63 | 254868627873676453453428538228868852383532523746853877277377673842646465387864325887444263566
64 | 7
65 | 9000555
66 | 90
67 | 333322222233333232322232322232333232222222323232232322223332233332222333223322222322322323
68 | 90
69 | 989988998888999977998887977979799897777978989778989988877799888977788877889989989987778979
70 | 100
71 | 4158623592164742623718731234773298171561946968622936536775213367341513925653868867586747868165538114
72 | 99
73 | 788556958433785675889436549657994995878599897797833888995484843766676835956456437893445498598664797
74 | 98
75 | 66567564746556545546666777575556565565446547744666776445475547646475565656456564776654566464756556
76 | 90
77 | 123421131213431342432234422241414322212344134122143212322243444224332224122431123132113132
78 | 90
79 | 555556656666566556556666556565666555565666566556666655566656565665555566666555555565656655
80 | 100
81 | 6646664454576657655666575554744456465656675545767557457746547474667776677646775774664556456665455547
82 | 92
83 | 43313142355413312545541511233444355114342514315342152353211241321234151541525325223441531142
84 | 92
85 | 33222332243334224442343334234432222424334242243424232242224322444434332242442242333222242243
86 | 91
87 | 1313122131231122101300133131021001111313330301032323112320320332310332020303310221211323021
88 | 95
89 | 56665655655665555665655556555565566655665556565665566656556565555556655655555655655665665655665
90 | 91
91 | 0926540569408491500406257298020839379734245123462915645745892786124763154342941434950275899
92 | 91
93 | 4544444445444445545445445445445455445544554444554555445545454545455544445544545554555445454
94 | 96
95 | 444345523253542522444424342322434224425334242235453323552354544322234533545224423552434334435423
96 | 96
97 | 363126366661145161215541422166321751661467651172177337674676653542272577441456577652423232417156
98 | 99
99 | 697569795686567678799596898567766687789696776856686689656796969788975779699875777666557655898699759
100 | 95
101 | 53254635645566372254377767733476377356664347225553537742552643543664656746742425564347466637256
102 | 98
103 | 55435154315335422161242333621233333342231442326345616254412554115452246311323655456336666533422342
104 | 96
105 | 363176638488847758511663444861861785423678414571611765254266232345328626623634684862672548344132
106 | 96
107 | 899898988989888998889999899899898988899999998899899989899988888898889998899988989989888899888988
108 | 90
109 | 222221223323233121322311122112123112133212313231223111213312231113121213113113112121112312
110 | 100
111 | 6549657556865847769894859486454969776845858869684969565574556476948465895697896988744955479765498888
112 | 100
113 | 4522895119696263656669497222516794646992955642477379527639476359938337777754421719812343884255452475
114 | 98
115 | 67669999768878698878969788886689779699787996979967876899677686986798777768889897898777979878787878
116 | 100
117 | 5337436354365563553567736645543377535564335537757575434465337556445463374675377336744343476457577763
118 | 97
119 | 7787767678687667868766686687777866767767868787686778877776676877877866867888687786876877867666866
120 | 5
121 | 19091
122 | 92
123 | 14323322234122423323322433213322132344431423334321231142343144223424434441324113333434442341
124 | 95
125 | 33242525174775745431276231145712772217676723671164476332156314371511473234157651554144644154661
126 | 91
127 | 7568857856676887666585585765758865788887868877578865777758885787885777578558565785777777878
128 | 100
129 | 0987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321
130 | 93
131 | 586734277386625614159447374819768414744733915148542623416262659879531775193983841419561889197
132 | 3
133 | 110
134 | 100
135 | 4538676143939961618762447419166999729191762183663836211827952686433324423989341616957325653176653626
136 | 90
137 | 443412304430214101001031200140044021401342120210022121214432004110123223301130304220203221
138 | 100
139 | 3334223444233234324234433334444342324243434423332344332233323242323342444224244223333423342244243224
140 | 99
141 | 521856127226747762154272573543328860161704325402420144513572476523464773660424438027003158585514482
142 | 92
143 | 22452476546654366472272774733662634754264642626757226753226347427665553672723642345566227257
144 | 15
145 | 222229888888811
146 | 95
147 | 99898798887988887777778898997987999787889998888988979977788788787979779799777988898989887787997
148 | 90
149 | 264756664212272347525662217214722555652333257761165217252762273535232312645425147666672625
150 | 99
151 | 779899789778787979979788887977979998988877988798888979989789779798887797897778889977898988788979889
152 | 97
153 | 1214514123231545144445525532553222412313451552252413552111115345214551515251441412151352313111243
154 | 100
155 | 7677537657525657522734555726265233224746437342454352635432755663575573225326626463533464765323232272
156 | 91
157 | 7056140657617184943661559185488847512833749767170600011188172550497449249865884832280331311
158 | 100
159 | 1634575867515726767418641447852738121646536215163756665884123835526837471784327268161254251313788366
160 | 3
161 | 011
162 | 99
163 | 121333222412421142424141221311443242243312333133313344221434213232111342213341324414344312443212441
164 | 100
165 | 7267448573423756875513556258268671652843267646557664411788537253571884367315231236676162746653145855
166 | 2
167 | 00
168 | 98
169 | 97586858678955966978658868887959596796876678799798995655759968579659697888859665786897778596958786
170 | 90
171 | 959778667864848879859498556946978447756976689979957496488665678759796888656545676658758684
172 | 100
173 | 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
174 | 100
175 | 9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
176 | 99
177 | 115241431141255444323245154514435354542452532354334425343344113552211132215421142112511442151533335
178 | 93
179 | 441535543123475226421352121711744346717114163447664547323113743647454154634337176766471156217
180 | 96
181 | 000210210021110000112110122210221120210121110210012100012111200022120010121001102211220120011000
182 | 2
183 | 10
184 | 3
185 | 112
186 | 99
187 | 546546654446555464444544445545455456565544444464466564455666555555456444664444555664645566554464465
188 | 90
189 | 676777766667676667776776677776767666776766667677766766766767677667667766677777676666667776
190 | 92
191 | 77667666666767676667767677776666766676676666677767677677666767777767777767767777776767777676
192 | 97
193 | 3136416161252533514132441342153551531321634114666264562614242635662666213325214333353255232146431
194 | 3
195 | 211
196 | 91
197 | 5765766657656777876887857668858555686578557877758775766575655778855886855577687876876685588
198 | 97
199 | 2112221211121112122121121111212111211121211111122121122212122121122122111121221111122211112112211
200 | 91
201 | 1863444112371167567647277416124315567783848552186752857757663576746834467152888511644427824
202 |
--------------------------------------------------------------------------------