Datasets:

Modalities:
Image
Text
Formats:
parquet
Size:
< 1K
Tags:
code
Libraries:
Datasets
pandas
License:
wjomlex commited on
Commit
718fd53
1 Parent(s): c623d8c

2014 Problems

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +3 -0
  2. 2014/finals/fortunate_wheels.html +56 -0
  3. 2014/finals/fortunate_wheels.in +0 -0
  4. 2014/finals/fortunate_wheels.md +89 -0
  5. 2014/finals/fortunate_wheels.out +155 -0
  6. 2014/finals/intervals_of_love.html +56 -0
  7. 2014/finals/intervals_of_love.in +3 -0
  8. 2014/finals/intervals_of_love.md +65 -0
  9. 2014/finals/intervals_of_love.out +20 -0
  10. 2014/finals/lunch_at_facebook.html +43 -0
  11. 2014/finals/lunch_at_facebook.in +3 -0
  12. 2014/finals/lunch_at_facebook.md +51 -0
  13. 2014/finals/lunch_at_facebook.out +27 -0
  14. 2014/finals/tours.html +115 -0
  15. 2014/finals/tours.in +3 -0
  16. 2014/finals/tours.md +86 -0
  17. 2014/finals/tours.out +25 -0
  18. 2014/quals/basketball_game.html +73 -0
  19. 2014/quals/basketball_game.in +523 -0
  20. 2014/quals/basketball_game.md +74 -0
  21. 2014/quals/basketball_game.out +30 -0
  22. 2014/quals/square_detector.html +28 -0
  23. 2014/quals/square_detector.in +343 -0
  24. 2014/quals/square_detector.md +34 -0
  25. 2014/quals/square_detector.out +25 -0
  26. 2014/quals/tennison.html +44 -0
  27. 2014/quals/tennison.in +93 -0
  28. 2014/quals/tennison.md +41 -0
  29. 2014/quals/tennison.out +92 -0
  30. 2014/round1/aaaaaa.html +52 -0
  31. 2014/round1/aaaaaa.in +0 -0
  32. 2014/round1/aaaaaa.md +47 -0
  33. 2014/round1/aaaaaa.out +50 -0
  34. 2014/round1/coins_game.html +28 -0
  35. 2014/round1/coins_game.in +32 -0
  36. 2014/round1/coins_game.md +53 -0
  37. 2014/round1/coins_game.out +31 -0
  38. 2014/round1/labelmaker.html +34 -0
  39. 2014/round1/labelmaker.in +54 -0
  40. 2014/round1/labelmaker.md +33 -0
  41. 2014/round1/labelmaker.out +53 -0
  42. 2014/round1/preventing_alzheimers.html +50 -0
  43. 2014/round1/preventing_alzheimers.in +113 -0
  44. 2014/round1/preventing_alzheimers.md +60 -0
  45. 2014/round1/preventing_alzheimers.out +56 -0
  46. 2014/round2/holdem_numbers.html +45 -0
  47. 2014/round2/holdem_numbers.in +0 -0
  48. 2014/round2/holdem_numbers.md +49 -0
  49. 2014/round2/holdem_numbers.out +0 -0
  50. 2014/round2/magic_pairs.html +59 -0
.gitattributes CHANGED
@@ -55,3 +55,6 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
55
  *.webp filter=lfs diff=lfs merge=lfs -text
56
  2012/finals/possible_medians.in filter=lfs diff=lfs merge=lfs -text
57
  2013/finals/archiver.in filter=lfs diff=lfs merge=lfs -text
 
 
 
 
55
  *.webp filter=lfs diff=lfs merge=lfs -text
56
  2012/finals/possible_medians.in filter=lfs diff=lfs merge=lfs -text
57
  2013/finals/archiver.in filter=lfs diff=lfs merge=lfs -text
58
+ 2014/finals/intervals_of_love.in filter=lfs diff=lfs merge=lfs -text
59
+ 2014/finals/lunch_at_facebook.in filter=lfs diff=lfs merge=lfs -text
60
+ 2014/finals/tours.in filter=lfs diff=lfs merge=lfs -text
2014/finals/fortunate_wheels.html ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <p>
2
+ Kit is competing on the popular game show, Fortunate Wheels. On this show, there is a secret word <b>S</b> consisting only of uppercase letters, known only to the host. Contestants can pay points to buy sequences of letters in hopes of matching part of S and earning more points! This show is clearly a scam, as the probability of earning more points than are spent is extremely low. Fortunately, Kit has come prepared -- he knows the secret word! Even so, getting as many points as possible will not be easy.
3
+ </p>
4
+
5
+ <p>
6
+ There are <b>N</b> <i>basic deals</i> which contestants can take. The <i>i</i>th deal costs <b>A<sub>i</sub></b> points, and allows the contestant to purchase any sequence of <b>B<sub>i</sub></b> letters. Furthermore, deals can be combined to purchase longer sequences! Combining a deal with cost <b>C<sub>1</sub></b> and length <b>L<sub>1</sub></b> with another deal (potentially the same one) with cost <b>C<sub>2</sub></b> and length <b>L<sub>2</sub></b> creates a new deal with cost <b>C<sub>1</sub></b> + <b>C<sub>2</sub></b> + <b>W</b> and length <b>L<sub>1</sub></b> + <b>L<sub>2</sub></b> (as long as <b>L<sub>1</sub></b> + <b>L<sub>2</sub></b> &lt; |<n>S</b>|), which can in turn be used to create even bigger deals. For example, if W = 0, then a basic deal with cost and length equal to 1 could be combined with itself repeatedly to yield a new deal with both cost and length equal to any positive integer up to (but not including) |<b>S</b>|.
7
+ </p>
8
+
9
+ <p>
10
+ Once Kit purchases a sequence of letters using one (potentially non-basic) deal, it will be matched against
11
+ the secret word -- twice! The host will spin the First Fortunate Wheel to select the starting index in <b>S</b> for the
12
+ first matching, which is chosen at uniform random such that the sequence will fit entirely within <b>S</b>. Then,
13
+ the host will spin the Second Fortunate Wheel to select the starting index for the second matching, which is
14
+ chosen at uniform random such that the sequence will fit entirely within <b>S</b> and such that the value given by
15
+ the First Fortunate Wheel will not be repeated. For example, if the purchased sequence consists of a single letter, the
16
+ First Fortunate Wheel might yield any of the indices in <b>S</b> with probability (1 / |<b>S</b>|) each, and then the Second
17
+ Fortunate Wheel might yield any of the remaining indices with probability (1 / (|<b>S</b>|-1)) each. On the other hand,
18
+ if the sequence has length |<b>S</b>| − 1, then the First Wheel can yield either 0 or 1, and the Second Wheel must yield the other. If, for both generated indices, the sequence miraculously happens to be equal to the substring of <b>S</b> of the same length starting at that index, then Kit will earn back <b>Y</b>(|<b>S</b>| - |<b>X</b> − <b>&#x2113;</b>|)<sup>2</sup> + <b>Z</b> points, where <b>&#x2113;</b> is the length of the sequence. If even one letter is off in either matching, however, Kit will earn no points at all!
19
+ </p>
20
+
21
+ <p>
22
+ Kit is carefully considering his first turn of the game. He obviously wants to maximize the number of points he’ll gain, but worries that choosing the very best move might be suspicious. As such, he’d like to find the expected point values of the <b>M</b> best distinct moves before making his decision. Two moves are distinct iff they involve purchasing different sequences of letters - the deals used are ignored. Note that moves can have negative expected point values, due to the costs of deals.
23
+ </p>
24
+
25
+ <h3>Input</h3>
26
+ <p>
27
+ Input begins with an integer <T>, the number of test cases. Each test case begins with a line containing six integers, <b>N</b>, <b>M</b>, <b>W</b>, <b>X</b>, <b>Y</b>, <b>Z</b>. The next line contains the string <b>S</b>. The next <b>N</b> lines each contain two integers, <b>A<sub>i</sub></b> and <b>B<sub>i</sub></b>.
28
+ </p>
29
+
30
+ <h3>Output</h3>
31
+ <p>
32
+ For each test case <i>i</i>, output "Case #i: " followed by a space-separated list of real numbers, the <b>M</b> largest expected point values which can be earned, in order. Round these values off to 3 decimal places.
33
+ </p>
34
+
35
+ <h3>Constraints</h3>
36
+ <p>
37
+ 1 &le; <b>T</b> &le; 20 <br/>
38
+ 2 &le; |<b>S</b>| &le; 10<sup>5</sup> <br/>
39
+ 1 &le; <b>N</b> &le; 20 <br/>
40
+ 1 &le; <b>A<sub>i</sub></b> &le; 10<sup>4</sup> <br/>
41
+ 1 &le; <b>B<sub>i</sub></b> &lt; |<b>S</b>| <br/>
42
+ 0 &le; <b>W</b> &le; 10<sup>4</sup> <br/>
43
+ 1 &le; <b>X</b> &lt; |<b>S</b>| <br/>
44
+ 0 &le; <b>Y</b> &le; 100 <br/>
45
+ 0 &le; <b>Z</b> &le; 100 <br/>
46
+ 1 &le; <b>M</b> &le; 20 <br/>
47
+ </p>
48
+
49
+ <h3>Explanation of Sample</h3>
50
+ <p>
51
+ In the first test case, Kit’s best move is to use the basic deal, costing 2 points, to purchase the sequence "Z". No matter what pair of indices the two Fortunate Wheels yield, this sequence will match and earn Kit 5(2 - |1 - 1|)<sup>2</sup> + 6 = 26 points. Any other sequence shorter than |<b>S</b>| cannot match at even a single index, so Kit’s second- and third-best moves consist of using the basic deal to purchase any other single-letter sequence, and simply losing the 2 points.
52
+ </p>
53
+
54
+ <p>
55
+ In the second test case, Kit’s best move consists of combining the third basic deal with itself to yield a deal with cost 5 and length 4, and then purchasing the sequence "OXEN". His three next-best moves, which are the only other moves which get him a positive expected point value, involve using the third basic deal to purchase the sequences "OX", "XE", and "EN".
56
+ </p>
2014/finals/fortunate_wheels.in ADDED
The diff for this file is too large to render. See raw diff
 
2014/finals/fortunate_wheels.md ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Kit is competing on the popular game show, Fortunate Wheels. On this show,
2
+ there is a secret word **S** consisting only of uppercase letters, known only
3
+ to the host. Contestants can pay points to buy sequences of letters in hopes
4
+ of matching part of S and earning more points! This show is clearly a scam, as
5
+ the probability of earning more points than are spent is extremely low.
6
+ Fortunately, Kit has come prepared -- he knows the secret word! Even so,
7
+ getting as many points as possible will not be easy.
8
+
9
+ There are **N** _basic deals_ which contestants can take. The _i_th deal costs
10
+ **Ai** points, and allows the contestant to purchase any sequence of **Bi**
11
+ letters. Furthermore, deals can be combined to purchase longer sequences!
12
+ Combining a deal with cost **C1** and length **L1** with another deal
13
+ (potentially the same one) with cost **C2** and length **L2** creates a new
14
+ deal with cost **C1** \+ **C2** \+ **W** and length **L1** \+ **L2** (as long
15
+ as **L1** \+ **L2** < |S**|), which can in turn be used to create even bigger
16
+ deals. For example, if W = 0, then a basic deal with cost and length equal to
17
+ 1 could be combined with itself repeatedly to yield a new deal with both cost
18
+ and length equal to any positive integer up to (but not including) |**S**|.
19
+
20
+ Once Kit purchases a sequence of letters using one (potentially non-basic)
21
+ deal, it will be matched against the secret word -- twice! The host will spin
22
+ the First Fortunate Wheel to select the starting index in **S** for the first
23
+ matching, which is chosen at uniform random such that the sequence will fit
24
+ entirely within **S**. Then, the host will spin the Second Fortunate Wheel to
25
+ select the starting index for the second matching, which is chosen at uniform
26
+ random such that the sequence will fit entirely within **S** and such that the
27
+ value given by the First Fortunate Wheel will not be repeated. For example, if
28
+ the purchased sequence consists of a single letter, the First Fortunate Wheel
29
+ might yield any of the indices in **S** with probability (1 / |**S**|) each,
30
+ and then the Second Fortunate Wheel might yield any of the remaining indices
31
+ with probability (1 / (|**S**|-1)) each. On the other hand, if the sequence
32
+ has length |**S**| − 1, then the First Wheel can yield either 0 or 1, and the
33
+ Second Wheel must yield the other. If, for both generated indices, the
34
+ sequence miraculously happens to be equal to the substring of **S** of the
35
+ same length starting at that index, then Kit will earn back **Y**(|**S**| -
36
+ |**X** − **ℓ**|)2 \+ **Z** points, where **ℓ** is the length of the sequence.
37
+ If even one letter is off in either matching, however, Kit will earn no points
38
+ at all!
39
+
40
+ Kit is carefully considering his first turn of the game. He obviously wants to
41
+ maximize the number of points he’ll gain, but worries that choosing the very
42
+ best move might be suspicious. As such, he’d like to find the expected point
43
+ values of the **M** best distinct moves before making his decision. Two moves
44
+ are distinct iff they involve purchasing different sequences of letters - the
45
+ deals used are ignored. Note that moves can have negative expected point
46
+ values, due to the costs of deals.
47
+
48
+ ### Input
49
+
50
+ Input begins with an integer , the number of test cases. Each test case begins
51
+ with a line containing six integers, **N**, **M**, **W**, **X**, **Y**, **Z**.
52
+ The next line contains the string **S**. The next **N** lines each contain two
53
+ integers, **Ai** and **Bi**.
54
+
55
+ ### Output
56
+
57
+ For each test case _i_, output "Case #i: " followed by a space-separated list
58
+ of real numbers, the **M** largest expected point values which can be earned,
59
+ in order. Round these values off to 3 decimal places.
60
+
61
+ ### Constraints
62
+
63
+ 1 ≤ **T** ≤ 20
64
+ 2 ≤ |**S**| ≤ 105
65
+ 1 ≤ **N** ≤ 20
66
+ 1 ≤ **Ai** ≤ 104
67
+ 1 ≤ **Bi** < |**S**|
68
+ 0 ≤ **W** ≤ 104
69
+ 1 ≤ **X** < |**S**|
70
+ 0 ≤ **Y** ≤ 100
71
+ 0 ≤ **Z** ≤ 100
72
+ 1 ≤ **M** ≤ 20
73
+
74
+ ### Explanation of Sample
75
+
76
+ In the first test case, Kit’s best move is to use the basic deal, costing 2
77
+ points, to purchase the sequence "Z". No matter what pair of indices the two
78
+ Fortunate Wheels yield, this sequence will match and earn Kit 5(2 - |1 - 1|)2
79
+ \+ 6 = 26 points. Any other sequence shorter than |**S**| cannot match at even
80
+ a single index, so Kit’s second- and third-best moves consist of using the
81
+ basic deal to purchase any other single-letter sequence, and simply losing the
82
+ 2 points.
83
+
84
+ In the second test case, Kit’s best move consists of combining the third basic
85
+ deal with itself to yield a deal with cost 5 and length 4, and then purchasing
86
+ the sequence "OXEN". His three next-best moves, which are the only other moves
87
+ which get him a positive expected point value, involve using the third basic
88
+ deal to purchase the sequences "OX", "XE", and "EN".
89
+
2014/finals/fortunate_wheels.out ADDED
@@ -0,0 +1,155 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Case #1: 24.000 -2.000 -2.000
2
+ Case #2: 7.056 3.491 3.491 3.491
3
+ Case #3: 0.833 0.833 -2.000 -2.000 -2.000
4
+ Case #4: 70.200 70.200 21.100 21.100 -2.000
5
+ Case #5: 156.571 156.571 80.286 80.286 24.667
6
+ Case #6: -2402.000 -2402.000 -2402.000 -2402.000 -2402.000 -2402.000 -2402.000 -2402.000 -2402.000 -2402.000 -2402.000 -2402.000 -2402.000 -2402.000 -2402.000 -2402.000 -2402.000 -2402.000 -2402.000
7
+ Case #7: 461397439636.000 461387457483.000 461387455721.000 461377471914.000 461377470483.000 461367488546.000 461367488215.000 461357506717.000 461357504985.000 461347521502.000
8
+ Case #8: -781.000 -781.000 -781.000 -781.000 -781.000 -781.000
9
+ Case #9: 54984546.643 51124920.797 50872605.657 49496029.178 48506741.615 48138333.423 46799518.394 46077213.642 44531490.835 44061189.145 43826974.534 40164426.006 666366.275 666366.275 596117.543 542728.507 529771.519
10
+ Case #10: 196.485 104.918 104.918 104.918 104.918 28.612 28.612 28.612 28.612 28.612 28.612 28.612 28.612 28.612 28.612 28.612
11
+ Case #11: 7221339.359 7221339.359
12
+ Case #12: -120.653 -120.653 -120.653 -133.000
13
+ Case #13: 8771448.706 7634326.913 7371668.851 7150191.822 7077116.597 7040719.694 7040719.694 7040719.694 7004416.598 6896070.147 6788567.955 6752921.504 6752921.504 6401616.346 6401616.346 6195335.962
14
+ Case #14: 728295186.528 723184860.602 721273126.975 713651493.892 707331056.955 706070343.092 691341187.859 689783393.077 672148720.404 10061159.314 9873839.659 9836586.594 9762291.331
15
+ Case #15: -60.000 -60.000 -60.000 -60.000 -60.000 -60.000 -60.000 -60.000
16
+ Case #16: 24170066037.239 23935575942.756 23888258685.318 23857666583.349 23238963805.693 1041901472.147 1023391896.929 991399310.524 987435958.423
17
+ Case #17: -550.710 -550.710 -550.710 -550.710 -550.710 -550.710 -550.710 -550.710 -550.710 -550.710 -550.710 -550.710 -550.710 -644.000 -644.000 -644.000 -644.000 -644.000 -644.000
18
+ Case #18: -1727.000 -1727.000 -1727.000 -1727.000 -1727.000 -1727.000 -1727.000 -1727.000 -1727.000 -1727.000 -1727.000 -1727.000 -1727.000 -1727.000 -1727.000
19
+ Case #19: -4311.000 -4311.000 -4311.000 -4311.000 -4311.000 -4311.000 -4311.000 -4311.000 -4311.000 -4311.000 -4311.000
20
+ Case #20: -106.000 -106.000 -106.000 -106.000 -106.000 -106.000 -106.000 -106.000 -106.000 -106.000 -106.000 -106.000 -106.000 -106.000 -106.000 -106.000 -106.000 -106.000
21
+ Case #21: 191967180.542 189928238.558 181422394.813 179592467.731
22
+ Case #22: 9536.114 7422.212 7422.212 5432.658 3567.451 3567.451 3567.451 1826.591 1826.591 1826.591 1826.591 210.078 210.078 210.078 210.078 210.078 210.078 210.078 210.078
23
+ Case #23: 8118631428.000 8117934228.000 8117925698.000 8117232319.000 8117232179.000 8116543550.000 8116542239.000 8115852189.000 8115837910.000 8115145973.000 8115137688.000 8114447453.000 8114441465.000 8113751505.000 8113741903.000 8113047073.000 8113041122.000
24
+ Case #24: 368147588.335 364910674.291 362090099.216 357280287.034 355285690.060 355285690.060 354290485.271 353694032.381 350125867.285 349532931.809 348940498.821 345200092.111 343239552.635 339919448.962 337391433.387 334872853.414 1860234.039 1774631.144
25
+ Case #25: 10366193237.398 9934586344.948 9804890976.809 9670622446.663 698446499.090 666266346.506 663421566.039
26
+ Case #26: 199815.176 191453.128 183265.289
27
+ Case #27: -5334.000
28
+ Case #28: 3845114.424 3762437.196 3680656.684 3664408.188 3519785.809 3488042.058 3456441.781 3456441.781 3456441.781 3393671.652 3362501.799 3362501.799 3362501.799 3362501.799 3346970.675
29
+ Case #29: 177910571851.309 177623847377.732 44725998783.001 44586280009.805 44228006820.763 44228006820.763
30
+ Case #30: -2175.000 -2175.000 -2175.000 -2175.000 -2175.000 -2175.000 -2175.000 -2175.000 -2175.000 -2175.000 -2175.000 -2175.000 -2175.000 -2175.000 -2175.000
31
+ Case #31: 46981516695.000 46979439396.000 46979437928.000 46977363921.000 46977359117.000 46975282642.000 46975282594.000 46973206213.000 46973204074.000 46971129830.000 46971123261.000 46969047970.000 46969047595.000
32
+ Case #32: 142755136.756 142332852.943 140230816.226 139394379.969 135764388.908 135558407.293 134736044.556 134325801.422 134223338.371 133302930.105 133302930.105 133200857.986 131573020.737 130965161.914 130762855.051 129652962.464 129552297.696 127946978.081
33
+ Case #33: -1501.000 -1501.000 -1501.000 -1501.000
34
+ Case #34: 20991291497.274 20678722510.866 20554077881.306 2383574924.957 2366837494.801 2309637737.912 2309179293.497
35
+ Case #35: -946.531 -946.531 -946.531 -946.531 -1033.000 -1033.000 -1033.000 -1033.000
36
+ Case #36: 13540613161.926 13484452208.391 13378260621.988
37
+ Case #37: 14872603813.696 14838843352.297 14681801753.468 14587977797.152 14574598926.024
38
+ Case #38: 455561.962 424882.931 366689.467 357400.782 357400.782
39
+ Case #39: 33527245.691 33279623.848 33180832.095 32689076.040 32493401.552 32347031.160 32249634.459 32200991.176 31813166.543 31523839.969 31235835.023 29815634.726 29675431.936 29675431.936 29210475.577 28428475.150 28200494.180 28155008.121 165030.529
40
+ Case #40: 519353402725.000 519339807695.000 519339803177.000 519326207551.000 519326206559.000
41
+ Case #41: 2953440.258 2898338.950 2870982.772 2683119.724 2683119.724 2683119.724 2683119.724 2656800.746 2630611.419 2630611.419 2630611.419 2604551.741 2604551.741 2578621.714 2552821.337 2527150.610 2501609.533
42
+ Case #42: -1333.000 -1333.000 -1333.000 -1333.000 -1333.000 -1333.000 -1333.000 -1333.000 -1333.000 -1333.000 -1333.000 -1333.000 -1333.000 -1333.000 -1333.000 -1333.000
43
+ Case #43: -1483.000 -1483.000 -1483.000 -1483.000 -1483.000 -1483.000 -1483.000 -1483.000
44
+ Case #44: 931.812 536.374 536.374 360.624 360.624 360.624 360.624 360.624 360.624 360.624 360.624 360.624 199.520 199.520 199.520
45
+ Case #45: -707.000 -707.000 -707.000 -707.000 -707.000 -707.000 -707.000 -707.000 -707.000 -707.000 -707.000 -707.000 -707.000
46
+ Case #46: -253.000 -253.000 -253.000 -253.000 -253.000 -253.000 -253.000 -253.000 -253.000 -253.000
47
+ Case #47: 557428139.383 550686817.324 547666602.512 544654692.599 541651087.585 540651731.446 540318817.792 538323488.993 529060758.690 526100523.702 524459537.245 518573209.629 516293053.565 514992362.893 514017921.451 513693312.696 3140032.656
48
+ Case #48: 369043241.638 368275457.859 356854640.833 355596765.291 354341110.574 352086528.564 350337939.427 344623222.513 334065240.596 5891440.250 5384652.837 5322903.670 5230946.276 5139788.512 5079460.908 5079460.908 5049430.378 5049430.378 5019488.695 5019488.695
49
+ Case #49: 7703.023 7703.023 6615.464 5591.880 5591.880 5591.880 5591.880 5591.880 5591.880 4632.270 4632.270 4632.270 4632.270 4632.270 4632.270 4632.270 4632.270
50
+ Case #50: 1689293.383 1652731.168 1643652.964 1634599.700 1625571.377 1625571.377 1625571.377 1625571.377 1616567.994 1607589.550 1607589.550 1598636.047 1598636.047 1580803.862 1580803.862 1580803.862 1580803.862 1571925.179 1545438.772 1545438.772
51
+ Case #51: 3022297032.367 3009194197.480 3006577046.257
52
+ Case #52: 468647.121 435858.872 429441.744 429441.744 423071.456 423071.456 416748.008 416748.008 416748.008 416748.008 410471.400 404241.633 404241.633 404241.633 398058.706 398058.706
53
+ Case #53: 1755308.091 1660440.260 1641782.920 1623230.989 1623230.989
54
+ Case #54: 288297818.077 286426404.620 282495653.972 278592061.237 278182736.562 277978187.069
55
+ Case #55: 646031.295 632719.208 619544.358 619544.358 606506.746 580843.237 580843.237 580843.237 568217.340 568217.340 555728.680 555728.680 543377.259
56
+ Case #56: -3689.027 -3689.027 -3689.027 -3689.027 -3689.027 -3689.027 -3689.027 -3689.027 -3689.027 -3689.027 -3689.027 -3689.027 -3689.027 -3689.027
57
+ Case #57: 134728441049.000 134723926605.000 134723922367.000 134719412237.000 134719404383.000 134714868367.000 134714862351.000 134710349913.000 134710348135.000 134705833995.000 134705814049.000 134701296369.000
58
+ Case #58: 482260409783.000 482249209505.000 482249208094.000 482238016094.000 482238013272.000 482226816076.000 482226811934.000
59
+ Case #59: 516519936585.000 516507240048.000 516507238882.000 516494546419.000 516494543667.000
60
+ Case #60: 53264720233.930 52729063258.348 13648286750.036 13648286750.036 12989189367.307 12723355893.407 3636516125.507 3636516125.507 3568797020.124 3568797020.124 3257835135.875 3194752171.242 2880067358.442 2815157969.410 1053636864.383 972292918.106 950971775.462 920235278.883 897910409.906
61
+ Case #61: 10144.054 3993.218 3993.218 3993.218 3993.218 3993.218 3993.218 3993.218 3993.218 3993.218
62
+ Case #62: 11869156.020 7439833.851 7402596.186 7365451.850 7291443.158 7254578.804 7217807.777 6891068.272 6819486.096 6642163.885 6536890.488 6501986.011 6294519.024 6124196.374 6090411.827
63
+ Case #63: 8642858.475 8160497.100 8018487.697 7784573.572 7417508.331 6753136.854
64
+ Case #64: 966888850.228 966888850.228 963937962.913 936129461.872 935921917.028 930326903.801 900159432.419 894875437.336 18133845.252 17788784.251 17731596.270 17560584.645 17503764.876
65
+ Case #65: 32765309276.000 32764165591.000 32764165148.000 32763021040.000 32763020119.000 32761876952.000 32761874667.000
66
+ Case #66: 2414221.171 2264819.481 1795140.241 341831.246 296352.844 268156.273 235583.878 224254.847 215938.491 193648.900 185916.750 179173.553
67
+ Case #67: 11361949380.770 10992470676.059 2939099847.196 2752671711.172 2743841493.276 2743290075.670
68
+ Case #68: 20442.437 20442.437 20442.437 20442.437 20442.437 20442.437 20442.437 20442.437 20442.437 20442.437
69
+ Case #69: 1748771269.376 1737209790.995 1566876591.211 1566876591.211 1475269419.513 1475269419.513 1412140098.230 1324896065.139 46449623.310 42938228.821 36099354.830 34960659.760 34960659.760 31707785.991 30959220.529 30799976.509 30641142.912
70
+ Case #70: 53385272391.000 53382827589.000 53382827432.000 53380382529.000 53380382180.000 53377937682.000 53377936827.000 53375492228.000 53375491530.000 53373047493.000 53373046952.000 53370602814.000 53370601767.000 53368158191.000
71
+ Case #71: 114324643.784 106451619.583 103087134.733 102287696.830 102154759.702 91548053.745 91045520.286 80930024.795 76842942.814 2125564.236 2068223.100 2011660.350
72
+ Case #72: 1835061688.353 1764213835.289 1735281210.900 1714961107.849 1685051582.795 1641705795.869 63211266.000 58216766.080 57191479.629 56809345.520 56682252.128 56048919.992 55419145.902 55419145.902 54917888.422 54170271.858
73
+ Case #73: 1630903031.000 1630265421.000 1630264586.000 1629632967.000 1629617111.000 1628991111.000 1628975552.000 1628344185.000 1628343053.000 1627700249.000 1627698083.000 1627062434.000 1627061103.000 1626426614.000 1626418254.000 1625788053.000 1625774660.000 1625145456.000 1625139092.000 1624500617.000
74
+ Case #74: 8276155.058 6717329.597 6428526.144 6163005.963 6028154.106 5961287.536
75
+ Case #75: 1371587.610 1158725.850 1083152.006 165009.071 136419.377 131212.706 131212.706 127115.038 117134.021 112284.487 108472.527 88581.920 15727.258 14281.235 11946.511 10146.514
76
+ Case #76: 126255024577.000 126251199262.000 126251198158.000 126247372918.000 126247371126.000 126243545148.000 126243544495.000 126239720007.000 126239717291.000 126235891683.000 126235891481.000 126232064538.000 126232063232.000 126228239571.000 126228237523.000 126224412269.000 126224411421.000 126220585409.000 126220584194.000 126216760616.000
77
+ Case #77: -1599.038 -1599.038 -1599.038
78
+ Case #78: 741182.910 721107.581 681773.549 643528.347 597253.014 552678.981 526751.184 501435.855 476732.993 468634.810 468634.810 460604.679 444748.572
79
+ Case #79: 311236.129 311236.129 306651.522 304359.679 304359.679
80
+ Case #80: 22233170344.288 21327348814.056 21327348814.056 20491147672.257 1440835375.718 1439712676.402 1439712676.402 1397927324.016 1382485203.685 1338837437.203 1319424354.658 1317812997.264 1310306347.179 1306026459.421 1306026459.421 1298553502.349 1297487687.339 1277849036.638 1276791754.274
81
+ Case #81: 11025154796.923 10630277673.621 10585931158.455 10315695728.427 762551683.341 756205055.239 707984528.816 706120678.076 702931220.712 684469938.806 683684230.739 669359547.390 642941266.732 639391492.633 632069648.010 628299031.387
82
+ Case #82: 179312890937.000 179304992752.000 179304992136.000 179297093184.000 179297093049.000 179289193364.000 179289193086.000 179281295857.000 179281295854.000 179273395288.000 179273395148.000 179265499361.000 179265498126.000 179257599275.000 179257597633.000 179249701094.000 179249700666.000 179241805486.000 179241802181.000 179233905031.000
83
+ Case #83: 3899.514 2739.331 2192.075 2192.075 2192.075 2192.075 681.648 681.648 681.648 681.648 681.648 681.648 681.648 681.648 681.648 681.648 221.952 221.952
84
+ Case #84: 42694663.413 41358950.364 39515018.199 38751204.524 38230406.591 36504488.180 36458394.971 34773415.949 34146251.312 33568994.294 33568994.294 33172237.466 32865279.408 31394635.261 29375735.256 28799526.472 565084.033
85
+ Case #85: 32757238368.000
86
+ Case #86: 1590865099.000 1590265211.000 1590263222.000 1589669448.000 1589665047.000 1589062740.000 1589059301.000 1588460134.000 1588458259.000 1587859945.000 1587854853.000 1587252494.000 1587242137.000
87
+ Case #87: 1798998103.779 1798998103.779 1768757854.189 1745151419.654 117256164.368 116783854.287 115419544.848 114483311.990 114016625.215
88
+ Case #88: 42701.193 26539.356 26539.356 24538.367 20767.272 20767.272 20767.272 20767.272 20767.272 20767.272 20767.272 20767.272 20767.272 20767.272
89
+ Case #89: 3008.168 3008.168 3008.168 3008.168 3008.168 3008.168 3008.168 3008.168 3008.168 3008.168
90
+ Case #90: 177309324.800 170950139.596 169003254.203 167155264.589 165230171.743 163229496.076 160552214.787 159179053.918 151648484.722 2757443.440 2746175.907 2734931.417 2690183.875 2656865.160 2634767.893 2623753.822
91
+ Case #91: 5877123.503 5656402.872 5574720.416 5253923.942 5123060.605 5097085.716 5071176.753 5019556.605 4993845.420 4866278.389 4790529.283 4324563.505 4182360.876 4135487.409 4065671.653 3996449.233
92
+ Case #92: 3151956.110 2592231.193 2108431.362 2108431.362 1665022.382
93
+ Case #93: 26744346635.194 26723451445.111 25438073621.553 25339169266.319 25176687932.271 1169611738.623 1159021331.925 1147860457.187 1146005561.103 1109830754.378 1099515165.618 1097094967.871 1089850373.732 1086838875.778 1080228246.123 1070051482.919 1052209982.447 1044525246.299
94
+ Case #94: 553453175230.000
95
+ Case #95: 393.982 393.982 393.982 393.982
96
+ Case #96: 13082625590.000 13081175641.000 13081174472.000 13079733910.000 13079730390.000 13078281863.000 13078276921.000 13076835510.000
97
+ Case #97: 93517972.268 90589055.454 85811068.457 81774837.877 79641748.904 79188325.488 77238446.611 76940622.350 75165756.571 75018785.835 74578736.468 74578736.468 73848196.996 73702520.523 73411598.997 73411598.997 73266353.945 73121252.699
98
+ Case #98: 1234170799.132 1150194995.320 1067003909.584 1009752218.621 911136093.584 62835649.931 58107017.346 54752196.639 53632884.664 51156691.352 50411747.515 49337944.836 48077815.902 47946118.861 47748911.911 46185884.298 45222197.862 42083275.424 41960066.228 41714189.614
99
+ Case #99: 16322.448 16322.448 16322.448
100
+ Case #100: 8.000 -60.000 -60.000 -60.000 -60.000 -60.000
101
+ Case #101: 713849023.925 689919417.495 688338615.252 673411422.629 669510410.641 668731568.074 656717471.025
102
+ Case #102: 19093000.114 19093000.114 19093000.114 19093000.114 19093000.114 19093000.114 19093000.114 19093000.114 8476726.496 8476726.496 8476726.496
103
+ Case #103: 319731896462.000 319722501786.000 319722501062.000 319713108625.000 319713108142.000 319703715360.000 319703715190.000 319694320928.000 319694320374.000 319684929146.000 319684927868.000 319675535160.000 319675533570.000 319666141312.000 319666140928.000 319656749944.000
104
+ Case #104: 9001273279.000 9000164269.000 9000162940.000 8999058954.000 8999058468.000 8997954454.000
105
+ Case #105: 31295.117 31295.117 31295.117 31295.117 31295.117 31295.117 31295.117 31295.117 31295.117
106
+ Case #106: -222.603 -222.603 -222.603 -222.603 -222.603 -222.603 -222.603 -222.603 -222.603 -222.603 -222.603 -222.603 -222.603 -222.603 -222.603 -222.603 -222.603 -222.603 -222.603 -222.603
107
+ Case #107: 61619461844.439 59838147636.134 59542602078.169 7050602701.357 6927272440.878 6783142366.292 6756438239.066 6734628582.618 6596121305.834 6566201461.903 6516089232.739 6409352270.685 864265480.742 801267188.844 796263690.039 789616734.822 778051598.628 773941869.358 771481255.337 763307502.777
108
+ Case #108: 26263163298.114 26217136200.679 25829611374.968 25734216944.231 1719672934.655 1706842588.436 1691934571.543 1667584788.375 1648651545.200 1637134443.651 1636089436.189 1630869403.307 1617855811.705 1616297683.811 1610072678.872 1593531384.294 1593531384.294 1582208788.085 1562746660.536 1500076406.214
109
+ Case #109: 129738283203.000 129735690201.000 129735681431.000 129733091234.000 129733085676.000 129730495726.000 129730492726.000 129727894032.000 129727893590.000 129725303913.000 129725289143.000 129722702271.000 129722696271.000 129720103425.000 129720100655.000 129717510605.000 129717505277.000 129714915262.000 129714906262.000 129712313724.000
110
+ Case #110: 3800486.736 3760092.138 3600671.002 3600671.002 3522254.787 3522254.787 3522254.787 3444701.474 3406248.406 3406248.406 3406248.406 3368011.063 3368011.063 3329989.446 3329989.446 3329989.446 3329989.446 3329989.446 3329989.446 3292183.554
111
+ Case #111: -5944.041 -5944.041 -5944.041 -5944.041 -5944.041 -5944.041 -5944.041 -5944.041 -5944.041 -5944.041 -5944.041 -5944.041 -5944.041 -5944.041 -5944.041 -5944.041 -5944.041 -5944.041 -5944.041 -5944.041
112
+ Case #112: 2697498757.663 2630730391.007 2606825218.802 2546632876.771 2528531579.330 2523113779.497 2497907541.232 2483560790.211 2476402909.346 2474615053.156 2469255358.246 2465685456.357 2465685456.357 2449652855.566 2444320276.287 2370274268.065 2370274268.065 2252804837.095 11619912.717 11376184.674
113
+ Case #113: 21588.546 21588.546 17743.728 17743.728 17743.728 17743.728 17743.728 17743.728 17743.728 14240.673 14240.673 14240.673 14240.673 14240.673 14240.673 14240.673 14240.673 14240.673 14240.673 14240.673
114
+ Case #114: -2823.017 -2823.017 -2823.017 -2823.017 -2823.017 -2823.017 -2823.017 -2823.017 -2823.017 -2823.017 -2823.017 -2823.017 -2823.017 -2823.017 -2823.017 -2823.017 -2823.017 -2823.017 -2823.017 -2823.017
115
+ Case #115: 970821184.170 965603452.365 961266082.217 951758234.899 948312551.900 947452107.485 934592305.369 931177865.103 924367730.212 924367730.212 920972035.586 920124088.265 914199391.975 913354568.928 913354568.928 912510136.414 908293831.860 907451742.552 906610043.777 892360916.344
116
+ Case #116: 249500189143.000 249495208644.000 249495205399.000 249490202488.000 249490195998.000 249485212354.000 249485207572.000 249480216033.000 249480203053.000 249475221217.000 249475219509.000 249470224825.000 249470215261.000 249465235062.000 249465226864.000 249460232280.000 249460229206.000 249455249107.000 249455248936.000 249450243351.000
117
+ Case #117: 1426862104.117 1424164652.768 1417432190.004 1412728956.836 1396662923.205 1395995498.996 1395328234.295 1391327995.773 1371412937.852 1339193738.970 1319656716.629 1293188284.319 12290735.586 12228165.798 12165755.524 12103504.766 11917709.582 11856096.884 11856096.884 11794643.701
118
+ Case #118: 14336529033.227 14050104439.588 13893468121.306 13607109737.833 947395743.777 900216793.997 897946203.497 893979569.162 881008164.628 881008164.628 878200837.785 875397990.839 875397990.839 864231402.015 860340029.933 859229822.101 855349739.358 843762174.704 837450090.807 821909241.909
119
+ Case #119: 1853658905.663 1827951023.824 1826528071.690 1823683829.588 1793953091.834 1761671207.151 1750511428.360 1744944836.288 1736611569.835 1732452416.353 1717244849.165 1713108965.999 1700731235.479 1695244427.349 1674747849.718 1655730183.792 1648964477.866 1646262073.882 1634128681.682 1627407300.168
120
+ Case #120: 11031309319.653 10739636128.853 10729413176.506 10519228692.118 10468689962.779 10421630279.786 10337858808.384 10101791133.258 192531879.961 187094238.282 183512415.622 181734485.829 181734485.829 180848766.318 180848766.318 179965210.396 179083818.064 178643933.244 178204589.321 178204589.321
121
+ Case #121: 8325423.729 7537792.258 7452691.846 7452691.846 7283939.541 7200287.646 7117118.592 7034432.376 7034432.376 6952228.999 6952228.999 6870508.462 6870508.462 6708515.905 6708515.905 6628243.886 6548454.705 6548454.705 6548454.705 6548454.705
122
+ Case #122: 1827829302.109 1788914476.977 1771879285.733 1762262186.904 1760567768.428 1757181376.426 1733567910.559 1718472176.143 32226772.626 31997956.536 30940924.459 30866101.349 30642175.363 30270776.536 30196768.443 30049023.929 29754621.592 29681247.401 29534770.692 29315734.810
123
+ Case #123: -3581.389 -3581.389 -3581.389 -3581.389 -3581.389 -3581.389 -3581.389 -3581.389 -3581.389 -3581.389 -3581.389 -3581.389 -3581.389 -3581.389 -3581.389 -3581.389 -3581.389 -3581.389 -3581.389 -3581.389
124
+ Case #124: 5292745453.053 5181875981.735 5172877222.354 5061052570.681 5056605000.696 5001175336.035 4983502361.090 4957051551.170 4952649925.641 4941654415.309 4832371371.848 52099146.233 52099146.233 50309195.017 50087650.673 49866595.119 48332892.380 48115747.152 47899090.713 47682923.066
125
+ Case #125: 11792359592.218 11682464498.454 11526891328.667 11525045548.303 11467899662.080 11416406099.505 11416406099.505 11350370347.424 206482788.626 203038345.151 202059539.646 196236371.164 195754950.214 192401558.414 191448767.673 190024015.896 188604585.321 188604585.321 188132624.286 186955308.392
126
+ Case #126: -38.521 -38.521 -38.521 -38.521 -38.521 -38.521 -38.521 -38.521 -38.521 -38.521 -38.521 -38.521 -38.521 -38.521 -38.521 -38.521 -38.521 -38.521 -38.521 -38.521
127
+ Case #127: 54841.776 54841.776 41319.886 41319.886 41319.886 41319.886 41319.886 41319.886 41319.886 35246.495 35246.495 35246.495 35246.495 35246.495 35246.495 35246.495 35246.495 35246.495 35246.495 35246.495
128
+ Case #128: -5610.815 -5610.815 -5610.815 -5610.815 -5610.815 -5610.815 -5610.815 -5610.815 -5610.815 -5610.815 -5610.815 -5610.815 -5610.815 -5610.815 -5610.815 -5610.815 -5610.815 -5610.815 -5610.815 -5610.815
129
+ Case #129: 2730643550.213 2678090148.773 2651216470.110 2643338236.889 2638616923.848 2637044090.649 2624478305.733 2610377669.130 2605685897.265 2582290340.462 2546622065.971 2543532199.574 2521955652.441 2503534618.765 2480603280.451 15440935.533 15440935.533 15440935.533 14844811.722 14726993.742
130
+ Case #130: 7783021435.992 7750857818.511 7479404383.201 7350706195.319 7317962805.253 331948335.153 328316879.042 320024778.647 315995729.703 314144776.682 313221338.915 310765482.999 310153029.201 304971561.336 304061715.196 303758735.185 301642103.618 300737241.074 300134754.469 297431040.140
131
+ Case #131: -155.951 -155.951 -155.951 -155.951 -155.951 -155.951 -155.951 -155.951 -155.951 -155.951 -155.951 -155.951 -155.951 -155.951 -155.951 -155.951 -155.951 -155.951 -155.951 -155.951
132
+ Case #132: 2957785.125 2934757.093 2911818.925 2888970.624 2888970.624 2866212.188 2820964.912 2798476.072 2776077.098 2776077.098 2776077.098 2753767.989 2753767.989 2731548.746 2709419.368 2687379.856 2687379.856 2687379.856 2665430.209 2665430.209
133
+ Case #133: 29833306196.363 29809588022.265 29238484213.957 28784646174.723 1973920576.150 1943527066.661 1900174683.442 1892399283.744 1859679747.584 1841952990.797 1838417826.418 1827832707.236 1826658469.360 1823138019.505 1810258755.121 1799755131.764 1784637184.615 1782317006.024 1758046247.681 1756894647.534
134
+ Case #134: -126.037 -126.037 -126.037 -126.037 -126.037 -126.037 -126.037 -126.037 -126.037 -126.037 -126.037 -126.037 -126.037 -126.037 -126.037 -126.037 -126.037 -126.037 -126.037 -126.037
135
+ Case #135: -205.863 -205.863 -205.863 -205.863 -205.863 -205.863 -205.863 -205.863 -205.863 -205.863 -205.863 -205.863 -205.863 -205.863 -205.863 -205.863 -205.863 -205.863 -205.863 -205.863
136
+ Case #136: 668055.482 580155.835 561460.263 524982.956 524982.956 524982.956 516054.012 516054.012 498424.583 498424.583 489724.098 489724.098 489724.098 489724.098 481099.767 481099.767 472551.588 472551.588 472551.588 464079.562
137
+ Case #137: 1800913.420 1800913.420 1780115.624 1759438.570 1738882.257 1718446.687 1718446.687 1718446.687 1698131.858 1677937.771 1657864.427 1657864.427 1637911.824 1637911.824 1637911.824 1618079.963 1618079.963 1618079.963 1618079.963 1618079.963
138
+ Case #138: -1609.098 -1609.098 -1609.098 -1609.098 -1609.098 -1609.098 -1609.098 -1609.098 -1609.098 -1609.098 -1609.098 -1609.098 -1609.098 -1609.098 -1609.098 -1609.098 -1609.098 -1609.098 -1609.098 -1609.098
139
+ Case #139: 159679759557.000 159676566022.000 159676559524.000 159673362677.000 159673359523.000 159670169396.000 159670169206.000 159666975767.000 159666969459.000 159663772518.000 159663769554.000 159660579523.000 159660579143.000 159657385800.000 159657379682.000 159654182647.000 159654179873.000 159650989938.000 159650989368.000 159647796121.000
140
+ Case #140: 6003492.520 6003492.520 5932544.786 5862018.733 5791914.359 5791914.359 5652970.655 5584131.323 5447717.701 5380143.410 5380143.410 5380143.410 5380143.410 5312990.800 5312990.800 5312990.800 5312990.800 5312990.800 5246259.871 5246259.871
141
+ Case #141: 6976285324.514 6883926142.703 6834701177.489 6798715127.058 6741660355.831 6570332513.352 206529708.168 206245078.751 205108523.705 203975108.857 203127108.475 201717699.752 199752770.556 198076199.761 197240563.905 194467868.100 192538658.645 191989222.304 191440571.013 191440571.013
142
+ Case #142: 11575.296 11575.296 7568.860 7568.860 7568.860 7568.860 7568.860 7568.860 7568.860 7568.860 7568.860 7568.860 7568.860 4048.052 4048.052 4048.052 4048.052 4048.052 4048.052 4048.052
143
+ Case #143: 140626730410.556 139170324554.223 35404997230.682 35404997230.682 34910761236.214 34184227420.443 9100986742.490 8854076120.878 8854076120.878 8848439941.404 8603613699.055 8603613699.055 8602224561.495 8488696941.077 2322559650.131 2309585487.930 2241003687.663 2238168544.357 2228259674.764 2198664964.413
144
+ Case #144: 2933946797.318 2868865395.470 2865271164.647 2820533368.345 2811628051.082 2788540123.718 2765547381.656 2725101090.762 2705862535.891 2695397503.247 2681475667.080 2678000840.305 2660660500.028 2660660500.028 2646828780.124 2610692017.890 14855130.918 14726005.818 14597443.969 14342010.020
145
+ Case #145: 6201120948.506 6108216108.234 6099542230.164 6085099462.221 6076442018.759 6024626780.527 5887537496.053 5850680661.598 5847850313.913 5842191672.870 5704410594.106 5472039614.145 53081062.260 52007974.946 51210349.899 50945844.491 50418888.085 49894670.893 49633589.503 49113481.134
146
+ Case #146: 313502541.537 307224401.471 302188606.349 300127138.805 299539443.987 299539443.987 298072726.765 298072726.765 295733466.687 294276108.809 293112814.326 291372192.298 289348018.140 289348018.140 285894420.148 285607556.249 281037316.504 277633827.000 276786194.397 276503938.176
147
+ Case #147: 252413556.891 242300709.822 239242997.556 237002370.289 236683141.208 234931226.746 233661194.646 233502682.658 231604733.866 230029026.005 228145275.929 227206305.174 225645656.557 225334172.230 225178510.740 225022903.034 219149663.416 1170036.814 1136595.825 1092760.834
148
+ Case #148: 919770757.394 904566448.891 891992989.694 886155490.302 884491153.255 873711094.958 872884597.422 869582518.306 869582518.306 851532938.504 849901454.075 848271534.057 843391160.463 830445664.933 830445664.933 826420730.466 826420730.466 821603715.491 820001172.653 808827176.277
149
+ Case #149: 149280564.977 147086617.057 144330931.849 142891037.919 139890756.616 137062941.366 136080027.434 135519950.381 135519950.381 135240344.960 133152507.785 132875356.626 132875356.626 131907601.371 131493931.881 131356186.420 130256821.359 129982701.936 129982701.936 129435329.299
150
+ Case #150: 461529056.616 444945371.658 442655491.247 442655491.247 441893510.547 438472720.155 437335410.423 429040265.508 426791737.339 424175920.853 421568145.080 418227105.442 417116379.294 414530428.315 414161663.132 413056352.158 410483036.588 409749280.433 404995864.808 401721284.130
151
+ Case #151: 41036.831 34561.601 34561.601 34561.601 28575.067 28575.067 28575.067 28575.067 28575.067 28575.067 28575.067 23077.230 23077.230 23077.230 23077.230 23077.230 23077.230 23077.230 23077.230 23077.230
152
+ Case #152: 168838480353.737 166635569279.251 42477132059.595 41944793692.702 41941435152.524 41375773456.754 10636195779.227 10634504537.707 10607462961.438 10602396498.311 10363968289.018 10363968289.018 10337273109.994 10323938429.697 2730463602.142 2702257394.642 2683534614.680 2682685125.708 2634486544.234 2617678308.277
153
+ Case #153: 13818149453.005 13627817475.324 13327736905.898 13259616126.435 13229868168.749 13208640080.960 12980462809.156 12867119700.220 256098255.432 239247184.768 237536697.375 234699521.227 228517732.859 226846108.558 226290264.075 226290264.075 226012597.512 225735101.401 225180620.535 224626821.478
154
+ Case #154: 3757568.514 3757568.514 3649690.784 3578644.037 3508294.681 3473381.525 3438642.717 3335472.379 3335472.379 3301430.962 3301430.962 3267563.893 3267563.893 3267563.893 3267563.893 3267563.893 3233871.172 3233871.172 3233871.172 3233871.172
155
+ Case #155: 72.766 72.766 72.766 72.766 72.766 72.766 72.766 72.766 72.766 72.766 72.766 72.766 72.766 72.766 72.766 72.766 72.766 72.766 72.766 72.766
2014/finals/intervals_of_love.html ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <p>
2
+ Do you remember helping Prince Z.A.Y. rescue the princess of the kingdom of Hackadia from an evil dragon in Round 2? Well, as it so often happens, Z.A.Y. has fallen in love with his dearest princess. However, the princess has given Z.A.Y. a puzzle to solve to ensure that the one she marries is both brave and clever.
3
+ </p>
4
+
5
+ <p>
6
+ The princess gives Z.A.Y a 0-indexed array of <b>N</b> integers, and she asks him a series of questions. In each question, she provides an inclusive interval to the prince, and asks him how many subarrays in that interval are slowly increasing.
7
+ </p>
8
+
9
+ <p>
10
+ A subarray is defined as a contiguous set of integers in the given array.
11
+ A subarray is slowly increasing iff each integer in the subarray after the first is exactly 1 more than the previous integer. For example, <b>[1, 2, 3]</b>, <b>[5]</b>, and <b>[10, 11, 12]</b> are slowly increasing, but <b>[7, 9]</b>, <b>[13, 12, 11]</b>, and <b>[1, 1, 2, 2]</b> are not.
12
+ </p>
13
+
14
+ <p>
15
+ Easy problem, right? Yup, so the princess is going to make it more challenging since she knows the prince is seeking help from the best Hackers from the world. Sometimes, instead of asking a question, the princess will change an integer in the array.
16
+ </p>
17
+
18
+ <p>
19
+ Still an easy problem, right? Probably, but the princess isn't going to make it any harder (the prince *did* rescue her from a dragon, and could probably use a break).
20
+ </p>
21
+
22
+ <h3>Input</h3><p>
23
+ The first line consists of a single integer <b>T</b>, the number of test cases.
24
+ Each test case starts with a line containing an integer <b>N</b>, the length of the array.
25
+ Then 1 line follows with <b>N</b> integers <b>X<sub>i</sub></b> representing the elements of the array.
26
+ Then 1 line follows with an integer <b>M</b>, the number of actions the princess takes (questions and updates).
27
+ Then <b>M</b> lines follow, each with 3 integers.
28
+ The first integer, <b>op</b>, represents the action the princess takes.
29
+ If <b>op</b> is <b>0</b>, then 2 integers <b>P</b> and <b>K</b> follow, meaning that the princess will change the <b>P</b>th element of the array to <b>K</b>.
30
+ If <b>op</b> is <b>1</b>, then 2 integers <b>L</b> and <b>R</b> follow, meaning that the princess will ask how many slowly increasing subarrays there are between <b>L</b> and <b>R</b> (inclusive).
31
+ </p>
32
+
33
+ <h3>Output</h3>
34
+ <p>
35
+ For each test case <i>i</i>, output "Case #i: " followed by a single integer, the sum of the answers to the princess's questions. Since this number might be large, output it modulo 1,000,000,007.
36
+ </p>
37
+
38
+ <h3>Explanation of Sample</h3>
39
+ <p>
40
+ In the first sample case, the answer to the first question is 6 (the slowly increasing subarrays are [4], [5], [6], [4, 5], [5, 6], [4, 5, 6]), and the answer to the second question is 12. So the sum is 18.
41
+ </p>
42
+
43
+ <p>
44
+ In the second sample case, the answers are 3, 4, and 6 respectively, so the sum is 13.
45
+ </p>
46
+
47
+ <h3>Constraints</h3>
48
+ <p>
49
+ 1 &le; <b>T</b> &le; 20 <br/>
50
+ 1 &le; <b>N</b> &le; 10<sup>6</sup> <br/>
51
+ 1 &le; <b>M</b> &le; 10<sup>6</sup> <br/>
52
+ 1 &le; <b>X<sub>i</sub></b>, <b>K</b> &le; 10<sup>9</sup><br/>
53
+ 0 &le; <b>P</b> &lt; <b>N</b> <br/>
54
+ 0 &le; <b>op</b> &le; 1 <br/>
55
+ 0 &le; <b>L</b> &le; <b>R</b> &lt; <b>N</b>
56
+ </p>
2014/finals/intervals_of_love.in ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b9ce8d134190e91106d7883ab347884d99bedffb88dd7bc430c60b74f0f29285
3
+ size 66686480
2014/finals/intervals_of_love.md ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Do you remember helping Prince Z.A.Y. rescue the princess of the kingdom of
2
+ Hackadia from an evil dragon in Round 2? Well, as it so often happens, Z.A.Y.
3
+ has fallen in love with his dearest princess. However, the princess has given
4
+ Z.A.Y. a puzzle to solve to ensure that the one she marries is both brave and
5
+ clever.
6
+
7
+ The princess gives Z.A.Y a 0-indexed array of **N** integers, and she asks him
8
+ a series of questions. In each question, she provides an inclusive interval to
9
+ the prince, and asks him how many subarrays in that interval are slowly
10
+ increasing.
11
+
12
+ A subarray is defined as a contiguous set of integers in the given array. A
13
+ subarray is slowly increasing iff each integer in the subarray after the first
14
+ is exactly 1 more than the previous integer. For example, **[1, 2, 3]**,
15
+ **[5]**, and **[10, 11, 12]** are slowly increasing, but **[7, 9]**, **[13,
16
+ 12, 11]**, and **[1, 1, 2, 2]** are not.
17
+
18
+ Easy problem, right? Yup, so the princess is going to make it more challenging
19
+ since she knows the prince is seeking help from the best Hackers from the
20
+ world. Sometimes, instead of asking a question, the princess will change an
21
+ integer in the array.
22
+
23
+ Still an easy problem, right? Probably, but the princess isn't going to make
24
+ it any harder (the prince *did* rescue her from a dragon, and could probably
25
+ use a break).
26
+
27
+ ### Input
28
+
29
+ The first line consists of a single integer **T**, the number of test cases.
30
+ Each test case starts with a line containing an integer **N**, the length of
31
+ the array. Then 1 line follows with **N** integers **Xi** representing the
32
+ elements of the array. Then 1 line follows with an integer **M**, the number
33
+ of actions the princess takes (questions and updates). Then **M** lines
34
+ follow, each with 3 integers. The first integer, **op**, represents the action
35
+ the princess takes. If **op** is **0**, then 2 integers **P** and **K**
36
+ follow, meaning that the princess will change the **P**th element of the array
37
+ to **K**. If **op** is **1**, then 2 integers **L** and **R** follow, meaning
38
+ that the princess will ask how many slowly increasing subarrays there are
39
+ between **L** and **R** (inclusive).
40
+
41
+ ### Output
42
+
43
+ For each test case _i_, output "Case #i: " followed by a single integer, the
44
+ sum of the answers to the princess's questions. Since this number might be
45
+ large, output it modulo 1,000,000,007.
46
+
47
+ ### Explanation of Sample
48
+
49
+ In the first sample case, the answer to the first question is 6 (the slowly
50
+ increasing subarrays are [4], [5], [6], [4, 5], [5, 6], [4, 5, 6]), and the
51
+ answer to the second question is 12. So the sum is 18.
52
+
53
+ In the second sample case, the answers are 3, 4, and 6 respectively, so the
54
+ sum is 13.
55
+
56
+ ### Constraints
57
+
58
+ 1 ≤ **T** ≤ 20
59
+ 1 ≤ **N** ≤ 106
60
+ 1 ≤ **M** ≤ 106
61
+ 1 ≤ **Xi**, **K** ≤ 109
62
+ 0 ≤ **P** < **N**
63
+ 0 ≤ **op** ≤ 1
64
+ 0 ≤ **L** ≤ **R** < **N**
65
+
2014/finals/intervals_of_love.out ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Case #1: 18
2
+ Case #2: 13
3
+ Case #3: 14
4
+ Case #4: 16
5
+ Case #5: 13
6
+ Case #6: 10
7
+ Case #7: 12
8
+ Case #8: 611
9
+ Case #9: 1244
10
+ Case #10: 993
11
+ Case #11: 930
12
+ Case #12: 1249
13
+ Case #13: 83785
14
+ Case #14: 86801
15
+ Case #15: 82883
16
+ Case #16: 76552
17
+ Case #17: 82847
18
+ Case #18: 235227063
19
+ Case #19: 346924584
20
+ Case #20: 999496508
2014/finals/lunch_at_facebook.html ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <p>
2
+ What's the best thing about working at Facebook? It's hard to say, but the free food doesn't hurt. Every day there are long lines for food, and sometimes guests visit the campus, as hungry as everybody else. It pays to be a good host, so sometimes we'll let guests cut ahead in the line. But obviously nobody wants to miss out on delicious Facebook food.
3
+ </p>
4
+
5
+ <p>
6
+ Every day, <b>N</b> Facebook employees are lined up for lunch, and every day <b>M</b> visitors come to the campus looking for food. Each person has an appetite <b>A<sub>i</sub></b>, which is a positive integer. Curiously, no two people have the same appetite.
7
+ </p>
8
+
9
+ <p>
10
+ If people with large appetites eat first, there's a concern that the food might run out before the people at the back get to eat, so it's ideal to have people with smaller appetites further ahead in the line. With this in mind, we'd like to squeeze all of the guests into the lunch line as efficiently as possible.
11
+ </p>
12
+
13
+ <p>
14
+ We define the <i>unsuitableness</i> of a line as the number of pairs of people in the line, <b>P<sub>i</sub></b> and <b>P<sub>j</sub></b>, such that <b>P<sub>i</sub></b> is ahead of <b>P<sub>j</sub></b> in the line, and <b>P<sub>i</sub></b> has a larger appetite than <b>P<sub>j</sub></b>. Your task is to find a way to get all the visitors into the lunch line such that the unsuitableness of the resulting line is minimized. The employees that are standing in line won't change order, but you can put guests in any place you want.
15
+ </p>
16
+
17
+ <h3>Input</h3>
18
+ <p>
19
+ The first line contains an integer <b>T</b>, the number of test cases. <br/>
20
+ Each test case has three lines: <br/>
21
+ A line with <b>N</b> and <b>M</b>. <br/>
22
+ A line with <b>N</b> integers, the appetites of the employees in order, beginning with the first employee. <br/>
23
+ A line with <b>M</b> integers, the appetites of the visitors. <br/>
24
+ </p>
25
+
26
+ <h3>Output</h3>
27
+ <p>
28
+ For each test case <i>i</i>, output "Case #i: " followed by the minimum possible unsuitableness of the resulting line.
29
+ </p>
30
+
31
+ <h3>Constraints</h3>
32
+ <p>
33
+ 1 &le; <b>T</b> &le; 20 <br/>
34
+ 1 &le; <b>N</b> &le; 10<sup>5</sup> <br/>
35
+ 1 &le; <b>M</b> &le; 10<sup>5</sup> <br/>
36
+ 1 &le; <b>A<sub>i</sub></b> &le; 10<sup>9</sup> <br/>
37
+ </p>
38
+
39
+ <h3>Explanation of Sample</h3>
40
+ <p>
41
+ For the first test case the optimal lunch line has the following appetites in order: 1, 2, 3, 4 <br/>
42
+ For the second test case the optimal lunch line is: 1, 2, 4, 7, 5, 3 <br/>
43
+ </p>
2014/finals/lunch_at_facebook.in ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:40170322d59a7ef21c7066d8d7e240a2ff9fc0022b0333ab873f50215b8193e2
3
+ size 29222524
2014/finals/lunch_at_facebook.md ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ What's the best thing about working at Facebook? It's hard to say, but the
2
+ free food doesn't hurt. Every day there are long lines for food, and sometimes
3
+ guests visit the campus, as hungry as everybody else. It pays to be a good
4
+ host, so sometimes we'll let guests cut ahead in the line. But obviously
5
+ nobody wants to miss out on delicious Facebook food.
6
+
7
+ Every day, **N** Facebook employees are lined up for lunch, and every day
8
+ **M** visitors come to the campus looking for food. Each person has an
9
+ appetite **Ai**, which is a positive integer. Curiously, no two people have
10
+ the same appetite.
11
+
12
+ If people with large appetites eat first, there's a concern that the food
13
+ might run out before the people at the back get to eat, so it's ideal to have
14
+ people with smaller appetites further ahead in the line. With this in mind,
15
+ we'd like to squeeze all of the guests into the lunch line as efficiently as
16
+ possible.
17
+
18
+ We define the _unsuitableness_ of a line as the number of pairs of people in
19
+ the line, **Pi** and **Pj**, such that **Pi** is ahead of **Pj** in the line,
20
+ and **Pi** has a larger appetite than **Pj**. Your task is to find a way to
21
+ get all the visitors into the lunch line such that the unsuitableness of the
22
+ resulting line is minimized. The employees that are standing in line won't
23
+ change order, but you can put guests in any place you want.
24
+
25
+ ### Input
26
+
27
+ The first line contains an integer **T**, the number of test cases.
28
+ Each test case has three lines:
29
+ A line with **N** and **M**.
30
+ A line with **N** integers, the appetites of the employees in order, beginning
31
+ with the first employee.
32
+ A line with **M** integers, the appetites of the visitors.
33
+
34
+ ### Output
35
+
36
+ For each test case _i_, output "Case #i: " followed by the minimum possible
37
+ unsuitableness of the resulting line.
38
+
39
+ ### Constraints
40
+
41
+ 1 ≤ **T** ≤ 20
42
+ 1 ≤ **N** ≤ 105
43
+ 1 ≤ **M** ≤ 105
44
+ 1 ≤ **Ai** ≤ 109
45
+
46
+ ### Explanation of Sample
47
+
48
+ For the first test case the optimal lunch line has the following appetites in
49
+ order: 1, 2, 3, 4
50
+ For the second test case the optimal lunch line is: 1, 2, 4, 7, 5, 3
51
+
2014/finals/lunch_at_facebook.out ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Case #1: 0
2
+ Case #2: 4
3
+ Case #3: 35
4
+ Case #4: 33
5
+ Case #5: 25
6
+ Case #6: 32
7
+ Case #7: 36
8
+ Case #8: 2490850215
9
+ Case #9: 2509829169
10
+ Case #10: 2498479441
11
+ Case #11: 2483548921
12
+ Case #12: 2495058489
13
+ Case #13: 5003931491
14
+ Case #14: 4997483609
15
+ Case #15: 5005753015
16
+ Case #16: 5010400648
17
+ Case #17: 5001567701
18
+ Case #18: 5009444374
19
+ Case #19: 4997430848
20
+ Case #20: 5000697190
21
+ Case #21: 5003216558
22
+ Case #22: 5005851841
23
+ Case #23: 5004269719
24
+ Case #24: 4999117576
25
+ Case #25: 5004842589
26
+ Case #26: 4993330195
27
+ Case #27: 4985587191
2014/finals/tours.html ADDED
@@ -0,0 +1,115 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <p>
2
+ Facebook HQ -- a mysterious place full of magical code and trade secrets.
3
+ If outsiders were ever to breach the walls of the compound, which are
4
+ protected by a legion of security foxes, the entire company could well
5
+ be brought to its knees!
6
+ </p>
7
+
8
+ <p>
9
+ Hmmm. Actually, campus tours are given regularly.
10
+ </p>
11
+
12
+ <p>
13
+ The compound consists of <b>N</b> buildings, with <b>M</b> walkways running amongst them.
14
+ The <i>i</i>th walkway connects buildings <b>A<sub>i</sub></b> and <b>B<sub>i</sub></b>, (<b>A<sub>i</sub></b> != <b>B<sub>i</sub></b>)
15
+ and no two buildings are
16
+ directly connected by more than one walkway. There are no other ways to
17
+ move from building to building.
18
+ </p>
19
+
20
+ <p>
21
+ Over a period of <b>D</b> days, some events will occur at Facebook HQ. One
22
+ of two types of events will happen on the <i>i</i>th day, indicated by a character
23
+ <b>E<sub>i</sub></b>. If <b>E<sub>i</sub></b> = 'T', then a tour will take place. Otherwise, <b>E<sub>i</sub></b> = 'S', and a
24
+ security sweep of one building will take place.
25
+ </p>
26
+
27
+ <p>
28
+ If a tour is given on the <i>i</i>th day, visitors will plan to enter the compound at
29
+ building <b>X<sub>i</sub></b>, and leave from building <b>Y<sub>i</sub></b> (<b>X<sub>i</sub></b> != <b>Y<sub>i</sub></b>). If it turns out that
30
+ these two buildings are not actually connected by any sequence of walkways,
31
+ then the tour will be cancelled, and the unfortunate visitors will be
32
+ given Facebook T-shirts on the way out. Otherwise, a large number of people
33
+ will be led from building <b>X<sub>i</sub></b> to building <b>Y<sub>i</sub></b> along various routes. No route
34
+ will involve travelling along the same walkway multiple times (even in
35
+ different directions), but a route might revisit the same building repeatedly,
36
+ including buildings <b>X<sub>i</sub></b> and <b>Y<sub>i</sub></b>. Along the way some visitors will inevitably
37
+ get themselves "lost", and fail to rejoin the tour group. In total, <b>O<sub>i</sub></b> new
38
+ outsiders will be left behind in each building which could possibly be part of
39
+ any valid tour route from building <b>X<sub>i</sub></b> and building <b>Y<sub>i</sub></b>. Good thing they'll no
40
+ doubt have brought cameras to amuse themselves with while they wait to be
41
+ found.
42
+ </p>
43
+
44
+ <p>
45
+ On the other hand, if a security sweep is conducted on the <i>i</i>th day, then the
46
+ security foxes will carefully search building <b>Z<sub>i</sub></b> for any trespassers
47
+ remaining from previous tours, and kindly escort them out.
48
+ </p>
49
+
50
+ <p>
51
+ Since Facebook likes data, you've been hired to record how many outsiders
52
+ were found in each sweep.
53
+ </p>
54
+
55
+ <h3>Input</h3>
56
+ <p>
57
+ Input begins with an integer <b>T</b>, the number of test cases. Each test case
58
+ begins with a line containing three integers, <b>N</b>, <b>M</b>, and <b>D</b>.
59
+ The next <b>M</b> lines contain two integers <b>A<sub>i</sub></b> and <b>B<sub>i</sub></b>.
60
+ The next <b>D</b> lines contain a character <b>E<sub>i</sub></b>, followed by either three integers
61
+ <b>X<sub>i</sub></b>, <b>Y<sub>i</sub></b>, <b>O<sub>i</sub></b> if <b>E<sub>i</sub></b> = 'T', or a single integer <b>Z<sub>i</sub></b> if <b>E<sub>i</sub></b> = 'S'.
62
+ </p>
63
+
64
+ <h3>Output</h3>
65
+ <p>
66
+ For each test case <i>i</i>, output "Case #i: " followed by the total number of visitors the foxes escort off the campus. Since this number may be quite large, output it modulo 1,000,000,007.
67
+ </p>
68
+
69
+ <h3>Constraints</h3>
70
+ <p>
71
+ 1 &le; <b>T</b> &le; 20 <br/>
72
+ 1 &le; <b>N</b> &le; 10<sup>5</sup> <br/>
73
+ 1 &le; <b>M</b> &le; 10<sup>6</sup> <br/>
74
+ 1 &le; <b>D</b> &le; 10<sup>6</sup> <br/>
75
+ 1 &le; <b>O<sub>i</sub></b> &le; 1,000 <br/>
76
+ 1 &le; <b>A<sub>i</sub></b>, <b>B<sub>i</sub></b>, <b>X<sub>i</sub></b>, <b>Y<sub>i</sub></b>, <b>Z<sub>i</sub></b> &le; <b>N</b> <br/>
77
+ </p>
78
+
79
+ <h3>Explanation of Sample</h3>
80
+ <p>
81
+ In the first sample case:
82
+ </p>
83
+
84
+ <p>
85
+ On the first day, a tour is given from building 1 to building 2. The only
86
+ valid route consists of simply crossing the walkway between these two
87
+ buildings. As such, by the end of the day, 5 outsiders are left hiding in each
88
+ of buildings 1 and 2.
89
+ </p>
90
+
91
+ <p>
92
+ On the second day, the tour cannot take place.
93
+ </p>
94
+
95
+ <p>
96
+ On the third and fourth days, security sweeps of buildings 2 and 6 are carried
97
+ out, with 5 and 0 outsiders found respectively.
98
+ </p>
99
+
100
+ <p>
101
+ On the fifth day, a tour is given from building 2 to building 3. There are
102
+ exactly three valid routes (2, 3), (2, 3, 4, 5, 3), (2, 3, 5, 4, 3). As such,
103
+ one new outsider remains behind in each of buildings 2, 3, 4, and 5.
104
+ </p>
105
+
106
+ <p>
107
+ On the sixth day, the valid tour routes are (5, 3) and (5, 4, 3), so 14 new
108
+ outsiders take up residence in each of buildings 3, 4, and 5.
109
+ </p>
110
+
111
+ <p>
112
+ Finally, security sweeps of buildings 1, 2, and 4 are conducted evicting 5, 1,
113
+ and 15 people respectively, for a grand total of 26.
114
+ </p>
115
+
2014/finals/tours.in ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:47c7247b8678a94392f165bcb16f1b9995d0e869ad5f72ec60607376d7db17f5
3
+ size 85079778
2014/finals/tours.md ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Facebook HQ -- a mysterious place full of magical code and trade secrets. If
2
+ outsiders were ever to breach the walls of the compound, which are protected
3
+ by a legion of security foxes, the entire company could well be brought to its
4
+ knees!
5
+
6
+ Hmmm. Actually, campus tours are given regularly.
7
+
8
+ The compound consists of **N** buildings, with **M** walkways running amongst
9
+ them. The _i_th walkway connects buildings **Ai** and **Bi**, (**Ai** !=
10
+ **Bi**) and no two buildings are directly connected by more than one walkway.
11
+ There are no other ways to move from building to building.
12
+
13
+ Over a period of **D** days, some events will occur at Facebook HQ. One of two
14
+ types of events will happen on the _i_th day, indicated by a character **Ei**.
15
+ If **Ei** = 'T', then a tour will take place. Otherwise, **Ei** = 'S', and a
16
+ security sweep of one building will take place.
17
+
18
+ If a tour is given on the _i_th day, visitors will plan to enter the compound
19
+ at building **Xi**, and leave from building **Yi** (**Xi** != **Yi**). If it
20
+ turns out that these two buildings are not actually connected by any sequence
21
+ of walkways, then the tour will be cancelled, and the unfortunate visitors
22
+ will be given Facebook T-shirts on the way out. Otherwise, a large number of
23
+ people will be led from building **Xi** to building **Yi** along various
24
+ routes. No route will involve travelling along the same walkway multiple times
25
+ (even in different directions), but a route might revisit the same building
26
+ repeatedly, including buildings **Xi** and **Yi**. Along the way some visitors
27
+ will inevitably get themselves "lost", and fail to rejoin the tour group. In
28
+ total, **Oi** new outsiders will be left behind in each building which could
29
+ possibly be part of any valid tour route from building **Xi** and building
30
+ **Yi**. Good thing they'll no doubt have brought cameras to amuse themselves
31
+ with while they wait to be found.
32
+
33
+ On the other hand, if a security sweep is conducted on the _i_th day, then the
34
+ security foxes will carefully search building **Zi** for any trespassers
35
+ remaining from previous tours, and kindly escort them out.
36
+
37
+ Since Facebook likes data, you've been hired to record how many outsiders were
38
+ found in each sweep.
39
+
40
+ ### Input
41
+
42
+ Input begins with an integer **T**, the number of test cases. Each test case
43
+ begins with a line containing three integers, **N**, **M**, and **D**. The
44
+ next **M** lines contain two integers **Ai** and **Bi**. The next **D** lines
45
+ contain a character **Ei**, followed by either three integers **Xi**, **Yi**,
46
+ **Oi** if **Ei** = 'T', or a single integer **Zi** if **Ei** = 'S'.
47
+
48
+ ### Output
49
+
50
+ For each test case _i_, output "Case #i: " followed by the total number of
51
+ visitors the foxes escort off the campus. Since this number may be quite
52
+ large, output it modulo 1,000,000,007.
53
+
54
+ ### Constraints
55
+
56
+ 1 ≤ **T** ≤ 20
57
+ 1 ≤ **N** ≤ 105
58
+ 1 ≤ **M** ≤ 106
59
+ 1 ≤ **D** ≤ 106
60
+ 1 ≤ **Oi** ≤ 1,000
61
+ 1 ≤ **Ai**, **Bi**, **Xi**, **Yi**, **Zi** ≤ **N**
62
+
63
+ ### Explanation of Sample
64
+
65
+ In the first sample case:
66
+
67
+ On the first day, a tour is given from building 1 to building 2. The only
68
+ valid route consists of simply crossing the walkway between these two
69
+ buildings. As such, by the end of the day, 5 outsiders are left hiding in each
70
+ of buildings 1 and 2.
71
+
72
+ On the second day, the tour cannot take place.
73
+
74
+ On the third and fourth days, security sweeps of buildings 2 and 6 are carried
75
+ out, with 5 and 0 outsiders found respectively.
76
+
77
+ On the fifth day, a tour is given from building 2 to building 3. There are
78
+ exactly three valid routes (2, 3), (2, 3, 4, 5, 3), (2, 3, 5, 4, 3). As such,
79
+ one new outsider remains behind in each of buildings 2, 3, 4, and 5.
80
+
81
+ On the sixth day, the valid tour routes are (5, 3) and (5, 4, 3), so 14 new
82
+ outsiders take up residence in each of buildings 3, 4, and 5.
83
+
84
+ Finally, security sweeps of buildings 1, 2, and 4 are conducted evicting 5, 1,
85
+ and 15 people respectively, for a grand total of 26.
86
+
2014/finals/tours.out ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Case #1: 26
2
+ Case #2: 20
3
+ Case #3: 25
4
+ Case #4: 30
5
+ Case #5: 10
6
+ Case #6: 321312244
7
+ Case #7: 961408044
8
+ Case #8: 638903740
9
+ Case #9: 739155438
10
+ Case #10: 206324915
11
+ Case #11: 224475276
12
+ Case #12: 601704477
13
+ Case #13: 273863365
14
+ Case #14: 966711072
15
+ Case #15: 591408789
16
+ Case #16: 258257037
17
+ Case #17: 979432230
18
+ Case #18: 445325208
19
+ Case #19: 411713723
20
+ Case #20: 609503086
21
+ Case #21: 999022143
22
+ Case #22: 847504615
23
+ Case #23: 312082737
24
+ Case #24: 195455291
25
+ Case #25: 217890383
2014/quals/basketball_game.html ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <p>A group of <strong>N</strong> high school students wants to play a basketball game. To divide
2
+ themselves into two teams they first rank all the players in the following
3
+ way:<p>
4
+ <ul>
5
+ <li>Players with a higher shot percentage are rated higher than players with a lower
6
+ shot percentage.</li>
7
+ <li>If two players have the same shot percentage, the taller player is rated
8
+ higher.</li>
9
+ </ul>
10
+
11
+ <p>
12
+ Luckily there are no two players with both the same shot percentage and height
13
+ so they are able to order themselves in an unambiguous way. Based on that
14
+ ordering each player is assigned
15
+ a draft number from the range [1..<strong>N</strong>], where the highest-rated player gets the
16
+ number 1, the second highest-rated gets the number 2, and so on.
17
+ Now the first team contains all the players with the odd draft numbers and the
18
+ second team all the players with the even draft numbers.</p>
19
+
20
+ <p>
21
+ Each team can only have <strong>P</strong> players playing at a time, so to ensure that
22
+ everyone gets similar time on the court both teams will rotate their players
23
+ according to the following algorithm:</p>
24
+ <ul>
25
+ <li>Each team starts the game with the <strong>P</strong> players who have the lowest draft numbers.</li>
26
+ <li>If there are more than <strong>P</strong> players on a team after each minute of the game the player with the highest total
27
+ time played leaves the playing field. Ties are broken by the player with the higher draft number leaving first.</li>
28
+ <li>To replace her the player on the bench with the lowest total time played
29
+ joins the game. Ties are broken by the player with the lower draft number
30
+ entering first.</li>
31
+ </ul>
32
+ <p>
33
+ The game has been going on for <strong>M</strong> minutes now. Your task is to print out the
34
+ names of all the players currently on the field, (that is after <strong>M</strong> rotations).
35
+ </p>
36
+
37
+ <h3>Input</h3>
38
+ <p>
39
+ The first line of the input consists of a single number <strong>T</strong>, the number of test
40
+ cases.
41
+ </p>
42
+ <p>
43
+ Each test case starts with a line containing three space separated integers <strong>N</strong> <strong>M</strong> <strong>P</strong>
44
+ </p>
45
+ <p>
46
+ The subsequent <strong>N</strong> lines are in the format "&lt;name&gt; &lt;shot_percentage&gt; &lt;height&gt;".
47
+ See the example for clarification.
48
+ </p>
49
+
50
+ <h3>Constraints</h3>
51
+ <p>
52
+ 1 &le; <strong>T</strong> &le; 50<br/>
53
+ 2 * <strong>P</strong> &le; <strong>N</strong> &le; 30<br/>
54
+ 1 &le; <strong>M</strong> &le; 120<br/>
55
+ 1 &le; <strong>P</strong> &le; 5<br/>
56
+ Each name starts with an uppercase English letter, followed by 0 to 20 lowercase English letters. <br/>
57
+ There can be players sharing the same name. <br/>
58
+ Each shot percentage is an integer from the range [0..100]. <br/>
59
+ Each height is an integer from the range [100..240].
60
+ </p>
61
+ <h3>Output</h3>
62
+ <p>
63
+ For each test case <strong>i</strong> numbered from 1 to <strong>T</strong>, output "Case #<strong>i</strong>: ", followed by 2 * <strong>P</strong> space separated names of the players playing after <strong>M</strong> rotations. The names should be printed in lexicographical order.</p>
64
+
65
+ <h3>Example</h3>
66
+ <p>In the first example if you sort all the players by their shot percentage you get the list: [Wai, Purav, Weiyan, Slawek, Lin, Meihong]. This makes the two teams:</p>
67
+ [Wai, Weiyan, Lin]</br>
68
+ [Purav, Slawek, Meihong]</br>
69
+ <p>
70
+ The game starts with Lin and Meihong sitting on the bench in their respective teams. After the first minute passes it's time for Weiyan and Slawek to sit out since they have the highest draft numbers of the people who played. After the second minute passes Lin and Meihong will keep playing since they only played one minute so far and it's Wai and Purav who have to sit out.</p>
71
+ <p>Finally after the third minute Lin and Maihong go back to the bench
72
+ and all the players currently playing again are:<br/><samp>Purav Slawek Wai Weiyan</samp></p>
73
+
2014/quals/basketball_game.in ADDED
@@ -0,0 +1,523 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 30
2
+ 6 3 2
3
+ Wai 99 131
4
+ Weiyan 81 155
5
+ Lin 80 100
6
+ Purav 86 198
7
+ Slawek 80 192
8
+ Meihong 44 109
9
+ 7 93 2
10
+ Paul 82 189
11
+ Kittipat 62 126
12
+ Thomas 17 228
13
+ Fabien 57 233
14
+ Yifei 65 138
15
+ Liang 92 100
16
+ Victor 53 124
17
+ 6 62 3
18
+ Meihong 33 192
19
+ Duc 62 162
20
+ Wai 70 148
21
+ Fabien 19 120
22
+ Bhuwan 48 176
23
+ Vlad 30 225
24
+ 8 59 3
25
+ Anil 38 180
26
+ Song 7 187
27
+ David 65 159
28
+ Lin 45 121
29
+ Ranjeeth 39 183
30
+ Torbjorn 26 181
31
+ Clifton 57 158
32
+ Phil 3 183
33
+ 4 72 1
34
+ Anh 2 187
35
+ Erling 69 226
36
+ Purav 0 199
37
+ Zejia 29 163
38
+ 4 98 2
39
+ Aravind 13 195
40
+ Bhuwan 94 192
41
+ Igor 85 183
42
+ Aleksandar 66 128
43
+ 19 86 5
44
+ Andras 13 108
45
+ David 90 125
46
+ Vladislav 11 103
47
+ Erling 90 119
48
+ Doan 20 207
49
+ Torbjorn 8 147
50
+ Yifei 26 210
51
+ Sanjeet 81 126
52
+ Meihong 38 108
53
+ Chi 60 173
54
+ Lingjuan 15 175
55
+ Yingsheng 92 143
56
+ Dhruv 80 168
57
+ Yingsheng 20 105
58
+ Anh 11 187
59
+ Saransh 38 199
60
+ Vladislav 3 197
61
+ Wesley 64 197
62
+ Wai 62 181
63
+ 29 69 1
64
+ Duc 76 228
65
+ Ekansh 78 102
66
+ Erling 0 125
67
+ Wei 46 202
68
+ Steaphan 83 119
69
+ Zihing 57 175
70
+ Andrii 74 239
71
+ Fabien 59 177
72
+ Zihing 30 122
73
+ John 21 113
74
+ Roman 32 136
75
+ Rudradev 45 213
76
+ Rajat 33 138
77
+ Weiyan 8 173
78
+ Roman 18 182
79
+ Yintao 93 234
80
+ Erling 10 219
81
+ Chad 51 142
82
+ Liang 34 200
83
+ Ekansh 25 111
84
+ Erling 87 147
85
+ Zef 22 219
86
+ Kittipat 37 108
87
+ Tom 17 159
88
+ Aravind 4 109
89
+ Andriy 5 198
90
+ Sanjeet 68 239
91
+ Chad 7 220
92
+ Zainab 37 205
93
+ 28 20 2
94
+ Yintao 12 206
95
+ Anh 11 178
96
+ Aleksandar 2 140
97
+ Jan 51 234
98
+ Kittipat 79 151
99
+ Zainab 71 169
100
+ Sanjeet 96 206
101
+ Wesley 74 201
102
+ Anh 27 184
103
+ Ahmed 73 171
104
+ Andrei 56 114
105
+ Dhruv 37 106
106
+ Ranjeeth 45 149
107
+ Lingjuan 77 113
108
+ Clifton 39 229
109
+ Ahmed 44 121
110
+ Ahmed 97 188
111
+ Lin 8 202
112
+ Slawek 39 174
113
+ Lingjuan 84 202
114
+ Zainab 30 130
115
+ Viswanath 70 107
116
+ Dmytro 1 115
117
+ Luiz 72 221
118
+ Steaphan 31 157
119
+ Gaurav 36 225
120
+ Liang 85 224
121
+ Anshuman 54 179
122
+ 10 78 2
123
+ Xiao 51 110
124
+ Philip 18 141
125
+ Zejia 51 227
126
+ Anshuman 100 183
127
+ Tom 12 193
128
+ Erling 36 190
129
+ Philip 0 160
130
+ Zhen 4 203
131
+ Atol 57 106
132
+ Wesley 15 101
133
+ 2 98 1
134
+ Lingjuan 65 193
135
+ Zejia 9 213
136
+ 16 21 5
137
+ Andrei 35 112
138
+ Andrei 66 130
139
+ Nima 42 117
140
+ Voja 96 150
141
+ Aleksandar 72 117
142
+ John 49 225
143
+ Roman 50 215
144
+ Aravind 28 143
145
+ Doan 65 136
146
+ Andrii 10 219
147
+ Vladislav 49 166
148
+ Keegan 66 140
149
+ Paul 29 158
150
+ Rudradev 2 174
151
+ David 47 197
152
+ Amol 4 104
153
+ 22 55 1
154
+ John 36 138
155
+ Mehdi 74 238
156
+ Torbjorn 24 240
157
+ Weitao 38 180
158
+ Roman 37 116
159
+ Voja 18 147
160
+ Xiao 11 186
161
+ Zejia 34 179
162
+ Wai 52 230
163
+ Yifei 29 114
164
+ Dhruv 72 239
165
+ Anshuman 67 179
166
+ John 35 134
167
+ Sharad 28 149
168
+ Atol 6 201
169
+ Ekansh 4 174
170
+ Fabien 93 168
171
+ Vasily 61 172
172
+ Weiyan 88 127
173
+ Ekansh 45 146
174
+ Jan 60 182
175
+ Josh 30 115
176
+ 7 52 1
177
+ John 61 186
178
+ Atol 62 231
179
+ Nathan 63 138
180
+ Lin 37 186
181
+ Daniel 37 171
182
+ Doan 99 226
183
+ Chad 37 196
184
+ 11 116 1
185
+ Daniel 89 224
186
+ Andriy 78 181
187
+ Chirag 91 206
188
+ Fabien 45 162
189
+ Wesley 31 166
190
+ Vasily 57 203
191
+ Wesley 88 174
192
+ Song 91 234
193
+ Purav 5 230
194
+ Andrei 88 178
195
+ Jordan 56 104
196
+ 24 119 3
197
+ Meihong 33 155
198
+ Lovro 46 175
199
+ Manohar 60 137
200
+ Nima 24 233
201
+ Erling 67 110
202
+ Viswanath 43 162
203
+ Andras 69 210
204
+ Yintao 59 116
205
+ Weitao 12 115
206
+ Weiyan 41 198
207
+ Erling 40 108
208
+ Weiyan 54 160
209
+ Yintao 88 211
210
+ Xiao 10 106
211
+ Chad 95 158
212
+ Weitao 28 124
213
+ Aleksandar 75 140
214
+ Wai 48 176
215
+ Anshuman 44 208
216
+ Anshuman 10 214
217
+ Bhuwan 32 231
218
+ Luiz 37 117
219
+ Josh 30 145
220
+ Lovro 33 175
221
+ 28 15 4
222
+ Oleksandr 34 111
223
+ Mehdi 62 194
224
+ Rudradev 52 123
225
+ Chad 9 215
226
+ Wenjie 49 197
227
+ Doan 86 132
228
+ Saransh 68 107
229
+ Clifton 34 212
230
+ Keegan 48 181
231
+ Ekansh 17 162
232
+ Purav 96 170
233
+ Atol 50 225
234
+ Dhruv 39 190
235
+ Zhen 47 108
236
+ Lovro 49 200
237
+ Nathan 39 168
238
+ Liang 39 224
239
+ Clifton 83 232
240
+ Paul 3 131
241
+ John 79 121
242
+ Ahmed 11 121
243
+ Viswanath 31 177
244
+ Dhruv 20 235
245
+ Song 53 184
246
+ Atol 92 195
247
+ John 72 123
248
+ Clifton 55 115
249
+ Rajat 13 214
250
+ 25 103 2
251
+ Sharad 11 217
252
+ Aravind 22 127
253
+ Thomas 91 212
254
+ John 68 199
255
+ Josh 92 160
256
+ Doan 43 205
257
+ Weiyan 1 125
258
+ Dhruv 47 227
259
+ John 15 154
260
+ Tom 25 141
261
+ Viswanath 87 177
262
+ Rajat 42 150
263
+ Lovro 83 116
264
+ Rudradev 19 167
265
+ Mehdi 90 213
266
+ Paul 10 235
267
+ Xiao 27 100
268
+ Sharad 89 226
269
+ Steaphan 69 228
270
+ David 17 111
271
+ Steaphan 16 200
272
+ Liang 30 206
273
+ Victor 61 125
274
+ Sanjeet 74 216
275
+ Weiyan 64 185
276
+ 19 1 4
277
+ Xiao 34 111
278
+ Ranjeeth 96 194
279
+ Luiz 46 224
280
+ Meihong 39 181
281
+ Andrei 46 176
282
+ Anil 46 113
283
+ Roman 61 197
284
+ Weitao 79 148
285
+ Andras 44 220
286
+ Nima 67 102
287
+ Weitao 79 193
288
+ Anh 74 234
289
+ Fabien 41 125
290
+ Weitao 65 214
291
+ Keegan 22 185
292
+ Zejia 10 217
293
+ Zihing 100 208
294
+ Philip 36 113
295
+ Steaphan 68 120
296
+ 30 104 4
297
+ Slawek 65 198
298
+ Zhen 15 233
299
+ Dmytro 26 215
300
+ Yintao 93 225
301
+ Oleksandr 35 169
302
+ Viswanath 14 197
303
+ Rajat 8 219
304
+ Anil 72 202
305
+ Meihong 97 114
306
+ Doan 76 222
307
+ Fabien 78 179
308
+ Jan 28 131
309
+ Chirag 40 233
310
+ Tom 98 102
311
+ Zejia 47 130
312
+ Paul 82 119
313
+ Steaphan 41 210
314
+ Duc 10 225
315
+ Xiao 13 207
316
+ Manohar 97 107
317
+ Dhruv 17 100
318
+ Weiyan 44 214
319
+ Anshuman 70 124
320
+ Yifei 69 153
321
+ Fabien 45 186
322
+ Xiao 63 120
323
+ Purav 34 157
324
+ Bhuwan 39 231
325
+ Saransh 51 219
326
+ John 35 126
327
+ 25 21 2
328
+ Keegan 80 196
329
+ Lin 47 184
330
+ Purav 21 142
331
+ Dhruv 8 198
332
+ Nima 9 233
333
+ John 57 141
334
+ Chi 40 176
335
+ Aravind 31 101
336
+ Oleksandr 97 240
337
+ Kittipat 91 208
338
+ Igor 28 178
339
+ Keegan 62 149
340
+ Vasily 89 103
341
+ Victor 59 107
342
+ Lin 57 140
343
+ Gaurav 3 195
344
+ Viswanath 69 178
345
+ Yintao 85 228
346
+ Saransh 97 129
347
+ Rajat 86 193
348
+ Jan 13 198
349
+ Anh 71 183
350
+ Anil 18 137
351
+ Sanjeet 12 180
352
+ Mehdi 28 129
353
+ 14 18 5
354
+ Jordan 38 176
355
+ Igor 95 146
356
+ Viswanath 39 130
357
+ Gaurav 62 118
358
+ Vladislav 97 231
359
+ Duc 54 102
360
+ Fabien 68 231
361
+ Rudradev 48 203
362
+ Doan 99 154
363
+ Thomas 11 142
364
+ Song 77 189
365
+ John 98 109
366
+ John 9 202
367
+ Liang 63 161
368
+ 4 115 2
369
+ Manohar 16 215
370
+ Meihong 87 208
371
+ Anshuman 95 154
372
+ Nima 92 132
373
+ 24 80 3
374
+ Amol 52 169
375
+ David 35 118
376
+ Dmytro 37 222
377
+ Manohar 40 179
378
+ Roman 83 107
379
+ Tom 43 238
380
+ John 31 220
381
+ Tom 60 169
382
+ Paul 46 187
383
+ Steaphan 81 123
384
+ Andriy 26 103
385
+ Chad 99 101
386
+ Jan 31 129
387
+ Torbjorn 84 207
388
+ Slawek 28 159
389
+ Nathan 40 140
390
+ Daniel 61 129
391
+ Yintao 52 162
392
+ Ekansh 14 223
393
+ Sharad 53 232
394
+ Josh 51 174
395
+ Anil 86 206
396
+ Atol 0 218
397
+ Torbjorn 40 141
398
+ 25 50 5
399
+ Aleksandar 34 200
400
+ Zihing 41 124
401
+ Andrii 14 226
402
+ Voja 91 228
403
+ Lin 83 182
404
+ Erling 53 150
405
+ Liang 74 233
406
+ Luiz 49 125
407
+ Atol 9 182
408
+ Yingsheng 82 170
409
+ Nima 71 228
410
+ Rudradev 99 142
411
+ Song 24 221
412
+ Chad 39 195
413
+ Bhuwan 54 146
414
+ Bhuwan 12 233
415
+ Zainab 88 180
416
+ Voja 79 135
417
+ Purav 79 203
418
+ Fabien 90 230
419
+ Nathan 12 148
420
+ Ranjeeth 75 133
421
+ Vladislav 88 148
422
+ Viswanath 61 158
423
+ Luiz 13 163
424
+ 23 82 3
425
+ Lingjuan 50 198
426
+ Zhen 74 108
427
+ Ranjeeth 48 192
428
+ Wesley 64 176
429
+ Saransh 22 204
430
+ Mehdi 68 117
431
+ Wei 25 102
432
+ Jan 97 150
433
+ Torbjorn 12 198
434
+ Jan 41 170
435
+ Xiao 12 237
436
+ Xiao 27 171
437
+ Gaurav 87 237
438
+ Andriy 90 178
439
+ David 72 235
440
+ Oleksandr 30 190
441
+ Ekansh 7 155
442
+ Zihing 80 196
443
+ Wenjie 7 166
444
+ Zhen 64 214
445
+ Yingsheng 0 139
446
+ Andriy 79 166
447
+ Ajay 78 152
448
+ 19 109 3
449
+ Atol 21 171
450
+ Jan 56 128
451
+ Yintao 17 176
452
+ Ekansh 44 194
453
+ Jan 40 216
454
+ Ahmed 26 219
455
+ Victor 82 131
456
+ Amol 33 174
457
+ Doan 16 175
458
+ Zejia 9 214
459
+ Viswanath 68 139
460
+ Kittipat 93 124
461
+ Ajay 35 103
462
+ Anil 1 185
463
+ Paul 6 217
464
+ Zihing 34 196
465
+ Aravind 60 183
466
+ Rudradev 48 163
467
+ Wenjie 19 229
468
+ 25 98 1
469
+ Aravind 7 216
470
+ Ekansh 57 142
471
+ Zainab 95 117
472
+ Josh 83 236
473
+ Lin 86 185
474
+ Andrei 82 184
475
+ Victor 75 130
476
+ Doan 81 178
477
+ Liang 38 221
478
+ Ahmed 44 212
479
+ Chirag 62 101
480
+ Sarang 9 186
481
+ Meihong 76 167
482
+ Philip 27 105
483
+ John 53 226
484
+ Andrii 75 152
485
+ Vladislav 75 221
486
+ Doan 96 152
487
+ Andrei 40 180
488
+ Dhruv 73 231
489
+ Vladislav 66 195
490
+ Jordan 65 231
491
+ Slawek 59 124
492
+ Anil 5 202
493
+ Viswanath 82 136
494
+ 18 95 2
495
+ Liang 53 146
496
+ Wesley 12 197
497
+ Wenjie 86 238
498
+ Manohar 94 129
499
+ Anshuman 27 180
500
+ Chi 73 162
501
+ David 16 238
502
+ Purav 57 227
503
+ Wai 42 196
504
+ Chad 48 239
505
+ Zainab 46 175
506
+ Wai 98 114
507
+ Chi 45 209
508
+ Paul 17 135
509
+ Paul 10 171
510
+ Atol 23 162
511
+ Yifei 99 197
512
+ Wei 0 164
513
+ 10 57 3
514
+ Fabien 0 111
515
+ Duc 49 198
516
+ Ekansh 98 121
517
+ Zef 30 122
518
+ Dmytro 50 124
519
+ Chirag 39 209
520
+ Doan 20 229
521
+ Clifton 50 129
522
+ Andrei 91 177
523
+ Erling 0 118
2014/quals/basketball_game.md ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ A group of **N** high school students wants to play a basketball game. To
2
+ divide themselves into two teams they first rank all the players in the
3
+ following way:
4
+
5
+ * Players with a higher shot percentage are rated higher than players with a lower shot percentage.
6
+ * If two players have the same shot percentage, the taller player is rated higher.
7
+
8
+ Luckily there are no two players with both the same shot percentage and height
9
+ so they are able to order themselves in an unambiguous way. Based on that
10
+ ordering each player is assigned a draft number from the range [1..**N**],
11
+ where the highest-rated player gets the number 1, the second highest-rated
12
+ gets the number 2, and so on. Now the first team contains all the players with
13
+ the odd draft numbers and the second team all the players with the even draft
14
+ numbers.
15
+
16
+ Each team can only have **P** players playing at a time, so to ensure that
17
+ everyone gets similar time on the court both teams will rotate their players
18
+ according to the following algorithm:
19
+
20
+ * Each team starts the game with the **P** players who have the lowest draft numbers.
21
+ * If there are more than **P** players on a team after each minute of the game the player with the highest total time played leaves the playing field. Ties are broken by the player with the higher draft number leaving first.
22
+ * To replace her the player on the bench with the lowest total time played joins the game. Ties are broken by the player with the lower draft number entering first.
23
+
24
+ The game has been going on for **M** minutes now. Your task is to print out
25
+ the names of all the players currently on the field, (that is after **M**
26
+ rotations).
27
+
28
+ ### Input
29
+
30
+ The first line of the input consists of a single number **T**, the number of
31
+ test cases.
32
+
33
+ Each test case starts with a line containing three space separated integers
34
+ **N** **M** **P**
35
+
36
+ The subsequent **N** lines are in the format "<name> <shot_percentage>
37
+ <height>". See the example for clarification.
38
+
39
+ ### Constraints
40
+
41
+ 1 ≤ **T** ≤ 50
42
+ 2 * **P** ≤ **N** ≤ 30
43
+ 1 ≤ **M** ≤ 120
44
+ 1 ≤ **P** ≤ 5
45
+ Each name starts with an uppercase English letter, followed by 0 to 20
46
+ lowercase English letters.
47
+ There can be players sharing the same name.
48
+ Each shot percentage is an integer from the range [0..100].
49
+ Each height is an integer from the range [100..240].
50
+
51
+ ### Output
52
+
53
+ For each test case **i** numbered from 1 to **T**, output "Case #**i**: ",
54
+ followed by 2 * **P** space separated names of the players playing after **M**
55
+ rotations. The names should be printed in lexicographical order.
56
+
57
+ ### Example
58
+
59
+ In the first example if you sort all the players by their shot percentage you
60
+ get the list: [Wai, Purav, Weiyan, Slawek, Lin, Meihong]. This makes the two
61
+ teams:
62
+
63
+ [Wai, Weiyan, Lin] [Purav, Slawek, Meihong]
64
+
65
+ The game starts with Lin and Meihong sitting on the bench in their respective
66
+ teams. After the first minute passes it's time for Weiyan and Slawek to sit
67
+ out since they have the highest draft numbers of the people who played. After
68
+ the second minute passes Lin and Meihong will keep playing since they only
69
+ played one minute so far and it's Wai and Purav who have to sit out.
70
+
71
+ Finally after the third minute Lin and Maihong go back to the bench and all
72
+ the players currently playing again are:
73
+ Purav Slawek Wai Weiyan
74
+
2014/quals/basketball_game.out ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Case #1: Purav Slawek Wai Weiyan
2
+ Case #2: Fabien Kittipat Liang Paul
3
+ Case #3: Bhuwan Duc Fabien Meihong Vlad Wai
4
+ Case #4: Anil Lin Phil Ranjeeth Song Torbjorn
5
+ Case #5: Erling Zejia
6
+ Case #6: Aleksandar Aravind Bhuwan Igor
7
+ Case #7: Andras Anh Doan Lingjuan Meihong Saransh Torbjorn Vladislav Vladislav Yingsheng
8
+ Case #8: Aravind Ekansh
9
+ Case #9: Ahmed Anshuman Jan Ranjeeth
10
+ Case #10: Philip Tom Wesley Zhen
11
+ Case #11: Lingjuan Zejia
12
+ Case #12: Amol Andrei Andrii Aravind David John Nima Paul Rudradev Vladislav
13
+ Case #13: Fabien Weiyan
14
+ Case #14: Doan John
15
+ Case #15: Andrei Wesley
16
+ Case #16: Aleksandar Andras Anshuman Erling Manohar Xiao
17
+ Case #17: Atol Clifton Clifton Doan John John Purav Song
18
+ Case #18: Aravind Mehdi Weiyan Xiao
19
+ Case #19: Anh Luiz Ranjeeth Roman Steaphan Weitao Weitao Zihing
20
+ Case #20: Anil Doan Duc Fabien Manohar Paul Rajat Yintao
21
+ Case #21: Anil Igor Purav Sanjeet
22
+ Case #22: Doan Duc Gaurav John John Jordan Liang Rudradev Thomas Viswanath
23
+ Case #23: Anshuman Manohar Meihong Nima
24
+ Case #24: Andriy David Dmytro Jan John Slawek
25
+ Case #25: Atol Bhuwan Bhuwan Lin Nima Vladislav Voja Voja Yingsheng Zainab
26
+ Case #26: Andriy Jan Lingjuan Wenjie Xiao Yingsheng
27
+ Case #27: Anil Aravind Jan Jan Victor Viswanath
28
+ Case #28: Chirag Viswanath
29
+ Case #29: Anshuman Atol Paul Wai
30
+ Case #30: Andrei Doan Ekansh Erling Fabien Zef
2014/quals/square_detector.html ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <p>
2
+ You want to write an image detection system that is able to recognize different geometric shapes.
3
+ In the first version of the system you settled with just being able to detect filled squares on a grid.</p>
4
+ <p>
5
+ You are given a grid of <strong>N</strong>&times;<strong>N</strong> square cells. Each cell is either white or black. Your task is to detect whether all the black cells form a square shape.
6
+ </p>
7
+
8
+ <h3>Input</h3>
9
+ <p>
10
+ The first line of the input consists of a single number <strong>T</strong>, the number of test
11
+ cases.
12
+ </p>
13
+ <p>
14
+ Each test case starts with a line containing a single integer <strong>N</strong>. Each of the subsequent <strong>N</strong> lines contain <strong>N</strong> characters. Each character is either "." symbolizing a white cell, or "#" symbolizing a black cell. Every test case contains at least one black cell.
15
+ </p>
16
+
17
+ <h3>Output</h3>
18
+ <p>
19
+ For each test case <strong>i</strong> numbered from 1 to <strong>T</strong>, output "Case #<strong>i</strong>: ", followed by <samp>YES</samp> or <samp>NO</samp> depending on whether or not all the black cells form a completely filled square with edges parallel to the grid of cells.
20
+ </p>
21
+
22
+ <h3>Constraints</h3>
23
+ <p>
24
+ 1 &le; <strong>T</strong> &le; 20<br />
25
+ 1 &le; <strong>N</strong> &le; 20
26
+ </p>
27
+ <h3>Example</h3>
28
+ <p> Test cases 1 and 5 represent valid squares. Case 2 has an extra cell that is outside of the square. Case 3 shows a square not filled inside. And case 4 is a rectangle but not a square.</p>
2014/quals/square_detector.in ADDED
@@ -0,0 +1,343 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 25
2
+ 4
3
+ ..##
4
+ ..##
5
+ ....
6
+ ....
7
+ 4
8
+ ..##
9
+ ..##
10
+ #...
11
+ ....
12
+ 4
13
+ ####
14
+ #..#
15
+ #..#
16
+ ####
17
+ 5
18
+ #####
19
+ #####
20
+ #####
21
+ #####
22
+ .....
23
+ 5
24
+ #####
25
+ #####
26
+ #####
27
+ #####
28
+ #####
29
+ 1
30
+ #
31
+ 10
32
+ ..........
33
+ ..........
34
+ .......###
35
+ .......###
36
+ .......###
37
+ ..........
38
+ ..........
39
+ ..........
40
+ ..........
41
+ ..........
42
+ 10
43
+ ..........
44
+ ..........
45
+ ..........
46
+ ...##.....
47
+ ...##.....
48
+ ...##.....
49
+ ..........
50
+ ..........
51
+ ..........
52
+ ..........
53
+ 10
54
+ ..........
55
+ ..........
56
+ ..........
57
+ .....#....
58
+ ..........
59
+ ..#.......
60
+ ..........
61
+ ..........
62
+ ..........
63
+ ..........
64
+ 10
65
+ ..........
66
+ .######...
67
+ .#####.#..
68
+ .######...
69
+ .######...
70
+ .######...
71
+ .######...
72
+ ..........
73
+ ..........
74
+ ..........
75
+ 10
76
+ ..........
77
+ ..........
78
+ .##.......
79
+ .##.......
80
+ ..........
81
+ ..........
82
+ ......##..
83
+ ......##..
84
+ ..........
85
+ ..........
86
+ 10
87
+ ..........
88
+ ..........
89
+ ####......
90
+ ####......
91
+ ####......
92
+ ####......
93
+ ..........
94
+ ..........
95
+ ..........
96
+ .........#
97
+ 10
98
+ ..........
99
+ ..........
100
+ ..........
101
+ ..........
102
+ ..........
103
+ ..........
104
+ ..........
105
+ ..........
106
+ ..........
107
+ .........#
108
+ 20
109
+ ....................
110
+ ....................
111
+ ....................
112
+ ....................
113
+ ....................
114
+ ....................
115
+ ....................
116
+ ....................
117
+ ....................
118
+ ....................
119
+ ....................
120
+ ...........#########
121
+ ...........#########
122
+ ...........#########
123
+ ...........#########
124
+ ...........#########
125
+ ...........#########
126
+ ...........#########
127
+ ...........#########
128
+ ...........#########
129
+ 20
130
+ ####################
131
+ ####################
132
+ ####################
133
+ ####################
134
+ ####################
135
+ ####################
136
+ ####################
137
+ ####################
138
+ ####################
139
+ ####################
140
+ ####################
141
+ ####################
142
+ ####################
143
+ ####################
144
+ ####################
145
+ ####################
146
+ ####################
147
+ ####################
148
+ ####################
149
+ ####################
150
+ 20
151
+ ....................
152
+ ....................
153
+ ....................
154
+ ....................
155
+ ....................
156
+ ....................
157
+ ....................
158
+ ....................
159
+ ....................
160
+ ....................
161
+ ....................
162
+ .......#####........
163
+ .......#####........
164
+ .......#####........
165
+ .......#####........
166
+ ....................
167
+ ....................
168
+ ....................
169
+ ....................
170
+ ....................
171
+ 20
172
+ ..############......
173
+ ..############......
174
+ ..############......
175
+ ..############......
176
+ ..############......
177
+ ..############......
178
+ ..############......
179
+ ..############......
180
+ ..############......
181
+ ..############......
182
+ ..############......
183
+ ....................
184
+ ....................
185
+ ....................
186
+ ....................
187
+ ....................
188
+ ....................
189
+ ....................
190
+ ....................
191
+ ....................
192
+ 20
193
+ ....................
194
+ ....................
195
+ ....................
196
+ ....................
197
+ ....................
198
+ ....................
199
+ ###.................
200
+ ###.................
201
+ ###.................
202
+ ....................
203
+ ....................
204
+ ....................
205
+ ....................
206
+ ....................
207
+ ....................
208
+ ....................
209
+ ....................
210
+ ....................
211
+ ....................
212
+ ...............#....
213
+ 20
214
+ ....................
215
+ ....................
216
+ ....................
217
+ ....................
218
+ ########..#######...
219
+ ########..########..
220
+ ##........##....##..
221
+ ##........##....##..
222
+ ########..#######...
223
+ ########..########..
224
+ ##........##....##..
225
+ ##........##....##..
226
+ ##........########..
227
+ ##........#######...
228
+ ....................
229
+ ....................
230
+ ....................
231
+ ....................
232
+ ....................
233
+ ....................
234
+ 20
235
+ ####################
236
+ ####################
237
+ ####################
238
+ ####################
239
+ ####################
240
+ ####################
241
+ ####################
242
+ ####################
243
+ ####################
244
+ ####################
245
+ ####################
246
+ ####################
247
+ ####################
248
+ ####################
249
+ ####################
250
+ ####################
251
+ ####################
252
+ ####################
253
+ ####################
254
+ ###################.
255
+ 20
256
+ .###################
257
+ ####################
258
+ ####################
259
+ ####################
260
+ ####################
261
+ ####################
262
+ ####################
263
+ ####################
264
+ ####################
265
+ ####################
266
+ ####################
267
+ ####################
268
+ ####################
269
+ ####################
270
+ ####################
271
+ ####################
272
+ ####################
273
+ ####################
274
+ ####################
275
+ ####################
276
+ 20
277
+ ....................
278
+ ################....
279
+ ################....
280
+ ################....
281
+ ################....
282
+ ################....
283
+ ################....
284
+ ################....
285
+ ################....
286
+ ################....
287
+ ################....
288
+ ################....
289
+ ################....
290
+ ################....
291
+ ################....
292
+ ################....
293
+ ....................
294
+ ....................
295
+ ....................
296
+ ....................
297
+ 20
298
+ ....................
299
+ ....................
300
+ ....................
301
+ ....................
302
+ ....................
303
+ ....................
304
+ ....................
305
+ ....................
306
+ ....................
307
+ ....................
308
+ ....................
309
+ ....................
310
+ ....................
311
+ ..........######....
312
+ ..........######....
313
+ ..........######....
314
+ ..........######....
315
+ ..........######....
316
+ ..........######....
317
+ ....................
318
+ 20
319
+ ....................
320
+ ....................
321
+ ....................
322
+ ....................
323
+ ....................
324
+ ....................
325
+ ....................
326
+ ....................
327
+ ....................
328
+ ....................
329
+ ....................
330
+ ....................
331
+ ....................
332
+ ....................
333
+ ....................
334
+ ....................
335
+ ....................
336
+ ....................
337
+ .......##...........
338
+ .......##...........
339
+ 4
340
+ ###.
341
+ .###
342
+ .###
343
+ ....
2014/quals/square_detector.md ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ You want to write an image detection system that is able to recognize
2
+ different geometric shapes. In the first version of the system you settled
3
+ with just being able to detect filled squares on a grid.
4
+
5
+ You are given a grid of **N**×**N** square cells. Each cell is either white or
6
+ black. Your task is to detect whether all the black cells form a square shape.
7
+
8
+ ### Input
9
+
10
+ The first line of the input consists of a single number **T**, the number of
11
+ test cases.
12
+
13
+ Each test case starts with a line containing a single integer **N**. Each of
14
+ the subsequent **N** lines contain **N** characters. Each character is either
15
+ "." symbolizing a white cell, or "#" symbolizing a black cell. Every test case
16
+ contains at least one black cell.
17
+
18
+ ### Output
19
+
20
+ For each test case **i** numbered from 1 to **T**, output "Case #**i**: ",
21
+ followed by YES or NO depending on whether or not all the black cells form a
22
+ completely filled square with edges parallel to the grid of cells.
23
+
24
+ ### Constraints
25
+
26
+ 1 ≤ **T** ≤ 20
27
+ 1 ≤ **N** ≤ 20
28
+
29
+ ### Example
30
+
31
+ Test cases 1 and 5 represent valid squares. Case 2 has an extra cell that is
32
+ outside of the square. Case 3 shows a square not filled inside. And case 4 is
33
+ a rectangle but not a square.
34
+
2014/quals/square_detector.out ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Case #1: YES
2
+ Case #2: NO
3
+ Case #3: NO
4
+ Case #4: NO
5
+ Case #5: YES
6
+ Case #6: YES
7
+ Case #7: YES
8
+ Case #8: NO
9
+ Case #9: NO
10
+ Case #10: NO
11
+ Case #11: NO
12
+ Case #12: NO
13
+ Case #13: YES
14
+ Case #14: YES
15
+ Case #15: YES
16
+ Case #16: NO
17
+ Case #17: NO
18
+ Case #18: NO
19
+ Case #19: NO
20
+ Case #20: NO
21
+ Case #21: NO
22
+ Case #22: NO
23
+ Case #23: YES
24
+ Case #24: YES
25
+ Case #25: NO
2014/quals/tennison.html ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <p>You may be familiar with the works of Alfred, Lord Tennyson, the famous
2
+ English poet. In this problem we will concern ourselves with Tennison,
3
+ the less famous English tennis player. As you know, tennis is not so much
4
+ a game of skill as a game of luck and weather patterns. The goal of tennis is
5
+ to win <strong>K</strong> sets before the other player. However, the chance of winning a set is
6
+ largely dependent on whether or not there is weather.
7
+ </p>
8
+
9
+ <p>Tennison plays best when it's sunny, but sometimes, of course, it rains.
10
+ Tennison wins a set with probability <strong>p<sub>s</sub></strong> when it's sunny, and with probability
11
+ <strong>p<sub>r</sub></strong> when it's raining. The chance that there will be sun for the first set is
12
+ <strong>p<sub>i</sub></strong>. Luckily for Tennison, whenever he wins a set, the probability that there
13
+ will be sun increases by <strong>p<sub>u</sub></strong> with probability <strong>p<sub>w</sub></strong>. Unfortunately, when Tennison
14
+ loses a set, the probability of sun decreases by <strong>p<sub>d</sub></strong> with probability <strong>p<sub>l</sub></strong>.
15
+ What is the chance that Tennison will be successful in his match?</p>
16
+
17
+ <p>Rain and sun are the only weather conditions, so P(rain) = 1 - P(sun) at all
18
+ times. Also, probabilities always stay in the range [0, 1]. If P(sun) would
19
+ ever be less than 0, it is instead 0. If it would ever be greater than 1, it
20
+ is instead 1.</p>
21
+
22
+
23
+ <h2>Input</h2>
24
+ <p>
25
+ Input begins with an integer <strong>T</strong>, the number of tennis matches
26
+ that Tennison plays. For each match, there is a line containing an integer
27
+ <strong>K</strong>, followed by the
28
+ probabilities <strong>p<sub>s</sub>, p<sub>r</sub>, p<sub>i</sub>, p<sub>u</sub>, p<sub>w</sub>, p<sub>d</sub>, p<sub>l</sub></strong> in that order. All of these
29
+ values are given with exactly three places after the decimal point.
30
+
31
+
32
+ <h2>Output</h2>
33
+ <p>
34
+ For each match, output "Case #i: " followed by the probability that Tennison wins the match, rounded to 6 decimal places
35
+ (quotes for clarity only). It is guaranteed that the output is unaffected by deviations as large as 10<sup>-8</sup>.
36
+ </p>
37
+
38
+ <h2>Constraints</h2>
39
+ <ul>
40
+ <li>1 &le; <strong>T</strong> &le; 100</li>
41
+ <li>1 &le; <strong>K</strong> &le; 100</li>
42
+ <li>0 &le; <strong>p<sub>s</sub>, p<sub>r</sub>, p<sub>i</sub>, p<sub>u</sub>, p<sub>w</sub>, p<sub>d</sub>, p<sub>l</sub></strong> &le; 1</li>
43
+ <li><strong>p<sub>s</sub></strong> &gt; <strong>p<sub>r</sub></strong></li>
44
+ </ul>
2014/quals/tennison.in ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 92
2
+ 1 0.800 0.100 0.500 0.500 0.500 0.500 0.500
3
+ 2 0.600 0.200 0.500 0.100 1.000 0.100 1.000
4
+ 1 1.000 0.000 1.000 1.000 1.000 1.000 1.000
5
+ 25 0.984 0.222 0.993 0.336 0.207 0.084 0.478
6
+ 58 0.472 0.182 0.418 0.097 0.569 0.816 0.711
7
+ 27 0.620 0.014 0.817 0.451 0.090 0.229 0.504
8
+ 8 0.838 0.389 0.829 0.592 0.594 0.669 0.480
9
+ 2 0.180 0.156 0.548 0.790 0.004 0.311 0.019
10
+ 62 0.740 0.653 0.323 0.642 0.837 0.773 0.610
11
+ 28 0.918 0.381 0.851 0.346 0.278 0.369 0.757
12
+ 89 0.812 0.547 0.657 0.131 0.302 0.379 0.955
13
+ 67 0.213 0.172 0.842 0.786 0.933 0.253 0.273
14
+ 75 0.583 0.469 0.241 0.940 0.053 0.770 0.129
15
+ 27 0.576 0.415 0.480 0.105 0.952 0.391 0.633
16
+ 59 0.060 0.031 0.085 0.919 0.931 0.539 0.372
17
+ 53 0.355 0.185 0.299 0.939 0.295 0.063 0.155
18
+ 17 0.706 0.216 0.713 0.435 0.885 0.951 0.396
19
+ 10 0.708 0.493 0.709 0.273 0.687 0.353 0.593
20
+ 58 0.667 0.638 0.471 0.028 0.597 0.439 0.945
21
+ 61 0.633 0.071 0.634 0.946 0.641 0.946 0.710
22
+ 99 0.835 0.833 0.989 0.059 0.672 0.824 0.508
23
+ 37 0.399 0.287 0.317 0.870 0.520 0.686 0.954
24
+ 87 0.447 0.384 0.187 0.898 0.240 0.964 0.301
25
+ 40 0.114 0.096 0.671 0.372 0.708 0.742 0.378
26
+ 85 0.705 0.704 0.874 0.098 0.324 0.252 0.534
27
+ 38 0.887 0.847 0.004 0.716 0.148 0.543 0.058
28
+ 71 0.649 0.181 0.358 0.197 0.773 0.810 0.348
29
+ 50 0.718 0.450 0.928 0.207 0.675 0.390 0.937
30
+ 95 0.394 0.045 0.961 0.263 0.896 0.214 0.382
31
+ 25 0.674 0.528 0.625 0.971 0.805 0.782 0.177
32
+ 80 0.580 0.480 0.189 0.356 0.890 0.732 0.662
33
+ 11 0.698 0.348 0.651 0.528 0.828 0.526 0.129
34
+ 7 0.845 0.096 0.965 0.401 0.698 0.213 0.703
35
+ 47 0.960 0.088 0.081 0.628 0.777 0.948 0.515
36
+ 42 0.890 0.226 0.829 0.910 0.700 0.045 0.566
37
+ 66 0.820 0.682 0.189 0.313 0.558 0.181 0.919
38
+ 42 0.219 0.065 0.968 0.173 0.045 0.878 0.889
39
+ 37 0.916 0.809 0.178 0.801 0.235 0.996 0.077
40
+ 99 0.753 0.662 0.810 0.984 0.645 0.511 0.015
41
+ 78 0.603 0.393 0.706 0.415 0.422 0.564 0.083
42
+ 65 0.477 0.013 0.439 0.346 0.125 0.582 0.894
43
+ 13 0.556 0.023 0.797 0.208 0.603 0.820 0.890
44
+ 83 0.449 0.407 0.053 0.078 0.212 0.345 0.121
45
+ 47 0.919 0.906 0.703 0.151 0.851 0.311 0.505
46
+ 41 0.433 0.015 0.159 0.938 0.137 0.191 0.507
47
+ 45 0.889 0.664 0.232 0.454 0.785 0.637 0.611
48
+ 13 0.600 0.495 0.830 0.178 0.768 0.678 0.387
49
+ 59 0.916 0.520 0.917 0.588 0.808 0.719 0.404
50
+ 97 0.847 0.236 0.244 0.150 0.361 0.734 0.242
51
+ 21 0.588 0.423 0.572 0.307 0.703 0.268 0.000
52
+ 6 0.807 0.331 0.737 0.825 0.406 0.018 0.704
53
+ 52 0.799 0.361 0.083 0.223 0.593 0.354 0.895
54
+ 26 0.928 0.246 0.915 0.726 0.009 0.732 0.041
55
+ 27 0.828 0.611 0.901 0.082 0.043 0.435 0.723
56
+ 12 0.915 0.628 0.785 0.748 0.986 0.089 0.091
57
+ 35 0.721 0.098 0.455 0.201 0.752 0.090 0.297
58
+ 3 0.589 0.284 0.742 0.325 0.342 0.370 0.512
59
+ 14 0.572 0.439 0.467 0.725 0.471 0.556 0.085
60
+ 12 0.743 0.714 0.911 0.552 0.964 0.776 0.356
61
+ 67 0.329 0.065 0.937 0.810 0.385 0.159 0.381
62
+ 3 0.532 0.063 0.517 0.565 0.208 0.142 0.525
63
+ 21 0.545 0.188 0.239 0.929 0.709 0.554 0.356
64
+ 34 0.464 0.371 0.105 0.424 0.121 0.433 0.857
65
+ 92 0.383 0.095 0.110 0.799 0.490 0.795 0.312
66
+ 26 0.928 0.032 0.852 0.335 0.771 0.136 0.471
67
+ 50 0.578 0.060 0.723 0.176 0.456 0.935 0.488
68
+ 55 0.571 0.148 0.741 0.231 0.824 0.618 0.671
69
+ 73 0.733 0.648 0.371 0.866 0.469 0.782 0.003
70
+ 64 0.219 0.179 0.825 0.561 0.154 0.754 0.543
71
+ 28 0.533 0.166 0.964 0.588 0.681 0.652 0.211
72
+ 32 0.958 0.820 0.554 0.677 0.849 0.905 0.797
73
+ 41 0.411 0.033 0.972 0.669 0.828 0.748 0.402
74
+ 40 0.763 0.659 0.378 0.149 0.117 0.487 0.657
75
+ 93 0.840 0.170 0.216 0.738 0.031 0.854 0.345
76
+ 99 0.882 0.661 0.805 0.288 0.495 0.955 0.788
77
+ 5 0.360 0.102 0.939 0.331 0.806 0.837 0.328
78
+ 7 0.646 0.195 0.437 0.617 0.120 0.642 0.828
79
+ 99 0.731 0.067 0.977 0.213 0.573 0.793 0.888
80
+ 55 0.419 0.097 0.088 0.922 0.455 0.094 0.638
81
+ 15 0.514 0.308 0.711 0.295 0.287 0.827 0.991
82
+ 20 0.284 0.273 0.854 0.914 0.086 0.198 0.653
83
+ 65 0.964 0.395 0.549 0.741 0.686 0.702 0.686
84
+ 86 0.893 0.699 0.423 0.734 0.127 0.997 0.018
85
+ 29 0.767 0.586 0.279 0.921 0.407 0.019 0.732
86
+ 18 0.299 0.181 0.255 0.016 0.760 0.497 0.791
87
+ 58 0.239 0.204 0.010 0.535 0.911 0.130 0.369
88
+ 62 0.719 0.156 0.014 0.837 0.613 0.376 0.707
89
+ 92 0.851 0.655 0.970 0.768 0.448 0.576 0.394
90
+ 86 0.633 0.095 0.166 0.183 0.960 0.823 0.176
91
+ 86 0.579 0.110 0.861 0.275 0.848 0.350 0.123
92
+ 53 0.623 0.075 0.451 0.830 0.258 0.036 0.105
93
+ 30 0.889 0.482 0.277 0.194 0.392 0.339 0.886
2014/quals/tennison.md ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ You may be familiar with the works of Alfred, Lord Tennyson, the famous
2
+ English poet. In this problem we will concern ourselves with Tennison, the
3
+ less famous English tennis player. As you know, tennis is not so much a game
4
+ of skill as a game of luck and weather patterns. The goal of tennis is to win
5
+ **K** sets before the other player. However, the chance of winning a set is
6
+ largely dependent on whether or not there is weather.
7
+
8
+ Tennison plays best when it's sunny, but sometimes, of course, it rains.
9
+ Tennison wins a set with probability **ps** when it's sunny, and with
10
+ probability **pr** when it's raining. The chance that there will be sun for
11
+ the first set is **pi**. Luckily for Tennison, whenever he wins a set, the
12
+ probability that there will be sun increases by **pu** with probability
13
+ **pw**. Unfortunately, when Tennison loses a set, the probability of sun
14
+ decreases by **pd** with probability **pl**. What is the chance that Tennison
15
+ will be successful in his match?
16
+
17
+ Rain and sun are the only weather conditions, so P(rain) = 1 - P(sun) at all
18
+ times. Also, probabilities always stay in the range [0, 1]. If P(sun) would
19
+ ever be less than 0, it is instead 0. If it would ever be greater than 1, it
20
+ is instead 1.
21
+
22
+ ## Input
23
+
24
+ Input begins with an integer **T**, the number of tennis matches that Tennison
25
+ plays. For each match, there is a line containing an integer **K**, followed
26
+ by the probabilities **ps, pr, pi, pu, pw, pd, pl** in that order. All of
27
+ these values are given with exactly three places after the decimal point.
28
+
29
+ ## Output
30
+
31
+ For each match, output "Case #i: " followed by the probability that Tennison
32
+ wins the match, rounded to 6 decimal places (quotes for clarity only). It is
33
+ guaranteed that the output is unaffected by deviations as large as 10-8.
34
+
35
+ ## Constraints
36
+
37
+ * 1 ≤ **T** ≤ 100
38
+ * 1 ≤ **K** ≤ 100
39
+ * 0 ≤ **ps, pr, pi, pu, pw, pd, pl** ≤ 1
40
+ * **ps** > **pr**
41
+
2014/quals/tennison.out ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Case #1: 0.450000
2
+ Case #2: 0.352000
3
+ Case #3: 1.000000
4
+ Case #4: 0.999956
5
+ Case #5: 0.000000
6
+ Case #6: 0.008258
7
+ Case #7: 0.885871
8
+ Case #8: 0.076117
9
+ Case #9: 0.999998
10
+ Case #10: 0.812133
11
+ Case #11: 0.956193
12
+ Case #12: 0.000000
13
+ Case #13: 0.551872
14
+ Case #14: 0.241770
15
+ Case #15: 0.000000
16
+ Case #16: 0.000427
17
+ Case #17: 0.452012
18
+ Case #18: 0.834152
19
+ Case #19: 0.998829
20
+ Case #20: 0.000044
21
+ Case #21: 1.000000
22
+ Case #22: 0.001462
23
+ Case #23: 0.009297
24
+ Case #24: 0.000000
25
+ Case #25: 1.000000
26
+ Case #26: 1.000000
27
+ Case #27: 0.005814
28
+ Case #28: 0.652831
29
+ Case #29: 0.000005
30
+ Case #30: 0.982684
31
+ Case #31: 0.714924
32
+ Case #32: 0.910761
33
+ Case #33: 0.925189
34
+ Case #34: 0.724935
35
+ Case #35: 1.000000
36
+ Case #36: 1.000000
37
+ Case #37: 0.000000
38
+ Case #38: 1.000000
39
+ Case #39: 1.000000
40
+ Case #40: 0.936158
41
+ Case #41: 0.000000
42
+ Case #42: 0.001031
43
+ Case #43: 0.012372
44
+ Case #44: 1.000000
45
+ Case #45: 0.000002
46
+ Case #46: 1.000000
47
+ Case #47: 0.668061
48
+ Case #48: 1.000000
49
+ Case #49: 0.103853
50
+ Case #50: 0.853627
51
+ Case #51: 0.956042
52
+ Case #52: 0.339817
53
+ Case #53: 0.924908
54
+ Case #54: 0.976706
55
+ Case #55: 1.000000
56
+ Case #56: 0.937467
57
+ Case #57: 0.468936
58
+ Case #58: 0.692741
59
+ Case #59: 0.992276
60
+ Case #60: 0.000000
61
+ Case #61: 0.186419
62
+ Case #62: 0.182569
63
+ Case #63: 0.020824
64
+ Case #64: 0.000000
65
+ Case #65: 0.997141
66
+ Case #66: 0.000001
67
+ Case #67: 0.000028
68
+ Case #68: 1.000000
69
+ Case #69: 0.000000
70
+ Case #70: 0.204542
71
+ Case #71: 1.000000
72
+ Case #72: 0.000005
73
+ Case #73: 0.998624
74
+ Case #74: 0.002118
75
+ Case #75: 1.000000
76
+ Case #76: 0.089279
77
+ Case #77: 0.057463
78
+ Case #78: 0.000000
79
+ Case #79: 0.001279
80
+ Case #80: 0.036810
81
+ Case #81: 0.001556
82
+ Case #82: 0.999999
83
+ Case #83: 1.000000
84
+ Case #84: 0.999939
85
+ Case #85: 0.000011
86
+ Case #86: 0.000000
87
+ Case #87: 0.254354
88
+ Case #88: 1.000000
89
+ Case #89: 0.014762
90
+ Case #90: 0.678187
91
+ Case #91: 0.890621
92
+ Case #92: 0.716511
2014/round1/aaaaaa.html ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <p>
2
+ Al is the proprietor of Al's Awesome and Amazing Amusement Arcade,
3
+ called AAAAAA by some, AAaAAA by others, AAAAA by others still, and
4
+ alternately A<sup>5</sup> or A<sup>6</sup> by math majors.
5
+ </p>
6
+
7
+ <p>
8
+ The problem with operating such a spectacular business is managing the line of
9
+ people waiting to get in. City by-laws prevent people from loitering on Al's
10
+ property, so anybody who wants to experience the wonders Al has in store has
11
+ to queue in the parking lot. Not wanting to turn people away, Al is interested
12
+ in cramming as many hapless souls into the parking lot as he can. However,
13
+ customers are a whiny bunch, and refuse to stand in any queue that makes too
14
+ many detours before getting to the entrance.
15
+ </p>
16
+
17
+ <p>
18
+ You can imagine that the parking lot is a grid, with the Arcade's entrance in
19
+ the upper-left corner. All queues must begin here. There may be cars in the
20
+ parking lot, denoted '#'. Customers refuse to queue on top of cars. All other
21
+ cells will contain '.'. Due to customer complaints, all queues must generally
22
+ extend only rightwards and downwards. However, Al's clientele is not entirely
23
+ unreasonable, so a queue may have a single contiguous section that runs
24
+ upwards, or a single contiguous section that runs leftwards, but not both.
25
+ Queues only extend in these four directions (i.e., not diagonally).
26
+ </p>
27
+
28
+ <p>
29
+ There is only room for one customer in each empty space. Each pair of consecutive customers in the queue must stand in adjacent spaces, i.e. there can't be any gaps in the queue.
30
+ </p>
31
+
32
+
33
+ <h3>Input</h3>
34
+ <p>
35
+ The first line of the input consists of a single integer <strong>T</strong>, the number of test
36
+ cases. <br />
37
+ Each test case begins with a line containing two integers, <strong>N</strong> and <strong>M</strong>, the number of rows and columns in the lot's grid.<br />
38
+ The next <strong>N</strong> lines each contain a string with exactly <strong>M</strong> characters, where the <strong>i</strong>th line correspond to the <strong>i</strong>th row in the grid. <br />
39
+ </p>
40
+
41
+ <h3>Output</h3>
42
+ <p>
43
+ For each test case <strong>i</strong> numbered from 1 to <strong>T</strong>, output "Case #<strong>i</strong>: ", followed by the size of the largest queue starting in the top left corner that Al can fit into his parking lot.
44
+ </p>
45
+
46
+ <h3>Constraints</h3>
47
+ <p>
48
+ 1 &le; <strong>T</strong> &le; 20 <br />
49
+ 1 &le; <strong>N</strong>, <strong>M</strong> &le; 500 <br />
50
+ Each character in the grid will be either '.' or '#'. <br />
51
+ The character in the upper left corner will always be '.' <br />
52
+ </p>
2014/round1/aaaaaa.in ADDED
The diff for this file is too large to render. See raw diff
 
2014/round1/aaaaaa.md ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Al is the proprietor of Al's Awesome and Amazing Amusement Arcade, called
2
+ AAAAAA by some, AAaAAA by others, AAAAA by others still, and alternately A5 or
3
+ A6 by math majors.
4
+
5
+ The problem with operating such a spectacular business is managing the line of
6
+ people waiting to get in. City by-laws prevent people from loitering on Al's
7
+ property, so anybody who wants to experience the wonders Al has in store has
8
+ to queue in the parking lot. Not wanting to turn people away, Al is interested
9
+ in cramming as many hapless souls into the parking lot as he can. However,
10
+ customers are a whiny bunch, and refuse to stand in any queue that makes too
11
+ many detours before getting to the entrance.
12
+
13
+ You can imagine that the parking lot is a grid, with the Arcade's entrance in
14
+ the upper-left corner. All queues must begin here. There may be cars in the
15
+ parking lot, denoted '#'. Customers refuse to queue on top of cars. All other
16
+ cells will contain '.'. Due to customer complaints, all queues must generally
17
+ extend only rightwards and downwards. However, Al's clientele is not entirely
18
+ unreasonable, so a queue may have a single contiguous section that runs
19
+ upwards, or a single contiguous section that runs leftwards, but not both.
20
+ Queues only extend in these four directions (i.e., not diagonally).
21
+
22
+ There is only room for one customer in each empty space. Each pair of
23
+ consecutive customers in the queue must stand in adjacent spaces, i.e. there
24
+ can't be any gaps in the queue.
25
+
26
+ ### Input
27
+
28
+ The first line of the input consists of a single integer **T**, the number of
29
+ test cases.
30
+ Each test case begins with a line containing two integers, **N** and **M**,
31
+ the number of rows and columns in the lot's grid.
32
+ The next **N** lines each contain a string with exactly **M** characters,
33
+ where the **i**th line correspond to the **i**th row in the grid.
34
+
35
+ ### Output
36
+
37
+ For each test case **i** numbered from 1 to **T**, output "Case #**i**: ",
38
+ followed by the size of the largest queue starting in the top left corner that
39
+ Al can fit into his parking lot.
40
+
41
+ ### Constraints
42
+
43
+ 1 ≤ **T** ≤ 20
44
+ 1 ≤ **N**, **M** ≤ 500
45
+ Each character in the grid will be either '.' or '#'.
46
+ The character in the upper left corner will always be '.'
47
+
2014/round1/aaaaaa.out ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Case #1: 17
2
+ Case #2: 10
3
+ Case #3: 17
4
+ Case #4: 5
5
+ Case #5: 10
6
+ Case #6: 13
7
+ Case #7: 1
8
+ Case #8: 11
9
+ Case #9: 9
10
+ Case #10: 9
11
+ Case #11: 1821
12
+ Case #12: 1034
13
+ Case #13: 748
14
+ Case #14: 719
15
+ Case #15: 869
16
+ Case #16: 770
17
+ Case #17: 637
18
+ Case #18: 524
19
+ Case #19: 716
20
+ Case #20: 676
21
+ Case #21: 591
22
+ Case #22: 591
23
+ Case #23: 554
24
+ Case #24: 700
25
+ Case #25: 533
26
+ Case #26: 673
27
+ Case #27: 685
28
+ Case #28: 592
29
+ Case #29: 456
30
+ Case #30: 475
31
+ Case #31: 990
32
+ Case #32: 374
33
+ Case #33: 654
34
+ Case #34: 516
35
+ Case #35: 466
36
+ Case #36: 604
37
+ Case #37: 404
38
+ Case #38: 464
39
+ Case #39: 514
40
+ Case #40: 473
41
+ Case #41: 427
42
+ Case #42: 345
43
+ Case #43: 603
44
+ Case #44: 373
45
+ Case #45: 418
46
+ Case #46: 526
47
+ Case #47: 327
48
+ Case #48: 435
49
+ Case #49: 475
50
+ Case #50: 297
2014/round1/coins_game.html ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <p>Alice and Bob like to play what they call the "Coins Game". In this game Bob starts with <strong>K</strong> identical coins and <strong>N</strong> identical jars. A jar can fit any number of coins and Bob has to distribute all the coins in whatever way he wants.</p>
2
+ <p>After the coins are distributed Alice takes the jars and shuffles them at random while Bob isn't looking. Alice will move jars around but will not move any coins between the jars. The jars are opaque so after the shuffle Bob doesn't see how many coins are in each.</p>
3
+ <p>Now Bob has <strong>P</strong> moves. In each move he points at one of the jars. If the jar contains any coins Alice takes a single coin from it and hands it to Bob. If the jar is empty Alice tells Bob. Bob remembers his initial distribution and the moves he has made so far.</p>
4
+ <p>The goal of the game is to check whether Bob is able to acquire at least <strong>C</strong> coins after his <strong>P</strong> moves. If he can do that he wins the game. After losing the first few games Bob is determined to figure out what's the minimal number of moves <strong>P</strong> that can guarantee his win. Your job is to help him, that is find the minimal value <strong>P</strong> for which there exists an initial coins distribution and moves strategy that makes Bob win no matter what order the jars are in.</p>
5
+
6
+ <h3>Input</h3>
7
+ <p>
8
+ The first line of the input consists of a single integer <strong>T</strong>, the number of test
9
+ cases. <br />
10
+ Each test case is a single line with three integers: <strong>N</strong> <strong>K</strong> <strong>C</strong>
11
+ </p>
12
+
13
+ <h3>Output</h3>
14
+ <p>
15
+ For each test case <strong>i</strong> numbered from 1 to <strong>T</strong>, output "Case #<strong>i</strong>: ", followed by an integer <strong>P</strong>, the minimal number of moves for which there exists a winning strategy.
16
+ </p>
17
+
18
+ <h3>Constraints</h3>
19
+ <p>
20
+ 1 &le; <strong>T</strong> &le; 20<br />
21
+ 1 &le; <strong>N</strong> &le; 1,000,000<br />
22
+ 1 &le; <strong>C</strong> &le; <strong>K</strong> &le; 1,000,000<br />
23
+ </p>
24
+
25
+ <h3>Examples</h3>
26
+ <p>In the first test case we start with three jars and six coins. Bob needs to get four of them to win. A winning strategy is to put two coins in each jar. Then he can point twice at one jar and twice at another one to always get four coins.
27
+ </p>
28
+ <p>In the second example he can put the five coins in a different jar each. In the worst case he will point at an empty jar three times so he will need five total moves to get two coins. There is no way to guarantee a win with fewer than five moves.</p>
2014/round1/coins_game.in ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 31
2
+ 3 6 4
3
+ 8 5 2
4
+ 3 4 4
5
+ 1 3 1
6
+ 2 10 9
7
+ 576 681 559
8
+ 941881 995305 928192
9
+ 7 1 1
10
+ 619 689 338
11
+ 140703 585535 72412
12
+ 8 4 1
13
+ 569 922 304
14
+ 843139 399718 227764
15
+ 7 4 2
16
+ 872 462 237
17
+ 506626 517245 198959
18
+ 7 9 5
19
+ 787 42 42
20
+ 226147 298339 251609
21
+ 1 3 1
22
+ 999999 1000000 1000000
23
+ 1000000 1000000 1000000
24
+ 999999 1000000 999999
25
+ 1000000 500000 1
26
+ 497 999999 999999
27
+ 1000 12345 12340
28
+ 1000000 10 1
29
+ 1 1 1
30
+ 1 1000000 1000
31
+ 1000 1000000 1337
32
+ 10 55 55
2014/round1/coins_game.md ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Alice and Bob like to play what they call the "Coins Game". In this game Bob
2
+ starts with **K** identical coins and **N** identical jars. A jar can fit any
3
+ number of coins and Bob has to distribute all the coins in whatever way he
4
+ wants.
5
+
6
+ After the coins are distributed Alice takes the jars and shuffles them at
7
+ random while Bob isn't looking. Alice will move jars around but will not move
8
+ any coins between the jars. The jars are opaque so after the shuffle Bob
9
+ doesn't see how many coins are in each.
10
+
11
+ Now Bob has **P** moves. In each move he points at one of the jars. If the jar
12
+ contains any coins Alice takes a single coin from it and hands it to Bob. If
13
+ the jar is empty Alice tells Bob. Bob remembers his initial distribution and
14
+ the moves he has made so far.
15
+
16
+ The goal of the game is to check whether Bob is able to acquire at least **C**
17
+ coins after his **P** moves. If he can do that he wins the game. After losing
18
+ the first few games Bob is determined to figure out what's the minimal number
19
+ of moves **P** that can guarantee his win. Your job is to help him, that is
20
+ find the minimal value **P** for which there exists an initial coins
21
+ distribution and moves strategy that makes Bob win no matter what order the
22
+ jars are in.
23
+
24
+ ### Input
25
+
26
+ The first line of the input consists of a single integer **T**, the number of
27
+ test cases.
28
+ Each test case is a single line with three integers: **N** **K** **C**
29
+
30
+ ### Output
31
+
32
+ For each test case **i** numbered from 1 to **T**, output "Case #**i**: ",
33
+ followed by an integer **P**, the minimal number of moves for which there
34
+ exists a winning strategy.
35
+
36
+ ### Constraints
37
+
38
+ 1 ≤ **T** ≤ 20
39
+ 1 ≤ **N** ≤ 1,000,000
40
+ 1 ≤ **C** ≤ **K** ≤ 1,000,000
41
+
42
+ ### Examples
43
+
44
+ In the first test case we start with three jars and six coins. Bob needs to
45
+ get four of them to win. A winning strategy is to put two coins in each jar.
46
+ Then he can point twice at one jar and twice at another one to always get four
47
+ coins.
48
+
49
+ In the second example he can put the five coins in a different jar each. In
50
+ the worst case he will point at an empty jar three times so he will need five
51
+ total moves to get two coins. There is no way to guarantee a win with fewer
52
+ than five moves.
53
+
2014/round1/coins_game.out ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Case #1: 4
2
+ Case #2: 5
3
+ Case #3: 5
4
+ Case #4: 1
5
+ Case #5: 9
6
+ Case #6: 559
7
+ Case #7: 928192
8
+ Case #8: 7
9
+ Case #9: 338
10
+ Case #10: 72412
11
+ Case #11: 5
12
+ Case #12: 304
13
+ Case #13: 671185
14
+ Case #14: 5
15
+ Case #15: 647
16
+ Case #16: 198959
17
+ Case #17: 5
18
+ Case #18: 787
19
+ Case #19: 328587
20
+ Case #20: 1
21
+ Case #21: 1499999
22
+ Case #22: 1000000
23
+ Case #23: 999999
24
+ Case #24: 500001
25
+ Case #25: 1000000
26
+ Case #26: 12391
27
+ Case #27: 999991
28
+ Case #28: 1
29
+ Case #29: 1000
30
+ Case #30: 1337
31
+ Case #31: 56
2014/round1/labelmaker.html ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <p>David is labelling boxes in a giant warehouse. He has a *lot* of boxes to
2
+ label, but unfortunately his labeling machine is broken, so only some of the
3
+ letters work. In order to be efficient, David labels the boxes by first using
4
+ every possible 1-letter label in alphabetical order, then using every possible
5
+ 2-letter label in alphabetical order, then every 3-letter label, etc.</p>
6
+
7
+ <p>For example, suppose only the letters 'D', 'T', and 'Z' work. David would
8
+ label the first 15 boxes as follows: D, T, Z, DD, DT, DZ, TD, TT, TZ, ZD, ZT,
9
+ ZZ, DDD, DDT, DDZ. The first box is considered box #1, not box #0.</p>
10
+
11
+ <p>Given a set of working letters <strong>L</strong> on David's labelling
12
+ machine and a number <strong>N</strong> of boxes to label, return the label on
13
+ the last box.</p>
14
+
15
+ <h2>Input</h2>
16
+
17
+ <p>
18
+ The first line of the input consists of a single integer <strong>T</strong>, the number of test
19
+ cases. <br />
20
+ Each test case consists of the string <strong>L</strong> and the integer <strong>N</strong>, separated by a space. </p>
21
+
22
+ <h2>Output</h2>
23
+ <p>
24
+ For each test case <strong>i</strong> numbered from 1 to <strong>T</strong>, output "Case #<strong>i</strong>: ", followed by the label on the last box.</p>
25
+
26
+ <h2>Constraints</h2>
27
+ <p>
28
+ 1 &le; <strong>T</strong> &le; 20 <br />
29
+ 1 &le; length(<strong>L</strong>) &le; 25 <br />
30
+ <strong>L</strong> will be in alphabetical order, consist of only uppercase letters A-Z, and contain each letter at most once <br />
31
+ 1 &le; <strong>N</strong> &le; 2<sup>63</sup>-1 <br />
32
+ The test cases will be designed so that no label is longer than 50 letters<br />
33
+ </p>
34
+
2014/round1/labelmaker.in ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 53
2
+ EHT 34
3
+ ABCEFKO 4296473
4
+ ACEHKMPRTU 4125383079316
5
+ CDEGHIKLOSUWY 8333092520403744490
6
+ ADEFHNOPSUVY 3365973428406169086
7
+ ACEGINPRTW 216739905614156
8
+ ADELSV 17951
9
+ EFZ 32
10
+ BORT 301
11
+ CGOS 232
12
+ BCJLSU 57129589
13
+ ABCEKLMNPQRTUVXZ 1768121230346226325
14
+ ACDFKLPQRTVWXYZ 4377150318864029777
15
+ ABCDEFGHIJKLNPQRSTUWXYZ 2786177327716752394
16
+ BCDEGJQSTUVXYZ 2058648126235934765
17
+ BFIJKNPTU 8626764155752725519
18
+ CHIJKLPSUWYZ 2599078849846967338
19
+ ABFGHLSTXY 2203050641463142553
20
+ MOPX 7527469720355593192
21
+ ACFHJLPQRSVWX 3776290711592079700
22
+ DFHL 7802998707622756298
23
+ ABCDFGHILPQSTZ 7910351652051305965
24
+ CDGIJKLNOPQSTUVWXYZ 5709086144718260209
25
+ ABCDEFIJKMQUVWYZ 5574501665478402449
26
+ ABCEFHIJKLMOPQRSTUVWYZ 7245032875351295492
27
+ ABCEFHIJKLOPRUVXZ 4846583188800553911
28
+ AHKOPRWX 7508280203699802838
29
+ DNU 1638316335360577913
30
+ ABCDEFGHIJKLMNOPQRSTUVXYZ 8883877996430784020
31
+ ABCDEFGJKLMNOPQRSTVWXYZ 7500116989582893490
32
+ ABCDEFGHIKLMNOPQRSTUWXYZ 7287455102662719573
33
+ ABCFGHJKMPQRSUWXYZ 4167747996316020220
34
+ AEFGHINPTUVXY 2728835088585628917
35
+ ABCDEFGHIJKLMNOPQRSTUVWXZ 6912968260941297872
36
+ ABCDEFHILMNOQRSTUVWXYZ 8694095846111680941
37
+ ABDFIORSTWX 6598421121606179127
38
+ ABCGHKORSUV 4955139483617637213
39
+ ABCDEFHJLNPQRSTUX 594976432580696779
40
+ AEHI 3162899471468513059
41
+ ACDEFIJMNORSTUVWYZ 8750841076126514099
42
+ ASVXY 4497350103187099823
43
+ BCEFGHIJKLMNOQRUWX 2521148479268919809
44
+ ABCDEFHJLMOPQSTVXYZ 8133275048742667438
45
+ ABCDEFGIJKLMNOPQRSTUVWXYZ 46161240430628997
46
+ AENX 6006165053007207027
47
+ EGOQZ 2252821188768047387
48
+ BCDEFGIKLMOPQRTUVWXYZ 3656373470406921887
49
+ ADFJKLNPRUVWZ 7094110536991615573
50
+ BCDEGILNQVWX 7127002846485494400
51
+ GOQRSV 6903040442723570976
52
+ CDEFGHIKLMNOPQRUVZ 6306903453412365520
53
+ Z 50
54
+ ABC 9223372036854775807
2014/round1/labelmaker.md ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ David is labelling boxes in a giant warehouse. He has a *lot* of boxes to
2
+ label, but unfortunately his labeling machine is broken, so only some of the
3
+ letters work. In order to be efficient, David labels the boxes by first using
4
+ every possible 1-letter label in alphabetical order, then using every possible
5
+ 2-letter label in alphabetical order, then every 3-letter label, etc.
6
+
7
+ For example, suppose only the letters 'D', 'T', and 'Z' work. David would
8
+ label the first 15 boxes as follows: D, T, Z, DD, DT, DZ, TD, TT, TZ, ZD, ZT,
9
+ ZZ, DDD, DDT, DDZ. The first box is considered box #1, not box #0.
10
+
11
+ Given a set of working letters **L** on David's labelling machine and a number
12
+ **N** of boxes to label, return the label on the last box.
13
+
14
+ ## Input
15
+
16
+ The first line of the input consists of a single integer **T**, the number of
17
+ test cases.
18
+ Each test case consists of the string **L** and the integer **N**, separated
19
+ by a space.
20
+
21
+ ## Output
22
+
23
+ For each test case **i** numbered from 1 to **T**, output "Case #**i**: ",
24
+ followed by the label on the last box.
25
+
26
+ ## Constraints
27
+
28
+ 1 ≤ **T** ≤ 20
29
+ 1 ≤ length(**L**) ≤ 25
30
+ **L** will be in alphabetical order, consist of only uppercase letters A-Z, and contain each letter at most once
31
+ 1 ≤ **N** ≤ 263-1
32
+ The test cases will be designed so that no label is longer than 50 letters
33
+
2014/round1/labelmaker.out ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Case #1: THE
2
+ Case #2: FACEBOOK
3
+ Case #3: HACKERCUPTEAM
4
+ Case #4: WISHESYOUGOODLUCK
5
+ Case #5: ANDHOPESYOUHAVEFUN
6
+ Case #6: CANPETRWINAGAIN
7
+ Case #7: DALVES
8
+ Case #8: ZEF
9
+ Case #9: TORB
10
+ Case #10: OGCS
11
+ Case #11: SJSUCSCLUB
12
+ Case #12: ANNPPZVEAVPTZQPK
13
+ Case #13: RYYADDFVZDLKYKTC
14
+ Case #14: ELCCWRKSFUNYKP
15
+ Case #15: YDDTSUSYEBUVYYDQ
16
+ Case #16: NIJFJKNNTTTPTKIIIJPI
17
+ Case #17: CCZSIYYWKLLLLJHJSW
18
+ Case #18: BAYBYGYLGAGLFAGBHHF
19
+ Case #19: MOMXMPMOPOXMOXXPPXXOXXPMPMOPPOMX
20
+ Case #20: JQSAAVLHAJSRXHHCL
21
+ Case #21: DFFHLLFDFLLDHHFHDLDFFFHHFHHHFLFF
22
+ Case #22: CIQSCDTIPTLZGHQAQ
23
+ Case #23: LDUNDNQXVNKNCQV
24
+ Case #24: DVEUKQQMVBMKWAKA
25
+ Case #25: ACPPBQEFZPEBZAH
26
+ Case #26: AORFKOHPCBFOUIAJ
27
+ Case #27: RKXRHRAAXXHAWOWWPAKHR
28
+ Case #28: UDNDUDNUUDDUNNDUDNUDDNNUUUNUNUNNDUDUNN
29
+ Case #29: EYADEGTXILTDJT
30
+ Case #30: PWEOGBYEKFDCGE
31
+ Case #31: HGNAXYLOBNYFHW
32
+ Case #32: QBBSAQPSUYXJMUF
33
+ Case #33: GAFYTYAXPXUYYPGIV
34
+ Case #34: DOXLRCSUTIRANV
35
+ Case #35: AITFZWTLHHVZYMQ
36
+ Case #36: AAXOORSDIFRORTTATST
37
+ Case #37: SRSBGRAKKORGCBGUCS
38
+ Case #38: CLACJALJCBTTJQN
39
+ Case #39: EEHHAIIHAHHIIHHEHHIIEAEEIAEIAIH
40
+ Case #40: AFIEMVDZVDDWIRIR
41
+ Case #41: SXYSAASYVAVSYXSVAAVXXAXVSXV
42
+ Case #42: HOBHIMLGGQINCCG
43
+ Case #43: MCHQFTBBELZFAFB
44
+ Case #44: TIZWGPUBKFJW
45
+ Case #45: XXNAAEAXENEXXEEXENENAENXAEEAEXN
46
+ Case #46: EGGOQQGGOGOQOGOZQOZZQQZOZGG
47
+ Case #47: BCRBMPTPIEZTGQR
48
+ Case #48: UPNRNFRPDAVDWLNWN
49
+ Case #49: DCIIWNQIVQDLDWIGDX
50
+ Case #50: GOROQVGVQQQSVGROOVOVSOOQV
51
+ Case #51: UQRRQIVIOLKFCFF
52
+ Case #52: ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
53
+ Case #53: ACACCCBBCCCBBACBCAACCABCBCBABABCCABACBBA
2014/round1/preventing_alzheimers.html ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <p>
2
+ It is a truth universally acknowledged that a grandparent in possession of a good fortune must furnish his or her grandchildren with cash on their birthdays. Your usual approach is to give each of your <strong>N</strong> grandchildren a number of dollars equal to their age, (That means 0 dollars for newborns; it's important that they learn what a rough place the world is from the very start).
3
+ </p>
4
+
5
+ <p>
6
+ One of your younger, and more precocious, grandchildren, Elly, has read online that trying out new things is a good way to prevent Alzheimer's. So, out of concern for your mental well-being (and in the hopes that she might receive more money), she's posed a new distribution scheme. "If any two grandchildren compare the size of their presents, they should find that both presents are divisible by an integer <strong>K</strong>. They should also find that there is no larger integer that divides the size of both presents," she states.
7
+ </p>
8
+
9
+ <p>
10
+ Well, that seems harmless enough, you think. Of course, each grandchild will still have to receive at least as much money as they would have under the old scheme, to avoid any family drama. As you're getting on in years, your mathematical prowess isn't what it used to be. It would be easier to write a program that computes the additional drain on your pocketbook.
11
+ </p>
12
+
13
+ <p>
14
+ Note that 0 is divisible by all other numbers.
15
+ </p>
16
+
17
+ <h3>Input</h3>
18
+ <p>
19
+ The first line of the input consists of a single integer <strong>T</strong>, the number of test
20
+ cases. <br />
21
+ Each test case starts with a line with the integers <strong>N</strong> and <strong>K</strong>.<br />
22
+ The next line consists of the ages of your grandchildren as <strong>N</strong> integers <strong>A<sub>1</sub></strong>, <strong>A<sub>2</sub></strong>, ..., <strong>A<sub>N</sub></strong>.<br/ >
23
+ </p>
24
+
25
+
26
+ <h3>Output</h3>
27
+ <p>
28
+ For each test case <strong>i</strong> numbered from 1 to <strong>T</strong>, output "Case #<strong>i</strong>: ", followed by the minimum extra amount of money you would have to spend compared to giving everyone money equal to their age.
29
+ </p>
30
+
31
+ <h3>Constraints</h3>
32
+ <p>
33
+ 1 &le; <strong>T</strong> &le; 20<br />
34
+ 2 &le; <strong>N</strong> &le; 20<br />
35
+ 1 &le; <strong>K</strong> &le; 20<br />
36
+ 0 &le; <strong>A<sub>i</sub></strong> &le; 50 <br />
37
+ </p>
38
+
39
+ <h3>Examples</h3>
40
+ <p>
41
+ In the first example, you would have to pay 2 to one of them and 3 to the other. The total cost would be 5. Under the old constraints, both grandchildren would get 2, for a total sum of 4. The answer is 5-4 = 1. You can't pay 2 to both, because their gifts would be divisible by 2 as well as 1.
42
+ </p>
43
+
44
+ <p>
45
+ In the second example, a possible solution is to give them 3, 7, 5 and 16 dollars, for a total of 31. Under the old constraints, you would give them a total of 28. The answer is 31-28 = 3.
46
+ </p>
47
+
48
+ <p>
49
+ In the third example, all gifts have to be divisible by 3. A possible solution is 6, 21, 51. This is 6 more than the sum of their ages. Note that 6, 18, 51 are all divisible by 3, but 6 and 18 are both divisible by 6 as well, so that solution is not valid.
50
+ </p>
2014/round1/preventing_alzheimers.in ADDED
@@ -0,0 +1,113 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 56
2
+ 2 1
3
+ 2 2
4
+ 4 1
5
+ 2 7 5 14
6
+ 3 3
7
+ 5 18 49
8
+ 3 1
9
+ 1 2 3
10
+ 4 2
11
+ 0 0 1 2
12
+ 18 4
13
+ 28 50 46 28 25 11 3 1 24 31 2 13 3 43 34 38 46 48
14
+ 18 9
15
+ 22 24 19 13 46 10 5 30 47 10 42 45 25 3 14 19 14 44
16
+ 19 3
17
+ 3 22 50 41 34 10 33 49 43 35 17 23 10 27 30 23 6 17 7
18
+ 17 5
19
+ 50 13 46 29 22 21 42 33 48 34 7 33 15 1 23 8 33
20
+ 18 16
21
+ 19 42 41 45 28 18 36 39 11 35 22 49 38 29 14 9 42 9
22
+ 19 10
23
+ 47 31 22 5 0 49 10 29 38 22 40 0 24 46 1 23 19 2 36
24
+ 20 15
25
+ 29 42 46 1 34 7 16 27 18 49 39 6 13 39 36 30 31 32 43 29
26
+ 17 12
27
+ 37 19 11 34 33 18 38 35 30 20 36 30 5 14 30 36 9
28
+ 20 5
29
+ 23 50 37 34 14 11 48 33 21 17 49 33 25 38 30 45 34 35 1 20
30
+ 19 5
31
+ 4 13 23 37 5 37 34 10 21 7 22 4 32 18 7 36 44 10 36
32
+ 18 15
33
+ 17 29 27 24 43 45 10 46 6 11 46 42 39 45 25 17 27 3
34
+ 20 1
35
+ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2
36
+ 20 4
37
+ 36 0 28 27 21 47 28 15 7 24 14 18 17 12 11 49 46 8 8 40
38
+ 18 10
39
+ 24 45 1 4 10 30 50 37 23 49 8 6 31 15 13 31 36 44
40
+ 20 4
41
+ 39 5 32 21 9 29 28 32 35 5 22 0 38 21 23 7 23 39 17 13
42
+ 19 15
43
+ 19 21 19 35 48 25 5 45 2 31 40 46 16 13 16 36 4 10 24
44
+ 17 14
45
+ 15 2 48 50 34 36 9 47 27 2 38 6 39 49 43 5 17
46
+ 20 2
47
+ 18 36 19 6 47 3 33 2 11 27 25 48 42 38 38 36 44 27 14 8
48
+ 20 14
49
+ 13 13 19 13 50 14 22 12 40 40 1 22 18 29 49 29 26 6 3 2
50
+ 19 4
51
+ 0 24 42 4 11 35 50 24 11 9 8 25 0 37 34 8 28 7 2
52
+ 19 3
53
+ 43 38 44 43 4 16 1 3 43 37 46 8 45 4 48 19 0 9 4
54
+ 19 19
55
+ 23 39 19 25 43 8 35 49 21 38 15 25 21 14 21 23 39 27 34
56
+ 17 3
57
+ 13 20 11 24 36 36 27 7 31 2 13 21 16 7 7 6 15
58
+ 20 20
59
+ 19 36 8 35 43 34 50 16 21 2 46 8 14 10 22 50 18 42 6 3
60
+ 20 1
61
+ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
62
+ 19 14
63
+ 0 47 1 5 31 21 35 44 6 16 50 41 10 1 30 26 28 45 31
64
+ 18 14
65
+ 7 34 37 50 50 6 18 39 27 8 5 16 8 9 0 25 7 10
66
+ 19 8
67
+ 1 41 37 15 44 19 50 25 12 39 37 35 20 21 11 43 42 13 29
68
+ 18 10
69
+ 4 14 24 35 2 11 36 45 29 20 28 44 27 47 19 46 32 23
70
+ 20 8
71
+ 39 10 40 21 13 31 29 3 28 12 48 18 47 33 14 42 25 13 13 36
72
+ 17 14
73
+ 6 24 16 40 28 10 13 50 20 15 45 41 17 6 32 41 23
74
+ 19 8
75
+ 17 34 41 7 30 23 25 28 17 46 48 16 41 48 48 35 41 15 32
76
+ 18 5
77
+ 23 45 33 46 21 47 41 25 12 42 46 19 31 48 24 36 49 4
78
+ 20 7
79
+ 12 35 42 15 23 45 23 4 16 2 4 33 2 12 42 8 6 42 21 40
80
+ 18 17
81
+ 9 27 48 38 12 10 4 39 17 19 22 4 1 24 22 20 19 18
82
+ 19 4
83
+ 3 22 50 29 18 42 36 32 3 44 32 44 19 42 7 50 12 19 36
84
+ 19 5
85
+ 45 5 36 22 10 41 40 36 37 21 9 5 18 26 32 46 46 47 9
86
+ 20 1
87
+ 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
88
+ 17 20
89
+ 29 4 0 11 15 21 25 1 38 11 3 42 49 18 45 46 44
90
+ 10 11
91
+ 1 2 3 4 5 6 7 8 9 10
92
+ 18 2
93
+ 26 24 7 5 2 45 35 39 5 14 41 5 48 13 11 20 29 18
94
+ 19 8
95
+ 29 23 14 31 27 10 28 6 22 8 13 40 21 2 23 11 2 48 47
96
+ 18 8
97
+ 31 25 31 50 12 9 19 23 14 19 15 23 19 43 46 2 17 1
98
+ 18 10
99
+ 36 0 0 8 36 20 49 2 42 4 34 29 30 29 1 23 45 7
100
+ 18 4
101
+ 37 23 15 44 9 3 47 15 29 50 40 16 14 34 45 28 45 40
102
+ 18 10
103
+ 11 32 46 13 48 39 45 2 0 6 10 41 48 34 46 0 39 47
104
+ 18 10
105
+ 0 1 2 24 21 47 27 46 44 19 17 11 18 0 5 30 1 41
106
+ 19 20
107
+ 29 1 14 31 2 43 30 38 27 9 16 33 49 34 29 37 41 29 10
108
+ 18 6
109
+ 27 0 48 28 9 44 42 23 34 37 13 29 18 7 6 28 30 37
110
+ 20 1
111
+ 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50
112
+ 19 12
113
+ 3 29 25 5 48 36 3 15 1 10 5 31 9 36 40 9 2 19 32
2014/round1/preventing_alzheimers.md ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ It is a truth universally acknowledged that a grandparent in possession of a
2
+ good fortune must furnish his or her grandchildren with cash on their
3
+ birthdays. Your usual approach is to give each of your **N** grandchildren a
4
+ number of dollars equal to their age, (That means 0 dollars for newborns; it's
5
+ important that they learn what a rough place the world is from the very
6
+ start).
7
+
8
+ One of your younger, and more precocious, grandchildren, Elly, has read online
9
+ that trying out new things is a good way to prevent Alzheimer's. So, out of
10
+ concern for your mental well-being (and in the hopes that she might receive
11
+ more money), she's posed a new distribution scheme. "If any two grandchildren
12
+ compare the size of their presents, they should find that both presents are
13
+ divisible by an integer **K**. They should also find that there is no larger
14
+ integer that divides the size of both presents," she states.
15
+
16
+ Well, that seems harmless enough, you think. Of course, each grandchild will
17
+ still have to receive at least as much money as they would have under the old
18
+ scheme, to avoid any family drama. As you're getting on in years, your
19
+ mathematical prowess isn't what it used to be. It would be easier to write a
20
+ program that computes the additional drain on your pocketbook.
21
+
22
+ Note that 0 is divisible by all other numbers.
23
+
24
+ ### Input
25
+
26
+ The first line of the input consists of a single integer **T**, the number of
27
+ test cases.
28
+ Each test case starts with a line with the integers **N** and **K**.
29
+ The next line consists of the ages of your grandchildren as **N** integers
30
+ **A1**, **A2**, ..., **AN**.
31
+
32
+ ### Output
33
+
34
+ For each test case **i** numbered from 1 to **T**, output "Case #**i**: ",
35
+ followed by the minimum extra amount of money you would have to spend compared
36
+ to giving everyone money equal to their age.
37
+
38
+ ### Constraints
39
+
40
+ 1 ≤ **T** ≤ 20
41
+ 2 ≤ **N** ≤ 20
42
+ 1 ≤ **K** ≤ 20
43
+ 0 ≤ **Ai** ≤ 50
44
+
45
+ ### Examples
46
+
47
+ In the first example, you would have to pay 2 to one of them and 3 to the
48
+ other. The total cost would be 5. Under the old constraints, both
49
+ grandchildren would get 2, for a total sum of 4. The answer is 5-4 = 1. You
50
+ can't pay 2 to both, because their gifts would be divisible by 2 as well as 1.
51
+
52
+ In the second example, a possible solution is to give them 3, 7, 5 and 16
53
+ dollars, for a total of 31. Under the old constraints, you would give them a
54
+ total of 28. The answer is 31-28 = 3.
55
+
56
+ In the third example, all gifts have to be divisible by 3. A possible solution
57
+ is 6, 21, 51. This is 6 more than the sum of their ages. Note that 6, 18, 51
58
+ are all divisible by 3, but 6 and 18 are both divisible by 6 as well, so that
59
+ solution is not valid.
60
+
2014/round1/preventing_alzheimers.out ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Case #1: 1
2
+ Case #2: 3
3
+ Case #3: 6
4
+ Case #4: 0
5
+ Case #5: 3
6
+ Case #6: 690
7
+ Case #7: 3015
8
+ Case #8: 1026
9
+ Case #9: 1452
10
+ Case #10: 4034
11
+ Case #11: 1996
12
+ Case #12: 5208
13
+ Case #13: 2973
14
+ Case #14: 2257
15
+ Case #15: 1520
16
+ Case #16: 3773
17
+ Case #17: 19
18
+ Case #18: 1820
19
+ Case #19: 1973
20
+ Case #20: 1838
21
+ Case #21: 3835
22
+ Case #22: 2361
23
+ Case #23: 616
24
+ Case #24: 1945
25
+ Case #25: 969
26
+ Case #26: 697
27
+ Case #27: 5789
28
+ Case #28: 854
29
+ Case #29: 2297
30
+ Case #30: 19
31
+ Case #31: 2948
32
+ Case #32: 1170
33
+ Case #33: 3482
34
+ Case #34: 3344
35
+ Case #35: 4037
36
+ Case #36: 2961
37
+ Case #37: 3424
38
+ Case #38: 1623
39
+ Case #39: 1904
40
+ Case #40: 2486
41
+ Case #41: 1228
42
+ Case #42: 1679
43
+ Case #43: 0
44
+ Case #44: 1758
45
+ Case #45: 55
46
+ Case #46: 499
47
+ Case #47: 2251
48
+ Case #48: 2665
49
+ Case #49: 1275
50
+ Case #50: 1238
51
+ Case #51: 1923
52
+ Case #52: 1676
53
+ Case #53: 4378
54
+ Case #54: 1838
55
+ Case #55: 643
56
+ Case #56: 1298
2014/round2/holdem_numbers.html ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <p>
2
+ In the game of Hold'em Numbers, 4 players play with a deck of <strong>N</strong> cards, where each card has a distinct number from the range [1..<strong>N</strong>] on it.
3
+ Each player is dealt two cards and the player who has the highest sum of the two numbers wins.
4
+ If multiple players have the highest sum, the one of them who holds the highest card wins.
5
+ All 8 cards are dealt simultaneously so it's impossible for two players to have the same card.
6
+ </p>
7
+ <p>
8
+ After seeing your two cards you can bet $1. If you win the hand you get $4 back but if another player wins you lose your dollar.
9
+ You can also fold, in which case you don't win nor lose any money. Your opponents play very aggressively and they will always bet.
10
+ After the winner is determined all cards are reshuffled to play another hand for the total of <strong>H</strong> games.
11
+ It's possible you get dealt the same hand more than once.</p>
12
+ </p>
13
+
14
+ <p>
15
+ You want to maximize your winnings and only bet if your expected winnings are strictly greater than zero.
16
+ To help yourself you decided to write a program that for the given deck size and hands you were dealt returns whether you should bet or fold.
17
+ </p>
18
+
19
+ <h3>Input</h3>
20
+ The first line of the input consists of a single integer <strong>T</strong>, the number of test
21
+ cases. <br />
22
+ Each test case starts with a line containing two integers <strong>N</strong> and <strong>H</strong><br />
23
+ The subsequent <strong>H</strong> lines each contain two integers, <strong>C1</strong> and <strong>C2</strong>, the cards you were dealt.
24
+ </p>
25
+
26
+ <h3>Output</h3>
27
+ <p>
28
+ For each test case <strong>i</strong> numbered from 1 to <strong>T</strong>, output "Case #<strong>i</strong>: ", followed by a string of <strong>H</strong> characters.
29
+ Each character being either "B" if you should bet, or "F" if should fold. The order of characters corresponds to the order of hands given in the input.
30
+ </p>
31
+
32
+ <h3>Constraints</h3>
33
+ <p>
34
+ 1 &le; <strong>T</strong> &le; 20 <br />
35
+ 8 &le; <strong>N</strong> &le; 100 <br />
36
+ 1 &le; <strong>H</strong> &le; 10000 <br />
37
+ 1 &le; <strong>C1</strong>, <strong>C2</strong> &le; <strong>N</strong> <br />
38
+ <strong>C1</strong> &ne; <strong>C2</strong>
39
+ </p>
40
+
41
+ <h3>Examples</h3>
42
+ <p>In the first three examples we are playing a single hand with a deck of eight cards. The first case is a clear winner so you should bet.
43
+ The second case gives no chance to win and you should fold.
44
+ Finally the third case gives you 40% chance of winning. This is good enough to make the bet profitable.</p>
45
+
2014/round2/holdem_numbers.in ADDED
The diff for this file is too large to render. See raw diff
 
2014/round2/holdem_numbers.md ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ In the game of Hold'em Numbers, 4 players play with a deck of **N** cards,
2
+ where each card has a distinct number from the range [1..**N**] on it. Each
3
+ player is dealt two cards and the player who has the highest sum of the two
4
+ numbers wins. If multiple players have the highest sum, the one of them who
5
+ holds the highest card wins. All 8 cards are dealt simultaneously so it's
6
+ impossible for two players to have the same card.
7
+
8
+ After seeing your two cards you can bet $1. If you win the hand you get $4
9
+ back but if another player wins you lose your dollar. You can also fold, in
10
+ which case you don't win nor lose any money. Your opponents play very
11
+ aggressively and they will always bet. After the winner is determined all
12
+ cards are reshuffled to play another hand for the total of **H** games. It's
13
+ possible you get dealt the same hand more than once.
14
+
15
+ You want to maximize your winnings and only bet if your expected winnings are
16
+ strictly greater than zero. To help yourself you decided to write a program
17
+ that for the given deck size and hands you were dealt returns whether you
18
+ should bet or fold.
19
+
20
+ ### Input
21
+
22
+ The first line of the input consists of a single integer **T**, the number of
23
+ test cases.
24
+ Each test case starts with a line containing two integers **N** and **H**
25
+ The subsequent **H** lines each contain two integers, **C1** and **C2**, the
26
+ cards you were dealt.
27
+
28
+ ### Output
29
+
30
+ For each test case **i** numbered from 1 to **T**, output "Case #**i**: ",
31
+ followed by a string of **H** characters. Each character being either "B" if
32
+ you should bet, or "F" if should fold. The order of characters corresponds to
33
+ the order of hands given in the input.
34
+
35
+ ### Constraints
36
+
37
+ 1 ≤ **T** ≤ 20
38
+ 8 ≤ **N** ≤ 100
39
+ 1 ≤ **H** ≤ 10000
40
+ 1 ≤ **C1**, **C2** ≤ **N**
41
+ **C1** ≠ **C2**
42
+
43
+ ### Examples
44
+
45
+ In the first three examples we are playing a single hand with a deck of eight
46
+ cards. The first case is a clear winner so you should bet. The second case
47
+ gives no chance to win and you should fold. Finally the third case gives you
48
+ 40% chance of winning. This is good enough to make the bet profitable.
49
+
2014/round2/holdem_numbers.out ADDED
The diff for this file is too large to render. See raw diff
 
2014/round2/magic_pairs.html ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <p>
2
+ The princess of the kingdom of Hackadia has been kidnapped by an evil dragon. As always the prince Z.A.Y. is going to try to rescue her. The evil dragon is keeping the princess prisoner in his deepest dungeon, and the prince has to solve a puzzle to get her out safely.
3
+ </p>
4
+
5
+ <p>
6
+ There are two straight boards in front of the dungeon, both divided into a large number of sections. Each section contains a sparkling gemstone. Each stone has a color. We will denote these colors with numbers.
7
+ </p>
8
+
9
+ <p>
10
+ Let's say these boards <strong>Board<sub>1</sub></strong> and <strong>Board<sub>2</sub></strong> contain <strong>N</strong> and <strong>M</strong> sections respectively. Let's call a pair of integers <strong>x</strong>, <strong>y</strong> a magic pair if they have the following properties:
11
+ <ol>
12
+ <li>0 &le; <strong>x</strong> &lt; <strong>N</strong></li>
13
+ <li>0 &le; <strong>y</strong> &lt; <strong>M</strong></li>
14
+ <li>The set of different colors in <strong>Board<sub>1</sub></strong>[0...<strong>x</strong>] equals the set of different colors in <strong>Board<sub>2</sub></strong>[0...<strong>y</strong>]</li>
15
+ </ol>
16
+ </p>
17
+
18
+ <p>
19
+ The prince has asked you to find out how many magic pairs exist for the given two boards, so he can free the princess and become the hero. He will take all the glory from this, so you will have to make do with points in this competition as payment for your help.
20
+ </p>
21
+
22
+ <p>
23
+ Since the numbers <strong>N</strong> and <strong>M</strong> might be very large, the colors of the gemstones will be supplied through a pseudo random generator. This works as follows:<br />
24
+ <strong>Board<sub>1</sub></strong>[0] = <strong>x1</strong><br />
25
+ <strong>Board<sub>2</sub></strong>[0] = <strong>x2</strong><br/>
26
+ <strong>Board<sub>1</sub></strong>[<strong>i</strong>] = (<strong>a1</strong> * <strong>Board<sub>1</sub></strong>[(<strong>i</strong>-1) % <strong>N</strong>] + <strong>b1</strong> * <strong>Board<sub>2</sub></strong>[(<strong>i</strong>-1) % <strong>M</strong>] + <strong>c1</strong>) % <strong>r1</strong>, for 0 &lt; <strong>i</strong> &lt; <strong>N</strong><br />
27
+ <strong>Board<sub>2</sub></strong>[<strong>i</strong>] = (<strong>a2</strong> * <strong>Board<sub>1</sub></strong>[(<strong>i</strong>-1) % <strong>N</strong>] + <strong>b2</strong> * <strong>Board<sub>2</sub></strong>[(<strong>i</strong>-1) % <strong>M</strong>] + <strong>c2</strong>) % <strong>r2</strong>, for 0 &lt; <strong>i</strong> &lt; <strong>M</strong><br />
28
+ </p>
29
+
30
+ <h3>Input</h3>
31
+ <p>
32
+ The first line of the input consists of a single integer <strong>T</strong>, the number of test
33
+ cases. <br />
34
+ Each test case starts with a line containing the integers <strong>N</strong>, <strong>M</strong> <br />
35
+ The second line of each test case contains five integers <strong>x1</strong>, <strong>a1</strong>, <strong>b1</strong>, <strong>c1</strong>, <strong>r1</strong><br/>
36
+ The third line of each test case contains five integers <strong>x2</strong>, <strong>a2</strong>, <strong>b2</strong>, <strong>c2</strong>, <strong>r2</strong><br />
37
+ </p>
38
+
39
+ <h3>Output</h3>
40
+ <p>
41
+ For each test case <strong>i</strong> numbered from 1 to <strong>T</strong>, output "Case #<strong>i</strong>: ", followed by the number of magic pairs for the two boards.
42
+ </p>
43
+
44
+ <h3>Constraints</h3>
45
+ <p>
46
+ 1 &le; <strong>T</strong> &le; 20 <br />
47
+ 1 &le; <strong>N</strong>, <strong>M</strong> &le; 10^6<br />
48
+ 0 &le; <strong>x1</strong>, <strong>x2</strong>, <strong>a1</strong>, <strong>a2</strong>, <strong>b1</strong>, <strong>b2</strong>, <strong>c1</strong>, <strong>c2</strong> &le; 10^9<br />
49
+ 1 &le; <strong>r1</strong>, <strong>r2</strong> &le; 10^9 <br />
50
+ </p>
51
+
52
+ <h3>Examples</h3>
53
+ The first example produces the following boards:<br />
54
+ <strong>Board<sub>1</sub></strong> = [0, 3, 2, 0, 4, 2, 1, 3]<br />
55
+ <strong>Board<sub>2</sub></strong> = [0, 4, 2, 1, 4, 3]<br />
56
+ There are 3 magic pairs:<br />
57
+ pair(0, 0) ==&gt; (0)<br>
58
+ pair(6, 5) ==&gt; (0, 1, 2, 3, 4)<br>
59
+ pair(7, 5) ==&gt; (0, 1, 2, 3, 4)<br>