wjomlex commited on
Commit
07f695f
1 Parent(s): 761e24d

2016 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 +5 -0
  2. 2016/finals/boomerang_crews.cpp +143 -0
  3. 2016/finals/boomerang_crews.html +68 -0
  4. 2016/finals/boomerang_crews.in +3 -0
  5. 2016/finals/boomerang_crews.md +52 -0
  6. 2016/finals/boomerang_crews.out +75 -0
  7. 2016/finals/grundy_graph.cpp +202 -0
  8. 2016/finals/grundy_graph.html +51 -0
  9. 2016/finals/grundy_graph.in +3 -0
  10. 2016/finals/grundy_graph.md +48 -0
  11. 2016/finals/grundy_graph.out +44 -0
  12. 2016/finals/maximinimax_flow.cpp +271 -0
  13. 2016/finals/maximinimax_flow.html +93 -0
  14. 2016/finals/maximinimax_flow.in +3 -0
  15. 2016/finals/maximinimax_flow.md +76 -0
  16. 2016/finals/maximinimax_flow.out +85 -0
  17. 2016/finals/rainbow_string.cpp +218 -0
  18. 2016/finals/rainbow_string.html +74 -0
  19. 2016/finals/rainbow_string.in +3 -0
  20. 2016/finals/rainbow_string.md +35 -0
  21. 2016/finals/rainbow_string.out +55 -0
  22. 2016/finals/rng.cpp +200 -0
  23. 2016/finals/rng.html +66 -0
  24. 2016/finals/rng.in +3 -0
  25. 2016/finals/rng.md +66 -0
  26. 2016/finals/rng.out +46 -0
  27. 2016/finals/snake_and_ladder.cpp +178 -0
  28. 2016/finals/snake_and_ladder.html +48 -0
  29. 2016/finals/snake_and_ladder.in +0 -0
  30. 2016/finals/snake_and_ladder.md +67 -0
  31. 2016/finals/snake_and_ladder.out +529 -0
  32. 2016/quals/boomerang_constellations.html +45 -0
  33. 2016/quals/boomerang_constellations.in +0 -0
  34. 2016/quals/boomerang_constellations.md +37 -0
  35. 2016/quals/boomerang_constellations.out +75 -0
  36. 2016/quals/high_security.html +62 -0
  37. 2016/quals/high_security.in +0 -0
  38. 2016/quals/high_security.md +46 -0
  39. 2016/quals/high_security.out +307 -0
  40. 2016/quals/price.html +53 -0
  41. 2016/quals/price.in +0 -0
  42. 2016/quals/price.md +47 -0
  43. 2016/quals/price.out +55 -0
  44. 2016/quals/text_editor.html +67 -0
  45. 2016/quals/text_editor.in +0 -0
  46. 2016/quals/text_editor.md +54 -0
  47. 2016/quals/text_editor.out +305 -0
  48. 2016/round1/boomerang_tournament.html +77 -0
  49. 2016/round1/boomerang_tournament.in +2395 -0
  50. 2016/round1/boomerang_tournament.md +62 -0
.gitattributes CHANGED
@@ -63,3 +63,8 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
63
  2015/finals/fox_hawks.in filter=lfs diff=lfs merge=lfs -text
64
  2015/round1/autocomplete.in filter=lfs diff=lfs merge=lfs -text
65
  2015/round1/corporate_gifting.in filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
63
  2015/finals/fox_hawks.in filter=lfs diff=lfs merge=lfs -text
64
  2015/round1/autocomplete.in filter=lfs diff=lfs merge=lfs -text
65
  2015/round1/corporate_gifting.in filter=lfs diff=lfs merge=lfs -text
66
+ 2016/finals/boomerang_crews.in filter=lfs diff=lfs merge=lfs -text
67
+ 2016/finals/grundy_graph.in filter=lfs diff=lfs merge=lfs -text
68
+ 2016/finals/maximinimax_flow.in filter=lfs diff=lfs merge=lfs -text
69
+ 2016/finals/rainbow_string.in filter=lfs diff=lfs merge=lfs -text
70
+ 2016/finals/rng.in filter=lfs diff=lfs merge=lfs -text
2016/finals/boomerang_crews.cpp ADDED
@@ -0,0 +1,143 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // BOOMERANG CREWS
2
+ // Official Solution by Jacob Plachta
3
+
4
+ #define DEBUG 0
5
+
6
+ #include <algorithm>
7
+ #include <functional>
8
+ #include <numeric>
9
+ #include <iostream>
10
+ #include <iomanip>
11
+ #include <cstdio>
12
+ #include <cmath>
13
+ #include <complex>
14
+ #include <cstdlib>
15
+ #include <ctime>
16
+ #include <cstring>
17
+ #include <cassert>
18
+ #include <string>
19
+ #include <vector>
20
+ #include <list>
21
+ #include <map>
22
+ #include <set>
23
+ #include <deque>
24
+ #include <queue>
25
+ #include <stack>
26
+ #include <bitset>
27
+ #include <sstream>
28
+ using namespace std;
29
+
30
+ #define LL long long
31
+ #define LD long double
32
+ #define PR pair<int,int>
33
+
34
+ #define Fox(i,n) for (i=0; i<n; i++)
35
+ #define Fox1(i,n) for (i=1; i<=n; i++)
36
+ #define FoxI(i,a,b) for (i=a; i<=b; i++)
37
+ #define FoxR(i,n) for (i=(n)-1; i>=0; i--)
38
+ #define FoxR1(i,n) for (i=n; i>0; i--)
39
+ #define FoxRI(i,a,b) for (i=b; i>=a; i--)
40
+ #define Foxen(i,s) for (i=s.begin(); i!=s.end(); i++)
41
+ #define Min(a,b) a=min(a,b)
42
+ #define Max(a,b) a=max(a,b)
43
+ #define Sz(s) int((s).size())
44
+ #define All(s) (s).begin(),(s).end()
45
+ #define Fill(s,v) memset(s,v,sizeof(s))
46
+ #define pb push_back
47
+ #define mp make_pair
48
+ #define x first
49
+ #define y second
50
+
51
+ template<typename T> T Abs(T x) { return(x<0 ? -x : x); }
52
+ template<typename T> T Sqr(T x) { return(x*x); }
53
+ string plural(string s) { return(Sz(s) && s[Sz(s)-1]=='x' ? s+"en" : s+"s"); }
54
+
55
+ const int INF = (int)1e9;
56
+ const LD EPS = 1e-9;
57
+ const LD PI = acos(-1.0);
58
+
59
+ //#if DEBUG
60
+ #define GETCHAR getchar
61
+ /*#else
62
+ #define GETCHAR getchar_unlocked
63
+ #endif*/
64
+
65
+ bool Read(int &x)
66
+ {
67
+ char c,r=0,n=0;
68
+ x=0;
69
+ for(;;)
70
+ {
71
+ c=GETCHAR();
72
+ if ((c<0) && (!r))
73
+ return(0);
74
+ if ((c=='-') && (!r))
75
+ n=1;
76
+ else
77
+ if ((c>='0') && (c<='9'))
78
+ x=x*10+c-'0',r=1;
79
+ else
80
+ if (r)
81
+ break;
82
+ }
83
+ if (n)
84
+ x=-x;
85
+ return(1);
86
+ }
87
+
88
+ int main()
89
+ {
90
+ if (DEBUG)
91
+ freopen("in.txt","r",stdin);
92
+ int T,t;
93
+ int N,M,D;
94
+ int i,j,c,free;
95
+ int r1,r2,m;
96
+ static int A[100000],B[100000];
97
+ set<PR> S;
98
+ set<PR>::iterator I;
99
+ Read(T);
100
+ Fox1(t,T)
101
+ {
102
+ Read(N),Read(M),Read(D);
103
+ Fox(i,N)
104
+ Read(A[i]);
105
+ Fox(i,M)
106
+ Read(B[i]);
107
+ sort(A,A+N);
108
+ reverse(A,A+N);
109
+ j=free=0;
110
+ Fox(i,M)
111
+ if (B[i]<=A[0])
112
+ free++;
113
+ else
114
+ B[j++]=B[i];
115
+ M=j;
116
+ sort(B,B+M);
117
+ r1=0,r2=min(N,M);
118
+ while (r2>r1)
119
+ {
120
+ m=(r1+r2+1)>>1;
121
+ S.clear();
122
+ Fox(i,m)
123
+ S.insert(mp(A[i]%D,i));
124
+ c=1;
125
+ Fox(i,m)
126
+ {
127
+ I=S.lower_bound(mp(B[i]%D,-1));
128
+ if (I==S.end())
129
+ I=S.begin();
130
+ j=A[I->y],S.erase(I);
131
+ c+=(B[i]-j+D-1)/D-1;
132
+ if (c>N-m)
133
+ goto Bad;
134
+ }
135
+ r1=m;
136
+ continue;
137
+ Bad:;
138
+ r2=m-1;
139
+ }
140
+ printf("Case #%d: %d\n",t,free+r1);
141
+ }
142
+ return(0);
143
+ }
2016/finals/boomerang_crews.html ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <p>
2
+ It's time to settle things once and for all. Your boomerang crew has decided to challenge their rivals to a boomerang crew battle!
3
+ </p>
4
+
5
+ <p>
6
+ Your crew has <strong>N</strong> members with strengths <strong>A<sub>1..N</sub></strong>,
7
+ while the opposing crew has <strong>M</strong> members with strengths <strong>B<sub>1..M</sub></strong>.
8
+ The crew battle will proceed as follows:
9
+ </p>
10
+
11
+ <ol>
12
+ <li> Each crew will arrange its members in a line, in some order. </li>
13
+ <li> A throwing contest will take place between the first person in your line, and the first person in your opponents' line. </li>
14
+ <li> Whoever loses the contest (see below for details) will leave their line permanently, while the winner will stay at the front of their line. </li>
15
+ <li> If one of the lines has become empty, that crew loses and the crew battle concludes. </li>
16
+ <li> Otherwise, back to step 2. </li>
17
+ </ol>
18
+
19
+ <p>
20
+ However, you're not about to play fair with your enemies &mdash; you've got the following 3 things going for you:
21
+ </p>
22
+
23
+ <ol>
24
+ <li> You will decide the initial ordering of members for <em>both</em> crews (in step 1 of the crew battle).
25
+ <li> When a member of your crew with strength <strong>S</strong> competes in a throwing contest, they'll throw their boomerang a distance of <strong>S</strong> feet.
26
+ On the other hand, due to a bit of subtle poisoning you've done in advance, your enemies will get tired after each throw.
27
+ In particular, when a member of the rival crew with strength <strong>S</strong> competes in a throwing contest,
28
+ such that they've already competed in (and won) <strong>C</strong> throwing contests previously,
29
+ they'll throw their boomerang a distance of max{<strong>S</strong> - <strong>C</strong>*<strong>D</strong>, 1} feet (where <strong>D</strong> is a set constant).
30
+ <li> In each throwing contest, your crew's member will win if their throw distance is greater than <em>or equal</em> to their opponent's.
31
+ </ol>
32
+
33
+ <p>
34
+ Despite these advantages, it's possible that you'll still be unable to emerge victorious. However, whether or not you do, you'd like to maximize the number of
35
+ throwing contests that members of your crew win over the course of the crew battle (given that you choose optimal initial orderings for both lines).
36
+ </p>
37
+
38
+
39
+ <h3>Input</h3>
40
+ <p>
41
+ Input begins with an integer <strong>T</strong>, the number of battles.
42
+ For each battle, there are three lines.
43
+ The first line contains the space-separated integers <strong>N</strong>, <strong>M</strong>, and <strong>D</strong>.
44
+ The second line contains the <strong>N</strong> space-separated integers <strong>A<sub>1</sub></strong> to <strong>A<sub>N</sub></strong>.
45
+ The third line contains the <strong>M</strong> space-separated integers <strong>B<sub>1</sub></strong> to <strong>B<sub>M</sub></strong>.
46
+ </p>
47
+
48
+
49
+ <h3>Output</h3>
50
+ <p>
51
+ For the <strong>i</strong>th battle, print a line containing "Case #<strong>i</strong>: " followed by the maximum number of throwing contests that your crew can win.
52
+ </p>
53
+
54
+
55
+ <h3>Constraints</h3>
56
+ <p>
57
+ 1 &le; <strong>T</strong> &le; 75 <br />
58
+ 1 &le; <strong>N</strong>, <strong>M</strong> &le; 100,000 <br />
59
+ 1 &le; <strong>A<sub>i</sub></strong>, <strong>B<sub>i</sub></strong>, <strong>D</strong> &le; 1,000,000,000 <br />
60
+ </p>
61
+
62
+
63
+ <h3>Explanation of Sample</h3>
64
+ <p>
65
+ In the first battle, your single member cannot beat theirs. In the second battle, they can (just barely).
66
+
67
+ In the fourth battle, one solution is to arrange their crew as [35, 25, 5] and your crew as [10, 20, 30] to emerge victorious (in which case, 5 throwing contests will occur, of which your crew will win the last three).
68
+ </p>
2016/finals/boomerang_crews.in ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4061ff66fb665a646e9f24c016d6fc6452c217088d9787cd0b2c8654365af587
3
+ size 20373854
2016/finals/boomerang_crews.md ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ It's time to settle things once and for all. Your boomerang crew has decided
2
+ to challenge their rivals to a boomerang crew battle!
3
+
4
+ Your crew has **N** members with strengths **A1..N**, while the opposing crew
5
+ has **M** members with strengths **B1..M**. The crew battle will proceed as
6
+ follows:
7
+
8
+ 1. Each crew will arrange its members in a line, in some order.
9
+ 2. A throwing contest will take place between the first person in your line, and the first person in your opponents' line.
10
+ 3. Whoever loses the contest (see below for details) will leave their line permanently, while the winner will stay at the front of their line.
11
+ 4. If one of the lines has become empty, that crew loses and the crew battle concludes.
12
+ 5. Otherwise, back to step 2.
13
+
14
+ However, you're not about to play fair with your enemies — you've got the
15
+ following 3 things going for you:
16
+
17
+ 1. You will decide the initial ordering of members for _both_ crews (in step 1 of the crew battle).
18
+ 2. When a member of your crew with strength **S** competes in a throwing contest, they'll throw their boomerang a distance of **S** feet. On the other hand, due to a bit of subtle poisoning you've done in advance, your enemies will get tired after each throw. In particular, when a member of the rival crew with strength **S** competes in a throwing contest, such that they've already competed in (and won) **C** throwing contests previously, they'll throw their boomerang a distance of max{**S** \- **C*****D**, 1} feet (where **D** is a set constant).
19
+ 3. In each throwing contest, your crew's member will win if their throw distance is greater than _or equal_ to their opponent's.
20
+
21
+ Despite these advantages, it's possible that you'll still be unable to emerge
22
+ victorious. However, whether or not you do, you'd like to maximize the number
23
+ of throwing contests that members of your crew win over the course of the crew
24
+ battle (given that you choose optimal initial orderings for both lines).
25
+
26
+ ### Input
27
+
28
+ Input begins with an integer **T**, the number of battles. For each battle,
29
+ there are three lines. The first line contains the space-separated integers
30
+ **N**, **M**, and **D**. The second line contains the **N** space-separated
31
+ integers **A1** to **AN**. The third line contains the **M** space-separated
32
+ integers **B1** to **BM**.
33
+
34
+ ### Output
35
+
36
+ For the **i**th battle, print a line containing "Case #**i**: " followed by
37
+ the maximum number of throwing contests that your crew can win.
38
+
39
+ ### Constraints
40
+
41
+ 1 ≤ **T** ≤ 75
42
+ 1 ≤ **N**, **M** ≤ 100,000
43
+ 1 ≤ **Ai**, **Bi**, **D** ≤ 1,000,000,000
44
+
45
+ ### Explanation of Sample
46
+
47
+ In the first battle, your single member cannot beat theirs. In the second
48
+ battle, they can (just barely). In the fourth battle, one solution is to
49
+ arrange their crew as [35, 25, 5] and your crew as [10, 20, 30] to emerge
50
+ victorious (in which case, 5 throwing contests will occur, of which your crew
51
+ will win the last three).
52
+
2016/finals/boomerang_crews.out ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Case #1: 0
2
+ Case #2: 1
3
+ Case #3: 4
4
+ Case #4: 3
5
+ Case #5: 2
6
+ Case #6: 8328
7
+ Case #7: 9173
8
+ Case #8: 6951
9
+ Case #9: 13491
10
+ Case #10: 7430
11
+ Case #11: 9642
12
+ Case #12: 12413
13
+ Case #13: 6663
14
+ Case #14: 9234
15
+ Case #15: 12106
16
+ Case #16: 122
17
+ Case #17: 62
18
+ Case #18: 162
19
+ Case #19: 70
20
+ Case #20: 21
21
+ Case #21: 123
22
+ Case #22: 134
23
+ Case #23: 32
24
+ Case #24: 50
25
+ Case #25: 125
26
+ Case #26: 20
27
+ Case #27: 30
28
+ Case #28: 68
29
+ Case #29: 53
30
+ Case #30: 11
31
+ Case #31: 7
32
+ Case #32: 33
33
+ Case #33: 119
34
+ Case #34: 64
35
+ Case #35: 23
36
+ Case #36: 82
37
+ Case #37: 51
38
+ Case #38: 24
39
+ Case #39: 25
40
+ Case #40: 80
41
+ Case #41: 9
42
+ Case #42: 107
43
+ Case #43: 13
44
+ Case #44: 57
45
+ Case #45: 146
46
+ Case #46: 39
47
+ Case #47: 37
48
+ Case #48: 71
49
+ Case #49: 69
50
+ Case #50: 51
51
+ Case #51: 10
52
+ Case #52: 48
53
+ Case #53: 24
54
+ Case #54: 36
55
+ Case #55: 170
56
+ Case #56: 24
57
+ Case #57: 140
58
+ Case #58: 25
59
+ Case #59: 84
60
+ Case #60: 13
61
+ Case #61: 50
62
+ Case #62: 83
63
+ Case #63: 12
64
+ Case #64: 114
65
+ Case #65: 64
66
+ Case #66: 43
67
+ Case #67: 102
68
+ Case #68: 21
69
+ Case #69: 70
70
+ Case #70: 3
71
+ Case #71: 20
72
+ Case #72: 23
73
+ Case #73: 31
74
+ Case #74: 67
75
+ Case #75: 33
2016/finals/grundy_graph.cpp ADDED
@@ -0,0 +1,202 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // GRUNDY GRAPH
2
+ // Official Solution by Jacob Plachta
3
+
4
+ #define DEBUG 0
5
+
6
+ #include <algorithm>
7
+ #include <functional>
8
+ #include <numeric>
9
+ #include <iostream>
10
+ #include <iomanip>
11
+ #include <cstdio>
12
+ #include <cmath>
13
+ #include <complex>
14
+ #include <cstdlib>
15
+ #include <ctime>
16
+ #include <cstring>
17
+ #include <cassert>
18
+ #include <string>
19
+ #include <vector>
20
+ #include <list>
21
+ #include <map>
22
+ #include <set>
23
+ #include <deque>
24
+ #include <queue>
25
+ #include <stack>
26
+ #include <bitset>
27
+ #include <sstream>
28
+ using namespace std;
29
+
30
+ #define LL long long
31
+ #define LD long double
32
+ #define PR pair<int,int>
33
+
34
+ #define Fox(i,n) for (i=0; i<n; i++)
35
+ #define Fox1(i,n) for (i=1; i<=n; i++)
36
+ #define FoxI(i,a,b) for (i=a; i<=b; i++)
37
+ #define FoxR(i,n) for (i=(n)-1; i>=0; i--)
38
+ #define FoxR1(i,n) for (i=n; i>0; i--)
39
+ #define FoxRI(i,a,b) for (i=b; i>=a; i--)
40
+ #define Foxen(i,s) for (i=s.begin(); i!=s.end(); i++)
41
+ #define Min(a,b) a=min(a,b)
42
+ #define Max(a,b) a=max(a,b)
43
+ #define Sz(s) int((s).size())
44
+ #define All(s) (s).begin(),(s).end()
45
+ #define Fill(s,v) memset(s,v,sizeof(s))
46
+ #define pb push_back
47
+ #define mp make_pair
48
+ #define x first
49
+ #define y second
50
+
51
+ template<typename T> T Abs(T x) { return(x<0 ? -x : x); }
52
+ template<typename T> T Sqr(T x) { return(x*x); }
53
+ string plural(string s) { return(Sz(s) && s[Sz(s)-1]=='x' ? s+"en" : s+"s"); }
54
+
55
+ const int INF = (int)1e9;
56
+ const LD EPS = 1e-9;
57
+ const LD PI = acos(-1.0);
58
+
59
+ //#if DEBUG
60
+ #define GETCHAR getchar
61
+ /*#else
62
+ #define GETCHAR getchar_unlocked
63
+ #endif*/
64
+
65
+ bool Read(int &x)
66
+ {
67
+ char c,r=0,n=0;
68
+ x=0;
69
+ for(;;)
70
+ {
71
+ c=GETCHAR();
72
+ if ((c<0) && (!r))
73
+ return(0);
74
+ if ((c=='-') && (!r))
75
+ n=1;
76
+ else
77
+ if ((c>='0') && (c<='9'))
78
+ x=x*10+c-'0',r=1;
79
+ else
80
+ if (r)
81
+ break;
82
+ }
83
+ if (n)
84
+ x=-x;
85
+ return(1);
86
+ }
87
+
88
+ #define LIM 2000002
89
+
90
+ struct edge{int e, nxt;};
91
+ int V, E;
92
+ edge e[LIM], er[LIM];
93
+ int sp[LIM], spr[LIM];
94
+ int group_cnt, comp[LIM];
95
+ bool v[LIM];
96
+ int stk[LIM];
97
+ void fill_forward(int x)
98
+ {
99
+ int i;
100
+ v[x]=true;
101
+ for(i=sp[x];i;i=e[i].nxt) if(!v[e[i].e]) fill_forward(e[i].e);
102
+ stk[++stk[0]]=x;
103
+ }
104
+ void fill_backward(int x)
105
+ {
106
+ int i;
107
+ v[x]=false;
108
+ comp[x]=group_cnt;
109
+ for(i=spr[x];i;i=er[i].nxt) if(v[er[i].e]) fill_backward(er[i].e);
110
+ }
111
+ void add_edge(int v1, int v2) //add edge v1->v2
112
+ {
113
+ e [++E].e=v2; e [E].nxt=sp [v1]; sp [v1]=E;
114
+ er[ E].e=v1; er[E].nxt=spr[v2]; spr[v2]=E;
115
+ }
116
+ void SCC()
117
+ {
118
+ int i;
119
+ stk[0]=0;
120
+ memset(v, false, sizeof(v));
121
+ for(i=1;i<=V;i++) if(!v[i]) fill_forward(i);
122
+ group_cnt=0;
123
+ for(i=stk[0];i>=1;i--) if(v[stk[i]]){group_cnt++; fill_backward(stk[i]);}
124
+ }
125
+
126
+ int val[LIM];
127
+ bool visA[LIM],visB[LIM];
128
+ vector<int> con[LIM];
129
+
130
+ bool rec(int s,int i)
131
+ {
132
+ if ((i!=s) && ((i-1)/2%2))
133
+ return(1);
134
+ if (visB[i])
135
+ return(0);
136
+ visB[i]=1;
137
+ int j;
138
+ Fox(j,Sz(con[i]))
139
+ if (rec(s,con[i][j]))
140
+ return(1);
141
+ return(0);
142
+ }
143
+
144
+ int main()
145
+ {
146
+ if (DEBUG)
147
+ freopen("in.txt","r",stdin);
148
+ int T,t;
149
+ int N,M;
150
+ int i,j,a,b;
151
+ Read(T);
152
+ Fox1(t,T)
153
+ {
154
+ printf("Case #%d: ",t);
155
+ Read(N),Read(M);
156
+ N<<=1;
157
+ Fox1(i,N)
158
+ con[i].clear();
159
+ V=N;
160
+ E=0;
161
+ Fill(sp,0);
162
+ Fill(spr,0);
163
+ while (M--)
164
+ {
165
+ Read(i),Read(j);
166
+ con[i].pb(j);
167
+ add_edge(i,j);
168
+ if (j%2)
169
+ j++;
170
+ else
171
+ j--;
172
+ if (i%2)
173
+ i++;
174
+ else
175
+ i--;
176
+ con[j].pb(i);
177
+ add_edge(j,i);
178
+ }
179
+ SCC();
180
+ Fill(visA,0);
181
+ Fill(visB,0);
182
+ Fox1(i,N)
183
+ {
184
+ //Alice
185
+ a=comp[i],b=comp[i+1];
186
+ if (a==b)
187
+ goto Bad;
188
+ visA[a]=visA[b]=1;
189
+ i+=2;
190
+ //Bob
191
+ a=comp[i],b=comp[i+1];
192
+ if ((visA[a]) || (visA[b]) || (rec(i,i)) || (rec(i+1,i+1)))
193
+ goto Bad;
194
+ i++;
195
+ }
196
+ printf("Alice\n");
197
+ continue;
198
+ Bad:;
199
+ printf("Bob\n");
200
+ }
201
+ return(0);
202
+ }
2016/finals/grundy_graph.html ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <p>
2
+ Alice and Bob are spending the day in the local library, learning about 2-player zero-sum games. One of the books they're reading, "Grundy Numbers For Fun And Profit" by Nim Nimberly,
3
+ has an interactive insert with a bunch of graphs and instructions for a game where the players take turns colouring each graph's vertices.
4
+ </p>
5
+
6
+ <p>
7
+ Each game starts with a directed graph that has 2*<strong>N</strong> vertices, numbered from 1 to 2*<strong>N</strong>, all of which are initially uncoloured, and <strong>M</strong> edges.
8
+ The <strong>i</strong>th edge goes from vertex <strong>A<sub>i</sub></strong> to vertex <strong>B<sub>i</sub></strong>. No two edges connect the same pair of vertices
9
+ in the same direction, and no edge connects a vertex to itself.
10
+ </p>
11
+
12
+ <p>
13
+ Alice goes first and colours vertices 1 and 2. She must colour one of these two vertices black, and the other one white. Bob then takes his turn and similarly colours vertices 3 and 4, one of them black and the other one white.
14
+ This continues with Alice colouring vertices 5 and 6, Bob colouring 7 and 8, and so on until every vertex is coloured.
15
+ At the end of the game, Alice wins if there are no edges going from a black vertex to a white one. Bob wins if such an edge exists.
16
+ </p>
17
+
18
+ <p>
19
+ Who will win if Alice and Bob play optimally?
20
+ </p>
21
+
22
+ <h3>Input</h3>
23
+ <p>
24
+ Input begins with an integer <strong>T</strong>, the number of graphs.
25
+ For each graph, there is first a line containing the space-separated integers <strong>N</strong> and <strong>M</strong>.
26
+ Then <strong>M</strong> lines follow, the <strong>i</strong>th of which contains the space-separated integers
27
+ <strong>A<sub>i</sub></strong> and <strong>B<sub>i</sub></strong> .
28
+ </p>
29
+
30
+
31
+ <h3>Output</h3>
32
+ <p>
33
+ For the <strong>i</strong>th graph, print a line containing "Case #<strong>i</strong>: " followed by the winner of the game, either "Alice" or "Bob".
34
+ </p>
35
+
36
+
37
+ <h3>Constraints</h3>
38
+ <p>
39
+ 1 &le; <strong>T</strong> &le; 45 <br />
40
+ 1 &le; <strong>N</strong> &le; 500,000 <br />
41
+ 0 &le; <strong>M</strong> &le; 500,000 <br />
42
+ 1 &le; <strong>A<sub>i</sub></strong>, <strong>B<sub>i</sub></strong>, &le; 2*<strong>N</strong> <br />
43
+ </p>
44
+
45
+
46
+ <h3>Explanation of Sample</h3>
47
+ <p>
48
+ For the first graph, Alice can color vertex 1 white and vertex 2 black. Since all edges start at vertex 1, Alice will win.
49
+
50
+ For the second graph, Alice can't control the color of vertex 3. If Bob makes it white, then one of the two edges must be from a black vertex to a white vertex, so Bob wins.
51
+ </p>
2016/finals/grundy_graph.in ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:68b9b22aca60b72930b9484a7d427f37da5223dc1945ecbdda29adad8d789db8
3
+ size 62276868
2016/finals/grundy_graph.md ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Alice and Bob are spending the day in the local library, learning about
2
+ 2-player zero-sum games. One of the books they're reading, "Grundy Numbers For
3
+ Fun And Profit" by Nim Nimberly, has an interactive insert with a bunch of
4
+ graphs and instructions for a game where the players take turns colouring each
5
+ graph's vertices.
6
+
7
+ Each game starts with a directed graph that has 2***N** vertices, numbered
8
+ from 1 to 2***N**, all of which are initially uncoloured, and **M** edges. The
9
+ **i**th edge goes from vertex **Ai** to vertex **Bi**. No two edges connect
10
+ the same pair of vertices in the same direction, and no edge connects a vertex
11
+ to itself.
12
+
13
+ Alice goes first and colours vertices 1 and 2. She must colour one of these
14
+ two vertices black, and the other one white. Bob then takes his turn and
15
+ similarly colours vertices 3 and 4, one of them black and the other one white.
16
+ This continues with Alice colouring vertices 5 and 6, Bob colouring 7 and 8,
17
+ and so on until every vertex is coloured. At the end of the game, Alice wins
18
+ if there are no edges going from a black vertex to a white one. Bob wins if
19
+ such an edge exists.
20
+
21
+ Who will win if Alice and Bob play optimally?
22
+
23
+ ### Input
24
+
25
+ Input begins with an integer **T**, the number of graphs. For each graph,
26
+ there is first a line containing the space-separated integers **N** and **M**.
27
+ Then **M** lines follow, the **i**th of which contains the space-separated
28
+ integers **Ai** and **Bi** .
29
+
30
+ ### Output
31
+
32
+ For the **i**th graph, print a line containing "Case #**i**: " followed by the
33
+ winner of the game, either "Alice" or "Bob".
34
+
35
+ ### Constraints
36
+
37
+ 1 ≤ **T** ≤ 45
38
+ 1 ≤ **N** ≤ 500,000
39
+ 0 ≤ **M** ≤ 500,000
40
+ 1 ≤ **Ai**, **Bi**, ≤ 2***N**
41
+
42
+ ### Explanation of Sample
43
+
44
+ For the first graph, Alice can color vertex 1 white and vertex 2 black. Since
45
+ all edges start at vertex 1, Alice will win. For the second graph, Alice can't
46
+ control the color of vertex 3. If Bob makes it white, then one of the two
47
+ edges must be from a black vertex to a white vertex, so Bob wins.
48
+
2016/finals/grundy_graph.out ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Case #1: Alice
2
+ Case #2: Bob
3
+ Case #3: Bob
4
+ Case #4: Alice
5
+ Case #5: Alice
6
+ Case #6: Bob
7
+ Case #7: Bob
8
+ Case #8: Alice
9
+ Case #9: Alice
10
+ Case #10: Alice
11
+ Case #11: Alice
12
+ Case #12: Bob
13
+ Case #13: Bob
14
+ Case #14: Bob
15
+ Case #15: Bob
16
+ Case #16: Alice
17
+ Case #17: Alice
18
+ Case #18: Alice
19
+ Case #19: Alice
20
+ Case #20: Alice
21
+ Case #21: Bob
22
+ Case #22: Bob
23
+ Case #23: Bob
24
+ Case #24: Bob
25
+ Case #25: Bob
26
+ Case #26: Alice
27
+ Case #27: Alice
28
+ Case #28: Alice
29
+ Case #29: Alice
30
+ Case #30: Alice
31
+ Case #31: Bob
32
+ Case #32: Bob
33
+ Case #33: Bob
34
+ Case #34: Bob
35
+ Case #35: Bob
36
+ Case #36: Bob
37
+ Case #37: Bob
38
+ Case #38: Bob
39
+ Case #39: Bob
40
+ Case #40: Bob
41
+ Case #41: Bob
42
+ Case #42: Bob
43
+ Case #43: Bob
44
+ Case #44: Bob
2016/finals/maximinimax_flow.cpp ADDED
@@ -0,0 +1,271 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // MAXIMINIMAX FLOW
2
+ // Official Solution by Jacob Plachta
3
+
4
+ #define DEBUG 0
5
+
6
+ #include <algorithm>
7
+ #include <functional>
8
+ #include <numeric>
9
+ #include <iostream>
10
+ #include <iomanip>
11
+ #include <cstdio>
12
+ #include <cmath>
13
+ #include <complex>
14
+ #include <cstdlib>
15
+ #include <ctime>
16
+ #include <cstring>
17
+ #include <cassert>
18
+ #include <string>
19
+ #include <vector>
20
+ #include <list>
21
+ #include <map>
22
+ #include <set>
23
+ #include <deque>
24
+ #include <queue>
25
+ #include <stack>
26
+ #include <bitset>
27
+ #include <sstream>
28
+ using namespace std;
29
+
30
+ #define LL long long
31
+ #define LD long double
32
+ #define PR pair<int,int>
33
+
34
+ #define Fox(i,n) for (i=0; i<n; i++)
35
+ #define Fox1(i,n) for (i=1; i<=n; i++)
36
+ #define FoxI(i,a,b) for (i=a; i<=b; i++)
37
+ #define FoxR(i,n) for (i=(n)-1; i>=0; i--)
38
+ #define FoxR1(i,n) for (i=n; i>0; i--)
39
+ #define FoxRI(i,a,b) for (i=b; i>=a; i--)
40
+ #define Foxen(i,s) for (i=s.begin(); i!=s.end(); i++)
41
+ #define Min(a,b) a=min(a,b)
42
+ #define Max(a,b) a=max(a,b)
43
+ #define Sz(s) int((s).size())
44
+ #define All(s) (s).begin(),(s).end()
45
+ #define Fill(s,v) memset(s,v,sizeof(s))
46
+ #define pb push_back
47
+ #define mp make_pair
48
+ #define x first
49
+ #define y second
50
+
51
+ template<typename T> T Abs(T x) { return(x<0 ? -x : x); }
52
+ template<typename T> T Sqr(T x) { return(x*x); }
53
+ string plural(string s) { return(Sz(s) && s[Sz(s)-1]=='x' ? s+"en" : s+"s"); }
54
+
55
+ const int INF = (int)1e9;
56
+ const LD EPS = 1e-9;
57
+ const LD PI = acos(-1.0);
58
+
59
+ //#if DEBUG
60
+ #define GETCHAR getchar
61
+ /*#else
62
+ #define GETCHAR getchar_unlocked
63
+ #endif*/
64
+
65
+ bool Read(int &x)
66
+ {
67
+ char c,r=0,n=0;
68
+ x=0;
69
+ for(;;)
70
+ {
71
+ c=GETCHAR();
72
+ if ((c<0) && (!r))
73
+ return(0);
74
+ if ((c=='-') && (!r))
75
+ n=1;
76
+ else
77
+ if ((c>='0') && (c<='9'))
78
+ x=x*10+c-'0',r=1;
79
+ else
80
+ if (r)
81
+ break;
82
+ }
83
+ if (n)
84
+ x=-x;
85
+ return(1);
86
+ }
87
+
88
+ bool ReadLL(LL &x)
89
+ {
90
+ char c,r=0,n=0;
91
+ x=0;
92
+ for(;;)
93
+ {
94
+ c=GETCHAR();
95
+ if ((c<0) && (!r))
96
+ return(0);
97
+ if ((c=='-') && (!r))
98
+ n=1;
99
+ else
100
+ if ((c>='0') && (c<='9'))
101
+ x=x*10+c-'0',r=1;
102
+ else
103
+ if (r)
104
+ break;
105
+ }
106
+ if (n)
107
+ x=-x;
108
+ return(1);
109
+ }
110
+
111
+ #define LIM 500005
112
+ #define LIM2 1000000
113
+
114
+ LL BLT[2][2][LIM2+1];
115
+
116
+ void Update(int a,int b,int i,int v)
117
+ {
118
+ for (; i<=LIM2; i+=(i&-i))
119
+ BLT[a][b][i]+=v;
120
+ }
121
+
122
+ void Update2(int a,int i,int v)
123
+ {
124
+ Update(a,0,i,v);
125
+ Update(a,1,i,i*v);
126
+ }
127
+
128
+ LL Query(int a,int b,LL ii)
129
+ {
130
+ int i=(int)min(ii,(LL)LIM2);
131
+ LL v=0;
132
+ for(; i>0; i-=(i&-i))
133
+ v+=BLT[a][b][i];
134
+ return(v);
135
+ }
136
+
137
+ int main()
138
+ {
139
+ if (DEBUG)
140
+ freopen("in.txt","r",stdin);
141
+ //vars
142
+ int T,t;
143
+ int N,M;
144
+ int i,j,k;
145
+ LL r1,r2,m,m2;
146
+ LL tot,rem,cnt,sum;
147
+ LL ans;
148
+ static vector<PR> con[LIM];
149
+ static int C[LIM],dep[LIM],cyc[LIM];
150
+ static PR par[LIM];
151
+ queue<int> Q;
152
+ set<PR> S;
153
+ set<PR>::iterator I;
154
+ //testcase loop
155
+ Read(T);
156
+ Fox1(t,T)
157
+ {
158
+ //input
159
+ Read(N),Read(M);
160
+ Fox(i,N)
161
+ {
162
+ Read(j),Read(k),Read(C[i]);
163
+ j--,k--;
164
+ con[j].pb(mp(k,i));
165
+ con[k].pb(mp(j,i));
166
+ }
167
+ //BFS to find the single cycle
168
+ Fill(dep,-1);
169
+ Q.push(0),dep[0]=0;
170
+ for(;;)
171
+ {
172
+ i=Q.front(),Q.pop();
173
+ Fox(j,Sz(con[i]))
174
+ if ((k=con[i][j].x)!=par[i].x)
175
+ if (dep[k]>=0)
176
+ goto Done;
177
+ else
178
+ Q.push(k),dep[k]=dep[i]+1,par[k]=mp(i,con[i][j].y);
179
+ }
180
+ //retrace all edges in the cycle
181
+ Done:;
182
+ Fill(cyc,0);
183
+ cyc[con[i][j].y]=1;
184
+ while (i!=k)
185
+ if (dep[i]>dep[k])
186
+ {
187
+ cyc[par[i].y]=1;
188
+ i=par[i].x;
189
+ }
190
+ else
191
+ {
192
+ cyc[par[k].y]=1;
193
+ k=par[k].x;
194
+ }
195
+ //init BLTs
196
+ Fox(i,N)
197
+ {
198
+ Update2(cyc[i],C[i],1);
199
+ if (cyc[i])
200
+ S.insert(mp(C[i],i));
201
+ }
202
+ //handle operations
203
+ ans=0;
204
+ while (M--)
205
+ {
206
+ Read(i);
207
+ if (i==1)
208
+ {
209
+ //delete and re-add the adge
210
+ Read(i),i--;
211
+ Update2(cyc[i],C[i],-1);
212
+ if (cyc[i])
213
+ S.erase(mp(C[i],i));
214
+ Read(C[i]);
215
+ Update2(cyc[i],C[i],1);
216
+ if (cyc[i])
217
+ S.insert(mp(C[i],i));
218
+ }
219
+ else
220
+ {
221
+ //binary search on the answer
222
+ ReadLL(tot);
223
+ r1=1,r2=(LL)1e13;
224
+ while (r2>r1)
225
+ {
226
+ m=(r1+r2+1)>>1;
227
+ rem=tot;
228
+ //non-cycle edges
229
+ cnt=Query(0,0,m);
230
+ sum=Query(0,1,m);
231
+ rem-=cnt*m - sum;
232
+ if (rem<0)
233
+ goto Bad;
234
+ //cycle edges
235
+ I=S.begin(),i=I->x;
236
+ I++,j=I->x;
237
+ if (m<=(j<<1))
238
+ rem-=max(0LL,m - (i+j));
239
+ else
240
+ {
241
+ m2=(m+1)>>1;
242
+ cnt=Query(1,0,m2);
243
+ sum=Query(1,1,m2);
244
+ rem-=cnt*m2 - sum;
245
+ if (m&1)
246
+ rem++;
247
+ }
248
+ if (rem<0)
249
+ {
250
+ Bad:;
251
+ r2=m-1;
252
+ continue;
253
+ }
254
+ r1=m;
255
+ }
256
+ ans+=r1;
257
+ }
258
+ }
259
+ //output
260
+ printf("Case #%d: ",t);
261
+ cout << ans << endl;
262
+ //reset
263
+ Fox(i,N)
264
+ con[i].clear();
265
+ while (!Q.empty())
266
+ Q.pop();
267
+ S.clear();
268
+ Fill(BLT,0);
269
+ }
270
+ return(0);
271
+ }
2016/finals/maximinimax_flow.html ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <p>
2
+ You're given an undirected, connected graph with <strong>N</strong> nodes (numbered from 1 to <strong>N</strong>) and <strong>N</strong> edges.
3
+ The <strong>i</strong>th edge connects distinct nodes <strong>A<sub>i</sub></strong> and <strong>B<sub>i</sub></strong>,
4
+ and has a capacity of <strong>C<sub>i</sub></strong>. No two edges directly connect the same pair of nodes.
5
+ </p>
6
+
7
+ <p>
8
+ <strong>M</strong> operations will be performed on this graph, one after another. The nature of the <strong>i</strong>th operation is described by the value of <strong>O<sub>i</sub></strong>:
9
+
10
+ <p>
11
+ - If <strong>O<sub>i</sub></strong> = 1, then the <strong>i</strong>th operation is an update, in which the capacity of the
12
+ <strong>X<sub>i</sub></strong>th edge is changed to be <strong>Y<sub>i</sub></strong>.
13
+ </p>
14
+
15
+ <p>
16
+ - Otherwise, if <strong>O<sub>i</sub></strong> = 2, then the <strong>i</strong>th operation is a query, in which you must determine the maximinimax flow in the graph after
17
+ <strong>Z<sub>i</sub></strong> edge augmentations.
18
+ </p>
19
+
20
+ <p>
21
+ What do any of those terms mean? Let's define them:
22
+ </p>
23
+
24
+ <p>
25
+ - An edge augmentation is a temporary increase of a certain edge's capacity by 1 for the current query.
26
+ </p>
27
+
28
+ <p>
29
+ - The max flow from node <strong>u</strong> to a different node <strong>v</strong> is the usual definition of maximum flow in computer science (hopefully you're familiar with it!),
30
+ with node <strong>u</strong> being the source and node <strong>v</strong> being the sink. Each edge may transport flow in either direction, so it may be thought of as two directed edges
31
+ (one in each direction), both with the same capacity.
32
+ </p>
33
+
34
+ <p>
35
+ - The minimax flow in the graph is the smallest max flow value across all pairs of distinct nodes. In other words,
36
+ min{1 &le; <strong>u</strong>, <strong>v</strong> &le; <strong>N</strong>, <strong>u</strong> &ne; <strong>v</strong>} (F(<strong>u</strong>, <strong>v</strong>)),
37
+ where F(<strong>u</strong>, <strong>v</strong>) is the max flow from node <strong>u</strong> to node <strong>v</strong>.
38
+ </p>
39
+
40
+ <p>
41
+ - The maximinimax flow in the graph after <strong>x</strong> edge augmentations is the largest possible minimax flow which the graph can have after
42
+ <strong>x</strong> optimal edge augmentations are applied. Note that each edge can be augmented any non-negative number of times
43
+ (as long as the total number of augmentations in the graph is <strong>x</strong>), and that the chosen edge augmentations are temporary &mdash; they do not change the graph for future operations.
44
+ </p>
45
+
46
+ <p>
47
+ To reduce the size of the output, you should simply output one integer, the sum of the answers to all of the queries.
48
+ </p>
49
+
50
+
51
+ <h3>Input</h3>
52
+ <p>
53
+ Input begins with an integer <strong>T</strong>, the number of graphs.
54
+ For each graph, there is a first a line containing the space-separated integers <strong>N</strong> and <strong>M</strong>.
55
+
56
+ Then, <strong>N</strong> lines follow, the <strong>i</strong>th of which contains the space-separated integers
57
+ <strong>A<sub>i</sub></strong>, <strong>B<sub>i</sub></strong>, and <strong>C<sub>i</sub></strong>.
58
+
59
+ Then, <strong>M</strong> lines follow, the <strong>i</strong>th of which contains the space-separated integers
60
+ <strong>O<sub>i</sub></strong>, <strong>X<sub>i</sub></strong>, and <strong>Y<sub>i</sub></strong> (if <strong>O<sub>i</sub></strong> = 1) or
61
+ <strong>O<sub>i</sub></strong> and <strong>Z<sub>i</sub></strong> (if <strong>O<sub>i</sub></strong> = 2).
62
+ </p>
63
+
64
+
65
+ <h3>Output</h3>
66
+ <p>
67
+ For the <strong>i</strong>th graph, print a line containing "Case #<strong>i</strong>: " followed by the sum of the answers to all queries on that graph.
68
+ </p>
69
+
70
+
71
+ <h3>Constraints</h3>
72
+ <p>
73
+ 1 &le; <strong>T</strong> &le; 85 <br />
74
+ 3 &le; <strong>N</strong> &le; 500,000 <br />
75
+ 1 &le; <strong>M</strong> &le; 500,000 <br />
76
+ 1 &le; <strong>A<sub>i</sub></strong>, <strong>B<sub>i</sub></strong>, <strong>X<sub>i</sub></strong> &le; <strong>N</strong> <br />
77
+ 1 &le; <strong>C<sub>i</sub></strong>, <strong>Y<sub>i</sub></strong> &le; 1,000,000 <br />
78
+ 0 &le; <strong>Z<sub>i</sub></strong> &le; 1,000,000,000,000 <br />
79
+ 1 &le; <strong>O<sub>i</sub></strong> &le; 2 <br />
80
+ </p>
81
+
82
+
83
+ <h3>Explanation of Sample</h3>
84
+ <p>
85
+ In the first graph, the max flow between any two nodes is 10, so the minimax flow is also 10. If we do no edge augmentations, then the maximinimax flow is still 10.
86
+
87
+ In the second graph, the maximinimax flow is initially 3, but is then increased to 5 before the second query for a total of 8.
88
+
89
+ In the third graph, the maximinimax flow is initially 7 (between node 2 and any other node). If we augment the edge from node 3 to node 2 twice,
90
+ then the max flow between node 2 and any other node is now 9. The max flow between any other pair of nodes was already greater than 9, so the minimax flow is now 9.
91
+ We can't do any better than that, so the maximinimax flow is also 9.
92
+ </p>
93
+
2016/finals/maximinimax_flow.in ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e7a96ad5e48bc1333e92a1e16c7c72e3149dafd769c8526295fb48114c6e0e33
3
+ size 68922032
2016/finals/maximinimax_flow.md ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ You're given an undirected, connected graph with **N** nodes (numbered from 1
2
+ to **N**) and **N** edges. The **i**th edge connects distinct nodes **Ai** and
3
+ **Bi**, and has a capacity of **Ci**. No two edges directly connect the same
4
+ pair of nodes.
5
+
6
+ **M** operations will be performed on this graph, one after another. The nature of the **i**th operation is described by the value of **Oi**:
7
+
8
+ \- If **Oi** = 1, then the **i**th operation is an update, in which the
9
+ capacity of the **Xi**th edge is changed to be **Yi**.
10
+
11
+ \- Otherwise, if **Oi** = 2, then the **i**th operation is a query, in which
12
+ you must determine the maximinimax flow in the graph after **Zi** edge
13
+ augmentations.
14
+
15
+ What do any of those terms mean? Let's define them:
16
+
17
+ \- An edge augmentation is a temporary increase of a certain edge's capacity
18
+ by 1 for the current query.
19
+
20
+ \- The max flow from node **u** to a different node **v** is the usual
21
+ definition of maximum flow in computer science (hopefully you're familiar with
22
+ it!), with node **u** being the source and node **v** being the sink. Each
23
+ edge may transport flow in either direction, so it may be thought of as two
24
+ directed edges (one in each direction), both with the same capacity.
25
+
26
+ \- The minimax flow in the graph is the smallest max flow value across all
27
+ pairs of distinct nodes. In other words, min{1 ≤ **u**, **v** ≤ **N**, **u** ≠
28
+ **v**} (F(**u**, **v**)), where F(**u**, **v**) is the max flow from node
29
+ **u** to node **v**.
30
+
31
+ \- The maximinimax flow in the graph after **x** edge augmentations is the
32
+ largest possible minimax flow which the graph can have after **x** optimal
33
+ edge augmentations are applied. Note that each edge can be augmented any non-
34
+ negative number of times (as long as the total number of augmentations in the
35
+ graph is **x**), and that the chosen edge augmentations are temporary — they
36
+ do not change the graph for future operations.
37
+
38
+ To reduce the size of the output, you should simply output one integer, the
39
+ sum of the answers to all of the queries.
40
+
41
+ ### Input
42
+
43
+ Input begins with an integer **T**, the number of graphs. For each graph,
44
+ there is a first a line containing the space-separated integers **N** and
45
+ **M**. Then, **N** lines follow, the **i**th of which contains the space-
46
+ separated integers **Ai**, **Bi**, and **Ci**. Then, **M** lines follow, the
47
+ **i**th of which contains the space-separated integers **Oi**, **Xi**, and
48
+ **Yi** (if **Oi** = 1) or **Oi** and **Zi** (if **Oi** = 2).
49
+
50
+ ### Output
51
+
52
+ For the **i**th graph, print a line containing "Case #**i**: " followed by the
53
+ sum of the answers to all queries on that graph.
54
+
55
+ ### Constraints
56
+
57
+ 1 ≤ **T** ≤ 85
58
+ 3 ≤ **N** ≤ 500,000
59
+ 1 ≤ **M** ≤ 500,000
60
+ 1 ≤ **Ai**, **Bi**, **Xi** ≤ **N**
61
+ 1 ≤ **Ci**, **Yi** ≤ 1,000,000
62
+ 0 ≤ **Zi** ≤ 1,000,000,000,000
63
+ 1 ≤ **Oi** ≤ 2
64
+
65
+ ### Explanation of Sample
66
+
67
+ In the first graph, the max flow between any two nodes is 10, so the minimax
68
+ flow is also 10. If we do no edge augmentations, then the maximinimax flow is
69
+ still 10. In the second graph, the maximinimax flow is initially 3, but is
70
+ then increased to 5 before the second query for a total of 8. In the third
71
+ graph, the maximinimax flow is initially 7 (between node 2 and any other
72
+ node). If we augment the edge from node 3 to node 2 twice, then the max flow
73
+ between node 2 and any other node is now 9. The max flow between any other
74
+ pair of nodes was already greater than 9, so the minimax flow is now 9. We
75
+ can't do any better than that, so the maximinimax flow is also 9.
76
+
2016/finals/maximinimax_flow.out ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Case #1: 10
2
+ Case #2: 8
3
+ Case #3: 9
4
+ Case #4: 11
5
+ Case #5: 123
6
+ Case #6: 304383647899
7
+ Case #7: 144112755379
8
+ Case #8: 144348500415
9
+ Case #9: 301317029285
10
+ Case #10: 89000851465
11
+ Case #11: 184211069719
12
+ Case #12: 176567033514
13
+ Case #13: 153326177885
14
+ Case #14: 104125067299
15
+ Case #15: 246704568156
16
+ Case #16: 163533028903
17
+ Case #17: 175697219713
18
+ Case #18: 114075799814
19
+ Case #19: 3009664900678
20
+ Case #20: 123353189950
21
+ Case #21: 45047940360
22
+ Case #22: 142130723516
23
+ Case #23: 57958395290
24
+ Case #24: 3762906937963
25
+ Case #25: 99917051550
26
+ Case #26: 887652200701
27
+ Case #27: 199408849379
28
+ Case #28: 104532232592
29
+ Case #29: 281496624236
30
+ Case #30: 139464844782
31
+ Case #31: 173120052623
32
+ Case #32: 158041982161
33
+ Case #33: 475569676769
34
+ Case #34: 381550956008
35
+ Case #35: 4770638614
36
+ Case #36: 1240432768678
37
+ Case #37: 329171997615
38
+ Case #38: 2462187018107
39
+ Case #39: 245022020493
40
+ Case #40: 478905356695
41
+ Case #41: 351947046120
42
+ Case #42: 276673766339
43
+ Case #43: 109500766093
44
+ Case #44: 330374064692
45
+ Case #45: 337624423704
46
+ Case #46: 86946443291
47
+ Case #47: 1200181393491
48
+ Case #48: 184194396421
49
+ Case #49: 43690762833
50
+ Case #50: 127163551554
51
+ Case #51: 111218335988
52
+ Case #52: 122580945994
53
+ Case #53: 586334704876
54
+ Case #54: 293149094452
55
+ Case #55: 22761536987
56
+ Case #56: 78073808557
57
+ Case #57: 111237890055
58
+ Case #58: 288178586400
59
+ Case #59: 75200460726
60
+ Case #60: 271371672830
61
+ Case #61: 46692093752
62
+ Case #62: 44097908017
63
+ Case #63: 383069096330
64
+ Case #64: 380975476663
65
+ Case #65: 396083749712
66
+ Case #66: 368623446537
67
+ Case #67: 152404797320
68
+ Case #68: 1746064129
69
+ Case #69: 134261898464
70
+ Case #70: 184122274881
71
+ Case #71: 708871243263
72
+ Case #72: 134687150646
73
+ Case #73: 1869622095930
74
+ Case #74: 92316044411
75
+ Case #75: 407277939444
76
+ Case #76: 694274474852
77
+ Case #77: 23876452440
78
+ Case #78: 6962558256345
79
+ Case #79: 107715896989
80
+ Case #80: 1248316489406
81
+ Case #81: 225590525246
82
+ Case #82: 77022047743
83
+ Case #83: 392171117277
84
+ Case #84: 213573472156
85
+ Case #85: 1997303127
2016/finals/rainbow_string.cpp ADDED
@@ -0,0 +1,218 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // RAINBOW STRING
2
+ // Official Solution by Jacob Plachta
3
+
4
+ #define DEBUG 0
5
+
6
+ #include <algorithm>
7
+ #include <functional>
8
+ #include <numeric>
9
+ #include <iostream>
10
+ #include <iomanip>
11
+ #include <cstdio>
12
+ #include <cmath>
13
+ #include <complex>
14
+ #include <cstdlib>
15
+ #include <ctime>
16
+ #include <cstring>
17
+ #include <cassert>
18
+ #include <string>
19
+ #include <vector>
20
+ #include <list>
21
+ #include <map>
22
+ #include <set>
23
+ #include <deque>
24
+ #include <queue>
25
+ #include <stack>
26
+ #include <bitset>
27
+ #include <sstream>
28
+ using namespace std;
29
+
30
+ #define LL long long
31
+ #define LD long double
32
+ #define PR pair<int,int>
33
+
34
+ #define Fox(i,n) for (i=0; i<n; i++)
35
+ #define Fox1(i,n) for (i=1; i<=n; i++)
36
+ #define FoxI(i,a,b) for (i=a; i<=b; i++)
37
+ #define FoxR(i,n) for (i=(n)-1; i>=0; i--)
38
+ #define FoxR1(i,n) for (i=n; i>0; i--)
39
+ #define FoxRI(i,a,b) for (i=b; i>=a; i--)
40
+ #define Foxen(i,s) for (i=s.begin(); i!=s.end(); i++)
41
+ #define Min(a,b) a=min(a,b)
42
+ #define Max(a,b) a=max(a,b)
43
+ #define Sz(s) int((s).size())
44
+ #define All(s) (s).begin(),(s).end()
45
+ #define Fill(s,v) memset(s,v,sizeof(s))
46
+ #define pb push_back
47
+ #define mp make_pair
48
+ #define x first
49
+ #define y second
50
+
51
+ template<typename T> T Abs(T x) { return(x<0 ? -x : x); }
52
+ template<typename T> T Sqr(T x) { return(x*x); }
53
+ string plural(string s) { return(Sz(s) && s[Sz(s)-1]=='x' ? s+"en" : s+"s"); }
54
+
55
+ const int INF = (int)1e9;
56
+ const LD EPS = 1e-9;
57
+ const LD PI = acos(-1.0);
58
+
59
+ //#if DEBUG
60
+ #define GETCHAR getchar
61
+ /*#else
62
+ #define GETCHAR getchar_unlocked
63
+ #endif*/
64
+
65
+ bool Read(int &x)
66
+ {
67
+ char c,r=0,n=0;
68
+ x=0;
69
+ for(;;)
70
+ {
71
+ c=GETCHAR();
72
+ if ((c<0) && (!r))
73
+ return(0);
74
+ if ((c=='-') && (!r))
75
+ n=1;
76
+ else
77
+ if ((c>='0') && (c<='9'))
78
+ x=x*10+c-'0',r=1;
79
+ else
80
+ if (r)
81
+ break;
82
+ }
83
+ if (n)
84
+ x=-x;
85
+ return(1);
86
+ }
87
+
88
+ #define LIM 400005
89
+
90
+ int N,SZ;
91
+ char S[LIM],C[LIM];
92
+ int sum[LIM][26];
93
+ int sz,P[20][LIM];
94
+ pair<PR,int> V[LIM];
95
+ int O[LIM],ind[LIM];
96
+ vector<int> Q[LIM],A[LIM],B[LIM];
97
+ int BLT[(1<<18)+1];
98
+
99
+ void BuildSuffixArray()
100
+ {
101
+ int i,s;
102
+ if (N==1)
103
+ {
104
+ sz=1;
105
+ P[0][0]=0;
106
+ return;
107
+ }
108
+ Fox(i,N)
109
+ P[0][i]=S[i];
110
+ for (sz=s=1; s<N; sz++,s<<=1)
111
+ {
112
+ Fox(i,N)
113
+ V[i]=mp(mp(P[sz-1][i],(i+s<N ? P[sz-1][i+s] : -1)),i);
114
+ sort(V,V+N);
115
+ Fox(i,N)
116
+ if ((i) && (V[i].x==V[i-1].x))
117
+ P[sz][V[i].y]=P[sz][V[i-1].y];
118
+ else
119
+ P[sz][V[i].y]=i;
120
+ }
121
+ }
122
+
123
+ void Update(int i, int v)
124
+ {
125
+ while (i<=SZ)
126
+ {
127
+ BLT[i]+=v;
128
+ i+=(i&-i);
129
+ }
130
+ }
131
+
132
+ int Query(int k)
133
+ {
134
+ int i=0,b=SZ,t;
135
+ while ((b) && (i<SZ))
136
+ {
137
+ t=i+b;
138
+ if (k>=BLT[t])
139
+ {
140
+ i=t;
141
+ k-=BLT[t];
142
+ }
143
+ b>>=1;
144
+ }
145
+ return(i);
146
+ }
147
+
148
+ int main()
149
+ {
150
+ if (DEBUG)
151
+ freopen("in.txt","r",stdin);
152
+ int T,t;
153
+ int M;
154
+ int i,j,k,c,s;
155
+ LL ans[26];
156
+ Read(T);
157
+ Fox1(t,T)
158
+ {
159
+ Read(N),Read(M);
160
+ scanf("%s%s",&S,&C);
161
+ Fox(i,M)
162
+ {
163
+ Read(j),Read(k);
164
+ Q[j].pb(k);
165
+ }
166
+ Fill(sum,0);
167
+ Fox1(i,N)
168
+ Fox(j,26)
169
+ sum[i][j]=sum[i-1][j]+bool(S[i-1]=='A'+j);
170
+ BuildSuffixArray();
171
+ Fox(i,N)
172
+ {
173
+ O[i]=P[sz-1][i];
174
+ ind[O[i]]=i;
175
+ }
176
+ j=k=1;
177
+ FoxR(i,N)
178
+ {
179
+ j++,k++;
180
+ if (C[i]=='G')
181
+ j=1;
182
+ if (C[i]=='R')
183
+ k=1;
184
+ if (j<k)
185
+ {
186
+ A[j].pb(O[i]);
187
+ B[k].pb(O[i]);
188
+ }
189
+ }
190
+ Fill(BLT,0),s=0;
191
+ for (SZ=1; SZ<N; SZ<<=1);
192
+ Fill(ans,0);
193
+ Fox1(i,N)
194
+ {
195
+ Fox(j,Sz(A[i]))
196
+ Update(A[i][j]+1,1),s++;
197
+ Fox(j,Sz(B[i]))
198
+ Update(B[i][j]+1,-1),s--;
199
+ Fox(j,Sz(Q[i]))
200
+ {
201
+ k=ind[Query(Q[i][j]-1)];
202
+ Fox(c,26)
203
+ ans[c]+=sum[k+i][c]-sum[k][c];
204
+ }
205
+ }
206
+ printf("Case #%d:",t);
207
+ Fox(i,26)
208
+ printf(" %lld",ans[i]);
209
+ printf("\n");
210
+ Fox1(i,N+1)
211
+ {
212
+ A[i].clear();
213
+ B[i].clear();
214
+ Q[i].clear();
215
+ }
216
+ }
217
+ return(0);
218
+ }
2016/finals/rainbow_string.html ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <p>
2
+ You have a string <strong>S</strong> consisting of <strong>N</strong> uppercase letters. This is no ordinary string, however &mdash; it's a rainbow string!
3
+ Every letter has a colour, one of red, green, or blue (it might be ambitious to call this a rainbow, but close enough).
4
+ The colour of the <strong>i</strong>th letter in <strong>S</strong> is indicated by the <strong>i</strong>th letter in a secondary string <strong>C</strong>
5
+ (which also consists of <strong>N</strong> uppercase letters), with the three possible values "R", "G", and "B" representing the colors red, green, and blue respectively.
6
+ </p>
7
+
8
+ <p>
9
+ You'd like to answer <strong>Q</strong> questions about your rainbow string. The <strong>i</strong>th question asks:
10
+ </p>
11
+
12
+ <p>
13
+ "What's the {<strong>K<sub>i</sub></strong>}th lexicographically smallest substring of <strong>S</strong> which has length <strong>L<sub>i</sub></strong>,
14
+ includes at least one green letter, and includes no red letters?"
15
+ </p>
16
+
17
+ <p>
18
+ Note that, when considering the list of valid substrings of which to determine the {<strong>K<sub>i</sub></strong>}th lexicographically smallest one,
19
+ substrings which are equal to one another but occur at different positions in <strong>S</strong> are distinct!
20
+ Additionally, <strong>K<sub>i</sub></strong> is guaranteed to be no larger than the number of such valid substrings.
21
+ </p>
22
+
23
+ <p>
24
+ For example, consider <strong>S</strong> = "ABABAB", <strong>C</strong> = "GGBGRG", and <strong>L<sub>i</sub></strong> = 2.
25
+ The lexicographically-sorted list of valid substrings of <strong>S</strong> (those which have length 2, include at least one green letter, and include no red letters) is as follows:
26
+ </p>
27
+
28
+ <ol>
29
+ <li> AB (starting at index 1) </li>
30
+ <li> AB (starting at index 3) </li>
31
+ <li> BA (starting at index 2) </li>
32
+ </ol>
33
+
34
+ <p>
35
+ Therefore, if <strong>K<sub>i</sub></strong> = 2, the answer would be "AB". <strong>K<sub>i</sub></strong> can be no larger than 3 in this example.
36
+ </p>
37
+
38
+ <p>
39
+ To reduce the size of the output, you should simply output 26 integers, with the <strong>i</strong>th of them being the total number of times that the
40
+ <strong>i</strong>th letter of the alphabet appears throughout the answers to the <strong>Q</strong> questions.
41
+ </p>
42
+
43
+
44
+ <h3>Input</h3>
45
+ <p>
46
+ Input begins with an integer <strong>T</strong>, the number of rainbow strings you own.
47
+ For each rainbow string, there is first a line containing the space-separated integers <strong>N</strong> and <strong>Q</strong>.
48
+ The second line contains the length-<strong>N</strong> string <strong>S</strong> denoting the alphabetic characters in the rainbow string.
49
+ The third line contains the length-<strong>N</strong> string <strong>C</strong> denoting the colours of each letter of the rainbow string, as described above.
50
+ Then, <strong>Q</strong> more lines follow, the <strong>i</strong>th of which contains the space-separated integers
51
+ <strong>L<sub>i</sub></strong> and <strong>K<sub>i</sub></strong>.
52
+ </p>
53
+
54
+
55
+ <h3>Output</h3>
56
+ <p>
57
+ For the <strong>i</strong>th rainbow string, print a line containing "Case #<strong>i</strong>: " followed by
58
+ 26 space-separated integers denoting the frequency of each letter amongst the answers to all of the questions, as described above.
59
+ </p>
60
+
61
+
62
+ <h3>Constraints</h3>
63
+ <p>
64
+ 1 &le; <strong>T</strong> &le; 55 <br />
65
+ 1 &le; <strong>N</strong> &le; 200,000 <br />
66
+ 1 &le; <strong>Q</strong> &le; 400,000 <br />
67
+ 1 &le; <strong>L<sub>i</sub></strong>, <strong>K<sub>i</sub></strong> &le; <strong>N</strong> <br />
68
+ </p>
69
+
70
+
71
+ <h3>Explanation of Sample</h3>
72
+ <p>
73
+ For the first string, the answers to the three questions are "AB", "AB", and "BA" respectively. "A" and "B" each show up 3 times in these answers.
74
+ </p>
2016/finals/rainbow_string.in ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5caaaca7f67c1ec5f9fdb62438a6b58e0957da6c9b9bcfe9a89320d5f41b221b
3
+ size 36148046
2016/finals/rainbow_string.md ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // RAINBOW STRING // Official Solution by Jacob Plachta #define DEBUG 0
2
+ #include #include #include #include #include #include #include #include
3
+ #include #include #include #include #include #include #include #include
4
+ #include #include #include #include #include #include using namespace
5
+ std; #define LL long long #define LD long double #define PR pair #define
6
+ Fox(i,n) for (i=0; i=0; i--) #define FoxR1(i,n) for (i=n; i>0; i--) #define
7
+ FoxRI(i,a,b) for (i=b; i>=a; i--) #define Foxen(i,s) for (i=s.begin();
8
+ i!=s.end(); i++) #define Min(a,b) a=min(a,b) #define Max(a,b) a=max(a,b)
9
+ #define Sz(s) int((s).size()) #define All(s) (s).begin(),(s).end() #define
10
+ Fill(s,v) memset(s,v,sizeof(s)) #define pb push_back #define mp make_pair
11
+ #define x first #define y second template T Abs(T x) { return(x<0 ? -x : x); }
12
+ template T Sqr(T x) { return(x*x); } string plural(string s) { return(Sz(s) &&
13
+ s[Sz(s)-1]=='x' ? s+"en" : s+"s"); } const int INF = (int)1e9; const LD EPS =
14
+ 1e-9; const LD PI = acos(-1.0); //#if DEBUG #define GETCHAR getchar /*#else
15
+ #define GETCHAR getchar_unlocked #endif*/ bool Read(int &x) { char c,r=0,n=0;
16
+ x=0; for(;;) { c=GETCHAR(); if ((c<0) && (!r)) return(0); if ((c=='-') &&
17
+ (!r)) n=1; else if ((c>='0') && (c<='9')) x=x*10+c-'0',r=1; else if (r) break;
18
+ } if (n) x=-x; return(1); } #define LIM 400005 int N,SZ; char S[LIM],C[LIM];
19
+ int sum[LIM][26]; int sz,P[20][LIM]; pair V[LIM]; int O[LIM],ind[LIM]; vector
20
+ Q[LIM],A[LIM],B[LIM]; int BLT[(1<<18)+1]; void BuildSuffixArray() { int i,s;
21
+ if (N==1) { sz=1; P[0][0]=0; return; } Fox(i,N) P[0][i]=S[i]; for (sz=s=1;
22
+ s=BLT[t]) { i=t; k-=BLT[t]; } b>>=1; } return(i); } int main() { if (DEBUG)
23
+ freopen("in.txt","r",stdin); int T,t; int M; int i,j,k,c,s; LL ans[26];
24
+ Read(T); Fox1(t,T) { Read(N),Read(M); scanf("%s%s",&S,&C); Fox(i,M) {
25
+ Read(j),Read(k); Q[j].pb(k); } Fill(sum,0); Fox1(i,N) Fox(j,26)
26
+ sum[i][j]=sum[i-1][j]+bool(S[i-1]=='A'+j); BuildSuffixArray(); Fox(i,N) {
27
+ O[i]=P[sz-1][i]; ind[O[i]]=i; } j=k=1; FoxR(i,N) { j++,k++; if (C[i]=='G')
28
+ j=1; if (C[i]=='R') k=1; if (j<k) { A[j].pb(O[i]); B[k].pb(O[i]); } }
29
+ Fill(BLT,0),s=0; for (SZ=1; SZ<N; SZ<<=1); Fill(ans,0); Fox1(i,N) {
30
+ Fox(j,Sz(A[i])) Update(A[i][j]+1,1),s++; Fox(j,Sz(B[i]))
31
+ Update(B[i][j]+1,-1),s--; Fox(j,Sz(Q[i])) { k=ind[Query(Q[i][j]-1)]; Fox(c,26)
32
+ ans[c]+=sum[k+i][c]-sum[k][c]; } } printf("Case #%d:",t); Fox(i,26) printf("
33
+ %lld",ans[i]); printf("\n"); Fox1(i,N+1) { A[i].clear(); B[i].clear();
34
+ Q[i].clear(); } } return(0); }
35
+
2016/finals/rainbow_string.out ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Case #1: 3 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2
+ Case #2: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 2 1
3
+ Case #3: 4 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4
+ Case #4: 0 4 5 4 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
5
+ Case #5: 2 0 0 0 5 1 0 4 2 0 0 6 0 1 1 4 0 3 2 0 3 0 0 2 0 0
6
+ Case #6: 1800394884 1802832417 1793020429 1784518799 1799345123 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
7
+ Case #7: 888902752 904468691 893529395 897751512 893232315 892695959 899417851 902076108 911072872 906154553 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
8
+ Case #8: 602883957 595900410 597504983 598097887 602331755 595937381 599850972 605321561 597756061 603017268 604877105 599816420 594866205 593841972 604487422 0 0 0 0 0 0 0 0 0 0 0
9
+ Case #9: 449262396 455339905 446579889 442836921 446732134 456140364 451984406 449279394 448055252 445082037 442681599 446560226 443495791 444335601 453758567 442816726 448875204 461388263 453568368 450892519 0 0 0 0 0 0
10
+ Case #10: 362734717 356797029 362420129 355379039 362647914 360021084 367533338 358855506 362010484 363035142 365997177 359315548 352137515 361105089 355689142 354807813 362607239 360693340 365062532 357276206 362251472 364673006 355908859 356801139 354970727 0
11
+ Case #11: 4994059477 5018965861 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
12
+ Case #12: 340918 346742 327409 347201 349189 371201 324714 346187 383274 330513 337701 351541 317340 327355 382018 330691 303110 345390 351286 321965 340190 0 0 0 0 0
13
+ Case #13: 3165702 3018300 3071273 3024704 2837898 2996624 2983146 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
14
+ Case #14: 1021377 1094437 1063507 1022044 1044195 1010305 1003797 1047336 1092901 931660 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
15
+ Case #15: 80559 76872 78059 83750 84743 83115 83710 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
16
+ Case #16: 3892253 4084620 3985726 4156919 4051722 4110669 3916991 3914046 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
17
+ Case #17: 11457335 11470429 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
18
+ Case #18: 1744370 1835076 1889543 1654299 1732109 1853297 1705906 1880374 1737749 1857258 1783627 1792871 1851246 1725367 1917607 1949037 1827872 1845265 0 0 0 0 0 0 0 0
19
+ Case #19: 1660300 1555949 1761755 1671815 1667682 1803687 1715507 1863850 1656573 1711085 1836236 1812852 1567040 1688755 1745852 1782963 1689055 1636122 1662503 0 0 0 0 0 0 0
20
+ Case #20: 1416752 1563079 1361014 1488966 1557828 1482193 1505994 1377289 1554380 1545956 1495017 1513785 1448778 1533916 1344579 1376241 1512701 1359978 1421097 1453364 1461118 1464286 0 0 0 0
21
+ Case #21: 1721600 1755180 1758091 1780830 1772424 1734019 1687412 1893007 1673223 1830295 1875594 1790124 2011786 1788215 1733149 1794390 1851658 1740544 0 0 0 0 0 0 0 0
22
+ Case #22: 902953 883772 834340 919344 838520 825525 934517 955559 838646 836655 861197 920718 873047 892824 873501 892668 900554 879579 882754 915565 917578 960119 800962 992517 0 0
23
+ Case #23: 718918 713488 686170 823855 767795 761531 702003 759530 727655 723510 756104 772890 706065 758097 735543 820794 770150 750435 0 0 0 0 0 0 0 0
24
+ Case #24: 2215269 2471703 2378905 2353105 2489347 2443961 2414550 2186423 2371485 2313976 2269641 2275919 2272650 2312655 0 0 0 0 0 0 0 0 0 0 0 0
25
+ Case #25: 6371177 6641571 6350310 6339817 6786852 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
26
+ Case #26: 2194988 2075734 2197102 2243057 2114239 2072055 2014120 2029121 2269837 2235066 2101081 2165929 2055496 2175630 2112358 0 0 0 0 0 0 0 0 0 0 0
27
+ Case #27: 6417032 6585008 6474142 6472371 6650061 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
28
+ Case #28: 16205772 15879475 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
29
+ Case #29: 1403571 1440546 1463710 1541267 1564377 1556046 1402326 1492235 1426631 1545493 1481115 1548259 1619761 1723274 1531017 1464049 1453847 1505313 1444306 1540127 1528213 0 0 0 0 0
30
+ Case #30: 1018251 995707 1001928 990033 1060084 977805 964569 1136894 1085280 983327 1036444 1007464 1020928 1036236 983428 1080608 975617 975175 1027868 1011267 993687 985898 981523 0 0 0
31
+ Case #31: 3095827 3319516 3398029 3130195 3167281 3384567 3426835 3215121 3308415 3276371 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
32
+ Case #32: 1102642 1060722 1114314 1141183 1108949 1053204 1195753 1181686 1050041 1099552 1113264 1092740 0 0 0 0 0 0 0 0 0 0 0 0 0 0
33
+ Case #33: 1045182 1174407 1091798 1110385 1086051 1073362 1178253 1092122 935355 1220734 1087117 1133763 1048717 1054121 1051068 1098818 1171386 1125355 1020074 1011672 1008490 1019115 1108632 0 0 0
34
+ Case #34: 2641707 2770013 2770250 2758080 2609751 2528161 2642965 2630155 2731932 2794067 2781625 2661673 0 0 0 0 0 0 0 0 0 0 0 0 0 0
35
+ Case #35: 4588367 4660473 4628410 4497854 4820193 4699431 4806861 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
36
+ Case #36: 6131573 6386142 6258355 6548662 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
37
+ Case #37: 1470728 1419459 1473656 1359793 1298638 1397055 1441325 1440864 1441047 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
38
+ Case #38: 1350517 1244014 1419151 1383773 1361799 1363102 1341243 1420809 1287215 1448116 1418098 1406936 1262016 1290928 1396966 1314475 1294742 1360182 1322001 1575357 1449756 1421414 0 0 0 0
39
+ Case #39: 6371638 6586117 6374292 6188606 6327646 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
40
+ Case #40: 839371 773666 879634 852858 810000 796615 832491 805001 766538 754625 748845 841410 817509 767550 848030 834304 784120 827899 828641 0 0 0 0 0 0 0
41
+ Case #41: 1937709 1706655 1731369 1708423 1811238 1789324 1858943 1736742 1706988 1713956 1849580 1723817 1726125 1883462 1876555 1766985 1724746 1968559 0 0 0 0 0 0 0 0
42
+ Case #42: 1186423 1499211 1226978 1332973 1268981 1269136 1319006 1443145 1262711 1218344 1301444 1360281 1427378 1319571 1384304 1245295 1331480 1378204 1201858 1265527 1254850 1284896 1137665 1371970 1318752 0
43
+ Case #43: 1455669 1460121 1536469 1555505 1452509 1610743 1530440 1510239 1487419 1452089 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
44
+ Case #44: 1915089 2077209 1831142 1988933 1875495 2004089 1881367 1841896 1911355 1822107 1868607 1774889 1886392 1920671 1927951 1960229 1832563 0 0 0 0 0 0 0 0 0
45
+ Case #45: 1754299 1545936 1760071 1636572 1650452 1736246 1693962 1649654 1727603 1806261 1671665 1936749 1657881 1674012 1694745 1769100 1724258 1714180 1654849 0 0 0 0 0 0 0
46
+ Case #46: 2227943 2257851 2226437 2166293 2298582 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
47
+ Case #47: 4324533 3951619 4249470 4059465 3861448 4015256 3956060 4026672 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
48
+ Case #48: 1933351 1984411 2021930 1910990 1970700 2149896 2064937 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
49
+ Case #49: 1656841 1585957 1664807 1630351 1664246 1741778 1522185 1658950 1817000 1685327 1653558 1489916 1635841 0 0 0 0 0 0 0 0 0 0 0 0 0
50
+ Case #50: 2842441 2749044 2946989 2920450 3043601 2784560 2872556 2973457 2927459 2952760 2912106 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
51
+ Case #51: 1788465 1586372 1583688 1727602 1621990 1587440 1603734 1650433 1605602 1746090 1655639 1752279 1600150 1507796 1618167 1646875 1603254 1622324 1664828 1553974 0 0 0 0 0 0
52
+ Case #52: 1249435 1253284 1177024 1246457 1180139 1083894 1199215 1241537 1183436 1268842 1230735 1310861 1411007 1212438 1195959 1292895 1264430 1210162 1190286 1262560 1107222 1161271 1287835 1276168 1266413 1212577
53
+ Case #53: 2107921 1987795 2093254 2132277 2015773 2095931 2058465 2007524 2028631 2124490 2117591 2080745 2090379 2073763 0 0 0 0 0 0 0 0 0 0 0 0
54
+ Case #54: 1175161 1099686 1187860 1090923 1166077 1182912 1213924 1165028 1220507 1177167 1131438 1141264 1234346 1247758 1267561 1246257 1163188 1153208 1195300 1318261 1211384 1170148 0 0 0 0
55
+ Case #55: 2390180 2353002 2639807 2442670 2494834 2601010 2512919 2582302 2455633 2343861 2544627 2262470 2397541 0 0 0 0 0 0 0 0 0 0 0 0 0
2016/finals/rng.cpp ADDED
@@ -0,0 +1,200 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // RNG
2
+ // Official Solution by Jacob Plachta
3
+
4
+ #define DEBUG 0
5
+
6
+ #include <algorithm>
7
+ #include <functional>
8
+ #include <numeric>
9
+ #include <iostream>
10
+ #include <iomanip>
11
+ #include <cstdio>
12
+ #include <cmath>
13
+ #include <complex>
14
+ #include <cstdlib>
15
+ #include <ctime>
16
+ #include <cstring>
17
+ #include <cassert>
18
+ #include <string>
19
+ #include <vector>
20
+ #include <list>
21
+ #include <map>
22
+ #include <set>
23
+ #include <deque>
24
+ #include <queue>
25
+ #include <stack>
26
+ #include <bitset>
27
+ #include <sstream>
28
+ using namespace std;
29
+
30
+ #define LL long long
31
+ #define LD long double
32
+ #define PR pair<int,int>
33
+
34
+ #define Fox(i,n) for (i=0; i<n; i++)
35
+ #define Fox1(i,n) for (i=1; i<=n; i++)
36
+ #define FoxI(i,a,b) for (i=a; i<=b; i++)
37
+ #define FoxR(i,n) for (i=(n)-1; i>=0; i--)
38
+ #define FoxR1(i,n) for (i=n; i>0; i--)
39
+ #define FoxRI(i,a,b) for (i=b; i>=a; i--)
40
+ #define Foxen(i,s) for (i=s.begin(); i!=s.end(); i++)
41
+ #define Min(a,b) a=min(a,b)
42
+ #define Max(a,b) a=max(a,b)
43
+ #define Sz(s) int((s).size())
44
+ #define All(s) (s).begin(),(s).end()
45
+ #define Fill(s,v) memset(s,v,sizeof(s))
46
+ #define pb push_back
47
+ #define mp make_pair
48
+ #define x first
49
+ #define y second
50
+
51
+ template<typename T> T Abs(T x) { return(x<0 ? -x : x); }
52
+ template<typename T> T Sqr(T x) { return(x*x); }
53
+ string plural(string s) { return(Sz(s) && s[Sz(s)-1]=='x' ? s+"en" : s+"s"); }
54
+
55
+ const int INF = (int)1e9;
56
+ const LD EPS = 1e-9;
57
+ const LD PI = acos(-1.0);
58
+
59
+ //#if DEBUG
60
+ #define GETCHAR getchar
61
+ /*#else
62
+ #define GETCHAR getchar_unlocked
63
+ #endif*/
64
+
65
+ bool Read(int &x)
66
+ {
67
+ char c,r=0,n=0;
68
+ x=0;
69
+ for(;;)
70
+ {
71
+ c=GETCHAR();
72
+ if ((c<0) && (!r))
73
+ return(0);
74
+ if ((c=='-') && (!r))
75
+ n=1;
76
+ else
77
+ if ((c>='0') && (c<='9'))
78
+ x=x*10+c-'0',r=1;
79
+ else
80
+ if (r)
81
+ break;
82
+ }
83
+ if (n)
84
+ x=-x;
85
+ return(1);
86
+ }
87
+
88
+ int main()
89
+ {
90
+ if (DEBUG)
91
+ freopen("in.txt","r",stdin);
92
+ int TT,tt;
93
+ int N,M,K,T,R;
94
+ LD P;
95
+ int i,j,k,b;
96
+ LD d,v;
97
+ int S[20];
98
+ static int up[100000],down[100000],dist[100000],dir[20][20];
99
+ static vector<int> con[100000];
100
+ static LD exRN[100001],exNR[100001],exP[100001],exT[100001];
101
+ static LD dyn[1<<20][21];
102
+ queue<int> Q;
103
+ Read(TT);
104
+ Fox1(tt,TT)
105
+ {
106
+ //input
107
+ Read(N),Read(M),Read(K),Read(T),Read(R);
108
+ Fox(i,N)
109
+ con[i].clear();
110
+ cin >> P;
111
+ Fox(i,K)
112
+ Read(S[i]),S[i]--;
113
+ while (M--)
114
+ {
115
+ Read(i),Read(j);
116
+ con[i-1].pb(j-1);
117
+ }
118
+ Fox(i,K)
119
+ dyn[(1<<K)-1][i]=0;
120
+ //dist from start to each item
121
+ Fill(up,-1);
122
+ Q.push(0),up[0]=0;
123
+ while (!Q.empty())
124
+ {
125
+ i=Q.front(),Q.pop();
126
+ Fox(j,Sz(con[i]))
127
+ if (up[k=con[i][j]]<0)
128
+ Q.push(k),up[k]=up[i]+1;
129
+ }
130
+ //dist from each item to other items and to nearest leaf
131
+ Fill(down,-1);
132
+ Fox(b,K)
133
+ {
134
+ Fill(dist,-1);
135
+ Q.push(S[b]),dist[S[b]]=0;
136
+ while (!Q.empty())
137
+ {
138
+ i=Q.front(),Q.pop();
139
+ if ((!Sz(con[i])) && (down[b]<0))
140
+ down[b]=dist[i];
141
+ Fox(j,Sz(con[i]))
142
+ if (dist[k=con[i][j]]<0)
143
+ Q.push(k),dist[k]=dist[i]+1;
144
+ }
145
+ Fox(i,K)
146
+ dir[b][i]=dist[S[i]];
147
+ }
148
+ //expected times for root -> node
149
+ exRN[0]=0;
150
+ Fox1(i,N)
151
+ {
152
+ v=(P*T + (1-P)*(R+exRN[i-1])) / P;
153
+ exRN[i]=exRN[i-1]+v;
154
+ }
155
+ //expected times for node -> root
156
+ exNR[0]=R;
157
+ Fox1(i,N)
158
+ exNR[i]=P*(T + exNR[i-1]) + (1-P)*R;
159
+ //conditional expected times for node -> node
160
+ exP[0]=1;
161
+ exT[0]=0;
162
+ Fox1(i,N)
163
+ {
164
+ exP[i]=exP[i-1]*P;
165
+ exT[i]=exT[i-1] + exP[i-1]*(1-P)*((i-1)*T + R);
166
+ }
167
+ //bitmask DP
168
+ FoxR(b,(1<<K)-1)
169
+ {
170
+ d=-1;
171
+ Fox(i,K)
172
+ if (!(b&(1<<i)))
173
+ {
174
+ v=dyn[b][i]=dyn[b|(1<<i)][i];
175
+ v+=exRN[up[S[i]]];
176
+ if ((d<0) || (d>v))
177
+ d=v;
178
+ }
179
+ dyn[b][K]=d;
180
+ Fox(i,K)
181
+ if (b&(1<<i))
182
+ {
183
+ d=exNR[down[i]]+dyn[b][K];
184
+ Fox(j,K)
185
+ if (!(b&(1<<j)))
186
+ if (dir[i][j]>=0)
187
+ {
188
+ k=dir[i][j];
189
+ v=exP[k]*(k*T + dyn[b][j]) + exT[k] + (1-exP[k])*dyn[b][K];
190
+ Min(d,v);
191
+ }
192
+ dyn[b][i]=d;
193
+ }
194
+ }
195
+ //output
196
+ printf("Case #%d: ",tt);
197
+ cout << fixed << setprecision(9) << dyn[0][K] << endl;
198
+ }
199
+ return(0);
200
+ }
2016/finals/rng.html ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <p>
2
+ You're playing a video game that features <strong>N</strong> different areas, numbered from 1 to <strong>N</strong>.
3
+ There are <strong>M</strong> one-way paths that each connect two areas. The <strong>i</strong>th path runs from area
4
+ <strong>A<sub>i</sub></strong> to a different area <strong>B<sub>i</sub></strong>. No pair of paths directly connect the same pair of areas,
5
+ and for every area it's impossible to start at that area and follow a non-empty sequence of paths to return to that area. In other words, the game's layout is a directed acyclic graph.
6
+ </p>
7
+
8
+ <p>
9
+ You start in area 1. <strong>K</strong> other distinct areas each contain an item to collect &mdash; the <strong>i</strong>th of these is area <strong>I<sub>i</sub></strong>.
10
+ As soon as you've visited these <strong>K</strong> areas at least once each, you win! You'd like to do so as fast as possible.
11
+ </p>
12
+
13
+ <p>
14
+ At any point in time, if there are no outgoing paths leading away from your current area, you automatically respawn in area 1 after a delay of <strong>R</strong> seconds.
15
+ Otherwise, you get to choose one such path and attempt to follow it. Unfortunately, this game relies entirely on Random Number Generation to determine whether or not you'll be successful,
16
+ regardless of your skill. In particular, with probability <strong>P</strong>, you'll successfully travel along your chosen path for <strong>D</strong> seconds, ending up in a new area.
17
+ On the other hand, with probability 1 - <strong>P</strong>, you'll instead perish and respawn in area 1 after a delay of <strong>R</strong> seconds.
18
+ </p>
19
+
20
+ <p>
21
+ What's the minimum expected time for you to collect all <strong>K</strong> items, given that you play optimally? This is guaranteed to be possible &mdash;
22
+ that is, all <strong>K</strong> areas that contain items are reachable from area 1. Your output should have at most 10<sup>-6</sup> absolute or relative error.
23
+ </p>
24
+
25
+ <h3>Input</h3>
26
+ <p>
27
+ Input begins with an integer <strong>T</strong>, the number of times you play the game.
28
+ For each time, there is first a line containing the space-separated integers <strong>N</strong>, <strong>M</strong>, and <strong>K</strong>.
29
+ The second line contains the space-separated integers <strong>D</strong> and <strong>R</strong>.
30
+ The third line contains the real value <strong>P</strong> which is given with at most 4 decimal places.
31
+ The fourth line contains the <strong>K</strong> space-separated integers <strong>I<sub>1</sub></strong> to <strong>I<sub>K</sub></strong>.
32
+ Then, <strong>M</strong> lines follow, the <strong>i</strong>th of which contains the space-separated integers
33
+ <strong>A<sub>i</sub></strong> and <strong>B<sub>i</sub></strong>.
34
+ </p>
35
+
36
+
37
+ <h3>Output</h3>
38
+ <p>
39
+ For the <strong>i</strong>th time you play the game, print a line containing "Case #<strong>i</strong>: " followed by the expected time it will take you to collect all of the items
40
+ if you play optimally.
41
+ </p>
42
+
43
+
44
+ <h3>Constraints</h3>
45
+ <p>
46
+ 1 &le; <strong>T</strong> &le; 50 <br />
47
+ 2 &le; <strong>N</strong> &le; 100,000 <br />
48
+ 1 &le; <strong>M</strong> &le; 100,000 <br />
49
+ 1 &le; <strong>K</strong> &le; min(20, <strong>N</strong> - 1) <br />
50
+ 0.5 &le; <strong>P</strong> &le; 1.0 <br />
51
+ 1 &le; <strong>D</strong>, <strong>R</strong> &le; 1,000 <br />
52
+ 1 &le; <strong>A<sub>i</sub></strong>, <strong>B<sub>i</sub></strong> &le; <strong>N</strong> <br />
53
+ 2 &le; <strong>I<sub>i</sub></strong> &le; <strong>N</strong> <br />
54
+ </p>
55
+
56
+ <p>
57
+ The answer for each game is guaranteed to be less than 10<sup>30</sup>.
58
+ </p>
59
+
60
+ <h3>Explanation of Sample</h3>
61
+ <p>
62
+ In the first game, it takes you 10 seconds to reach the only item, and then you win. There's no chance of failure.
63
+
64
+ The second game is the same as the first, but now you fail to reach the item with probability 0.5. On average you will fail once before reaching the item, so you'll incur an average penalty of 3 seconds on top of the 10 seconds it takes you to succeed, for a total of 13 seconds.
65
+ </p>
66
+
2016/finals/rng.in ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d64df27b7be563e8a345d0bd34860a0ff143bbbb8615f15f5242427d7f59e567
3
+ size 23518602
2016/finals/rng.md ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ You're playing a video game that features **N** different areas, numbered from
2
+ 1 to **N**. There are **M** one-way paths that each connect two areas. The
3
+ **i**th path runs from area **Ai** to a different area **Bi**. No pair of
4
+ paths directly connect the same pair of areas, and for every area it's
5
+ impossible to start at that area and follow a non-empty sequence of paths to
6
+ return to that area. In other words, the game's layout is a directed acyclic
7
+ graph.
8
+
9
+ You start in area 1. **K** other distinct areas each contain an item to
10
+ collect — the **i**th of these is area **Ii**. As soon as you've visited these
11
+ **K** areas at least once each, you win! You'd like to do so as fast as
12
+ possible.
13
+
14
+ At any point in time, if there are no outgoing paths leading away from your
15
+ current area, you automatically respawn in area 1 after a delay of **R**
16
+ seconds. Otherwise, you get to choose one such path and attempt to follow it.
17
+ Unfortunately, this game relies entirely on Random Number Generation to
18
+ determine whether or not you'll be successful, regardless of your skill. In
19
+ particular, with probability **P**, you'll successfully travel along your
20
+ chosen path for **D** seconds, ending up in a new area. On the other hand,
21
+ with probability 1 - **P**, you'll instead perish and respawn in area 1 after
22
+ a delay of **R** seconds.
23
+
24
+ What's the minimum expected time for you to collect all **K** items, given
25
+ that you play optimally? This is guaranteed to be possible — that is, all
26
+ **K** areas that contain items are reachable from area 1. Your output should
27
+ have at most 10-6 absolute or relative error.
28
+
29
+ ### Input
30
+
31
+ Input begins with an integer **T**, the number of times you play the game. For
32
+ each time, there is first a line containing the space-separated integers
33
+ **N**, **M**, and **K**. The second line contains the space-separated integers
34
+ **D** and **R**. The third line contains the real value **P** which is given
35
+ with at most 4 decimal places. The fourth line contains the **K** space-
36
+ separated integers **I1** to **IK**. Then, **M** lines follow, the **i**th of
37
+ which contains the space-separated integers **Ai** and **Bi**.
38
+
39
+ ### Output
40
+
41
+ For the **i**th time you play the game, print a line containing "Case #**i**:
42
+ " followed by the expected time it will take you to collect all of the items
43
+ if you play optimally.
44
+
45
+ ### Constraints
46
+
47
+ 1 ≤ **T** ≤ 50
48
+ 2 ≤ **N** ≤ 100,000
49
+ 1 ≤ **M** ≤ 100,000
50
+ 1 ≤ **K** ≤ min(20, **N** \- 1)
51
+ 0.5 ≤ **P** ≤ 1.0
52
+ 1 ≤ **D**, **R** ≤ 1,000
53
+ 1 ≤ **Ai**, **Bi** ≤ **N**
54
+ 2 ≤ **Ii** ≤ **N**
55
+
56
+ The answer for each game is guaranteed to be less than 1030.
57
+
58
+ ### Explanation of Sample
59
+
60
+ In the first game, it takes you 10 seconds to reach the only item, and then
61
+ you win. There's no chance of failure. The second game is the same as the
62
+ first, but now you fail to reach the item with probability 0.5. On average you
63
+ will fail once before reaching the item, so you'll incur an average penalty of
64
+ 3 seconds on top of the 10 seconds it takes you to succeed, for a total of 13
65
+ seconds.
66
+
2016/finals/rng.out ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Case #1: 10.000000000
2
+ Case #2: 13.000000000
3
+ Case #3: 2.000000000
4
+ Case #4: 1004.000000000
5
+ Case #5: 168.647230321
6
+ Case #6: 5.000000000
7
+ Case #7: 205153.000000000
8
+ Case #8: 36458853456.878738891
9
+ Case #9: 2055332.686437849
10
+ Case #10: 59748.000000000
11
+ Case #11: 1403028522515344.934448242
12
+ Case #12: 10421061.425855338
13
+ Case #13: 1188546.000000000
14
+ Case #14: 87401480.806348593
15
+ Case #15: 7405891.509676050
16
+ Case #16: 57974.000000000
17
+ Case #17: 242684.186821399
18
+ Case #18: 595547.494966301
19
+ Case #19: 2293360.000000000
20
+ Case #20: 179291.144112032
21
+ Case #21: 321865263.845019865
22
+ Case #22: 18279.000000000
23
+ Case #23: 101674943.588009080
24
+ Case #24: 316857.275527182
25
+ Case #25: 4164662.000000000
26
+ Case #26: 54584390.156581200
27
+ Case #27: 40624898564.638281569
28
+ Case #28: 1750.000000000
29
+ Case #29: 18450535.200870354
30
+ Case #30: 12376454131045.286281586
31
+ Case #31: 36879.000000000
32
+ Case #32: 30397317959.283073163
33
+ Case #33: 1408527396.723025701
34
+ Case #34: 22608.000000000
35
+ Case #35: 2198215868727194239631360.000000000
36
+ Case #36: 30969290.657660188
37
+ Case #37: 24910.000000000
38
+ Case #38: 487617.875314213
39
+ Case #39: 336930477.451522236
40
+ Case #40: 84147.000000000
41
+ Case #41: 6036579.688970289
42
+ Case #42: 29155.558865047
43
+ Case #43: 46501.000000000
44
+ Case #44: 245951881.560804426
45
+ Case #45: 353996.721532685
46
+ Case #46: 6350.000000000
2016/finals/snake_and_ladder.cpp ADDED
@@ -0,0 +1,178 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // SNAKE AND LADDER
2
+ // Official Solution by Jacob Plachta
3
+
4
+ #define DEBUG 0
5
+
6
+ #include <algorithm>
7
+ #include <functional>
8
+ #include <numeric>
9
+ #include <iostream>
10
+ #include <iomanip>
11
+ #include <cstdio>
12
+ #include <cmath>
13
+ #include <complex>
14
+ #include <cstdlib>
15
+ #include <ctime>
16
+ #include <cstring>
17
+ #include <cassert>
18
+ #include <string>
19
+ #include <vector>
20
+ #include <list>
21
+ #include <map>
22
+ #include <set>
23
+ #include <deque>
24
+ #include <queue>
25
+ #include <stack>
26
+ #include <bitset>
27
+ #include <sstream>
28
+ using namespace std;
29
+
30
+ #define LL long long
31
+ #define LD long double
32
+ #define PR pair<int,int>
33
+
34
+ #define Fox(i,n) for (i=0; i<n; i++)
35
+ #define Fox1(i,n) for (i=1; i<=n; i++)
36
+ #define FoxI(i,a,b) for (i=a; i<=b; i++)
37
+ #define FoxR(i,n) for (i=(n)-1; i>=0; i--)
38
+ #define FoxR1(i,n) for (i=n; i>0; i--)
39
+ #define FoxRI(i,a,b) for (i=b; i>=a; i--)
40
+ #define Foxen(i,s) for (i=s.begin(); i!=s.end(); i++)
41
+ #define Min(a,b) a=min(a,b)
42
+ #define Max(a,b) a=max(a,b)
43
+ #define Sz(s) int((s).size())
44
+ #define All(s) (s).begin(),(s).end()
45
+ #define Fill(s,v) memset(s,v,sizeof(s))
46
+ #define pb push_back
47
+ #define mp make_pair
48
+ #define x first
49
+ #define y second
50
+
51
+ template<typename T> T Abs(T x) { return(x<0 ? -x : x); }
52
+ template<typename T> T Sqr(T x) { return(x*x); }
53
+ string plural(string s) { return(Sz(s) && s[Sz(s)-1]=='x' ? s+"en" : s+"s"); }
54
+
55
+ const int INF = (int)1e9;
56
+ const LD EPS = 1e-9;
57
+ const LD PI = acos(-1.0);
58
+
59
+ //#if DEBUG
60
+ #define GETCHAR getchar
61
+ /*#else
62
+ #define GETCHAR getchar_unlocked
63
+ #endif*/
64
+
65
+ bool Read(int &x)
66
+ {
67
+ char c,r=0,n=0;
68
+ x=0;
69
+ for(;;)
70
+ {
71
+ c=GETCHAR();
72
+ if ((c<0) && (!r))
73
+ return(0);
74
+ if ((c=='-') && (!r))
75
+ n=1;
76
+ else
77
+ if ((c>='0') && (c<='9'))
78
+ x=x*10+c-'0',r=1;
79
+ else
80
+ if (r)
81
+ break;
82
+ }
83
+ if (n)
84
+ x=-x;
85
+ return(1);
86
+ }
87
+
88
+ bool ReadLL(LL &x)
89
+ {
90
+ char c,r=0,n=0;
91
+ x=0;
92
+ for(;;)
93
+ {
94
+ c=GETCHAR();
95
+ if ((c<0) && (!r))
96
+ return(0);
97
+ if ((c=='-') && (!r))
98
+ n=1;
99
+ else
100
+ if ((c>='0') && (c<='9'))
101
+ x=x*10+c-'0',r=1;
102
+ else
103
+ if (r)
104
+ break;
105
+ }
106
+ if (n)
107
+ x=-x;
108
+ return(1);
109
+ }
110
+
111
+ #define MOD 1000000007
112
+
113
+ int main()
114
+ {
115
+ if (DEBUG)
116
+ freopen("in.txt","r",stdin);
117
+ int T,t;
118
+ LL N;
119
+ int K;
120
+ int i,ans;
121
+ LL a,b,x,y;
122
+ static pair<LL,int> P[1000];
123
+ Read(T);
124
+ Fox1(t,T)
125
+ {
126
+ ReadLL(N),Read(K);
127
+ Fox(i,K)
128
+ ReadLL(P[i].x),Read(P[i].y);
129
+ if (K==2*N-1)
130
+ {
131
+ ans=1;
132
+ goto Done;
133
+ }
134
+ sort(P,P+K);
135
+ a=1,b=N;
136
+ Fox(i,K-1)
137
+ if ((P[i].x==P[i+1].x) && (P[i].x==a))
138
+ a++;
139
+ FoxR(i,K-1)
140
+ if ((P[i].x==P[i+1].x) && (P[i].x==b))
141
+ b--;
142
+ ans=0;
143
+ Fox(i,K-1)
144
+ if ((P[i].x==P[i+1].x) && (P[i].x>=a) && (P[i].x<=b))
145
+ goto Done;
146
+ x=-1;
147
+ Fox(i,K)
148
+ if ((P[i].x>=a) && (P[i].x<=b))
149
+ if (x<0)
150
+ x=y=P[i].x;
151
+ else
152
+ {
153
+ if ((P[i].x-y)%2==(P[i].y+P[i-1].y)%2)
154
+ goto Done;
155
+ y=P[i].x;
156
+ }
157
+ if (x<0)
158
+ {
159
+ N=b-a+1;
160
+ if (N==1)
161
+ ans=2;
162
+ else
163
+ {
164
+ N=(N-1)%MOD;
165
+ ans=(4+2*N*(N+1))%MOD;
166
+ }
167
+ }
168
+ else
169
+ {
170
+ a=max(1LL,x-a);
171
+ b=max(1LL,b-y);
172
+ ans=2*(a%MOD)*(b%MOD)%MOD;
173
+ }
174
+ Done:;
175
+ printf("Case #%d: %d\n",t,ans);
176
+ }
177
+ return(0);
178
+ }
2016/finals/snake_and_ladder.html ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <p>Some time has passed since you took in the local population of snakes, feeding them every day and allowing them to live peacefully amongst your ladders. Unfortunately, your neighbours have not been thrilled about living next to billions of serpents, so they've filed complaints to the mayor! As a result, almost all of your snakes and ladders have been forcibly evicted, leaving you with only one of each for company.</p>
2
+
3
+ <p>Your ladder has <strong>N</strong> horizontal rungs, numbered 1 to <strong>N</strong> from bottom to top. Like all ladders, it also has 2 vertical rails, with rail 1 on the left and rail 2 on the right. To improve its appearance, you've allowed some plants to grow all over it. Notably, there are <strong>K</strong> flowers at distinct locations on the ladder, with the ith flower at the intersection of rung <strong>R_i</strong> and rail <strong>C_i</strong>.</p>
4
+
5
+ <p>Your snake loves to sleep on the ladder. It always places its head at the intersection of some rung and some rail, and from there, each subsequent segment of its body extends up, down, left, or right to follow a rung or rail to another intersection. The snake likes to be spread out, but hates touching flowers, so it insists that the path that its body takes must not touch any intersection more than once, and must not touch any intersection that has a flower. Conveniently, the snake is exactly long enough to theoretically pass through all intersections that don't have flowers &mdash; that is, if consecutive rungs and rails are 1 unit apart from one another, then the snake has a length of 2 * <strong>N</strong> - <strong>K</strong> - 1 units. Note that your snake may have 0 length (in which case it'll only occupy a single intersection).</p>
6
+
7
+ <p>The diagram below (which corresponds to the fourth sample case) illustrates a valid way in which the snake can arrange itself on a ladder with 4 rungs and 1 flower:</p>
8
+
9
+ <center>
10
+ <img src="{{PHOTO_ID:191658972183607}}" />
11
+ </center>
12
+
13
+ <p>Can you help your snake count the number of different ways in which it can position itself on the ladder, such that it covers all of the intersections which don't contain flowers? An arrangement of the snake is defined by an ordered sequence of intersections that it passes through, starting from its head. You only need to compute the answer modulo 10<sup>9</sup> + 7.<p>
14
+
15
+
16
+ <h3>Input</h3>
17
+ <p>
18
+ Input begins with an integer <strong>T</strong>, the number of ladders.
19
+ For each ladder, there is first a line containing the space-separated integers <strong>N</strong> and <strong>K</strong>.
20
+ Then <strong>K</strong> lines follow, the <strong>i</strong>th of which contains the space-separated integers
21
+ <strong>R<sub>i</sub></strong> and <strong>C<sub>i</sub></strong> .
22
+ </p>
23
+
24
+
25
+ <h3>Output</h3>
26
+ <p>
27
+ For the <strong>i</strong>th ladder, print a line containing "Case #<strong>i</strong>: " followed by the number of ways in which the snake can be arranged, modulo 10<sup>9</sup> + 7.
28
+ </p>
29
+
30
+
31
+ <h3>Constraints</h3>
32
+ <p>
33
+ 1 &le; <strong>T</strong> &le; 555 <br />
34
+ 1 &le; <strong>N</strong> &le; 10<sup>12</sup> <br />
35
+ 0 &le; <strong>K</strong> &le; min(1000, 2 * <strong>N</strong> - 1) <br />
36
+ 1 &le; <strong>R<sub>i</sub></strong> &le; <strong>N</strong> <br />
37
+ 1 &le; <strong>C<sub>i</sub></strong> &le; 2 <br />
38
+ </p>
39
+
40
+
41
+ <h3>Explanation of Sample</h3>
42
+ <p>
43
+ For the first ladder, the snake can place its head in any of the 4 intersections, and from each one it can arrange itself in 2 ways for 8 ways total.
44
+
45
+ For the second ladder, the flowers prevent the snake from crossing from the top 2 intersections to the bottom 2 (or vice versa).
46
+
47
+ For the third ladder, there are 2 possible intersections at which the snake can place its head which yield 1 valid arrangement each.
48
+ </p>
2016/finals/snake_and_ladder.in ADDED
The diff for this file is too large to render. See raw diff
 
2016/finals/snake_and_ladder.md ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Some time has passed since you took in the local population of snakes, feeding
2
+ them every day and allowing them to live peacefully amongst your ladders.
3
+ Unfortunately, your neighbours have not been thrilled about living next to
4
+ billions of serpents, so they've filed complaints to the mayor! As a result,
5
+ almost all of your snakes and ladders have been forcibly evicted, leaving you
6
+ with only one of each for company.
7
+
8
+ Your ladder has **N** horizontal rungs, numbered 1 to **N** from bottom to
9
+ top. Like all ladders, it also has 2 vertical rails, with rail 1 on the left
10
+ and rail 2 on the right. To improve its appearance, you've allowed some plants
11
+ to grow all over it. Notably, there are **K** flowers at distinct locations on
12
+ the ladder, with the ith flower at the intersection of rung **R_i** and rail
13
+ **C_i**.
14
+
15
+ Your snake loves to sleep on the ladder. It always places its head at the
16
+ intersection of some rung and some rail, and from there, each subsequent
17
+ segment of its body extends up, down, left, or right to follow a rung or rail
18
+ to another intersection. The snake likes to be spread out, but hates touching
19
+ flowers, so it insists that the path that its body takes must not touch any
20
+ intersection more than once, and must not touch any intersection that has a
21
+ flower. Conveniently, the snake is exactly long enough to theoretically pass
22
+ through all intersections that don't have flowers — that is, if consecutive
23
+ rungs and rails are 1 unit apart from one another, then the snake has a length
24
+ of 2 * **N** \- **K** \- 1 units. Note that your snake may have 0 length (in
25
+ which case it'll only occupy a single intersection).
26
+
27
+ The diagram below (which corresponds to the fourth sample case) illustrates a
28
+ valid way in which the snake can arrange itself on a ladder with 4 rungs and 1
29
+ flower:
30
+
31
+ ![]({{PHOTO_ID:191658972183607}})
32
+
33
+ Can you help your snake count the number of different ways in which it can
34
+ position itself on the ladder, such that it covers all of the intersections
35
+ which don't contain flowers? An arrangement of the snake is defined by an
36
+ ordered sequence of intersections that it passes through, starting from its
37
+ head. You only need to compute the answer modulo 109 \+ 7.
38
+
39
+ ### Input
40
+
41
+ Input begins with an integer **T**, the number of ladders. For each ladder,
42
+ there is first a line containing the space-separated integers **N** and **K**.
43
+ Then **K** lines follow, the **i**th of which contains the space-separated
44
+ integers **Ri** and **Ci** .
45
+
46
+ ### Output
47
+
48
+ For the **i**th ladder, print a line containing "Case #**i**: " followed by
49
+ the number of ways in which the snake can be arranged, modulo 109 \+ 7.
50
+
51
+ ### Constraints
52
+
53
+ 1 ≤ **T** ≤ 555
54
+ 1 ≤ **N** ≤ 1012
55
+ 0 ≤ **K** ≤ min(1000, 2 * **N** \- 1)
56
+ 1 ≤ **Ri** ≤ **N**
57
+ 1 ≤ **Ci** ≤ 2
58
+
59
+ ### Explanation of Sample
60
+
61
+ For the first ladder, the snake can place its head in any of the 4
62
+ intersections, and from each one it can arrange itself in 2 ways for 8 ways
63
+ total. For the second ladder, the flowers prevent the snake from crossing from
64
+ the top 2 intersections to the bottom 2 (or vice versa). For the third ladder,
65
+ there are 2 possible intersections at which the snake can place its head which
66
+ yield 1 valid arrangement each.
67
+
2016/finals/snake_and_ladder.out ADDED
@@ -0,0 +1,529 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Case #1: 8
2
+ Case #2: 0
3
+ Case #3: 2
4
+ Case #4: 6
5
+ Case #5: 267684459
6
+ Case #6: 2
7
+ Case #7: 0
8
+ Case #8: 8
9
+ Case #9: 16
10
+ Case #10: 18
11
+ Case #11: 18
12
+ Case #12: 18
13
+ Case #13: 18
14
+ Case #14: 2
15
+ Case #15: 0
16
+ Case #16: 1
17
+ Case #17: 1
18
+ Case #18: 2
19
+ Case #19: 2
20
+ Case #20: 2
21
+ Case #21: 8
22
+ Case #22: 16
23
+ Case #23: 28
24
+ Case #24: 44
25
+ Case #25: 98014004
26
+ Case #26: 98042008
27
+ Case #27: 98070016
28
+ Case #28: 98098028
29
+ Case #29: 909245781
30
+ Case #30: 652060217
31
+ Case #31: 640977384
32
+ Case #32: 664530208
33
+ Case #33: 830548492
34
+ Case #34: 593512656
35
+ Case #35: 95307137
36
+ Case #36: 0
37
+ Case #37: 604780714
38
+ Case #38: 332205830
39
+ Case #39: 0
40
+ Case #40: 760227240
41
+ Case #41: 707565303
42
+ Case #42: 507887797
43
+ Case #43: 0
44
+ Case #44: 675464678
45
+ Case #45: 237893333
46
+ Case #46: 774092646
47
+ Case #47: 705417745
48
+ Case #48: 861683936
49
+ Case #49: 819675549
50
+ Case #50: 0
51
+ Case #51: 65522041
52
+ Case #52: 895571761
53
+ Case #53: 499418590
54
+ Case #54: 43777910
55
+ Case #55: 0
56
+ Case #56: 343296341
57
+ Case #57: 147476799
58
+ Case #58: 713920914
59
+ Case #59: 704481609
60
+ Case #60: 0
61
+ Case #61: 0
62
+ Case #62: 172783726
63
+ Case #63: 0
64
+ Case #64: 143935999
65
+ Case #65: 318798746
66
+ Case #66: 958416440
67
+ Case #67: 45952558
68
+ Case #68: 147032920
69
+ Case #69: 499410723
70
+ Case #70: 691849712
71
+ Case #71: 245335333
72
+ Case #72: 72749514
73
+ Case #73: 273939493
74
+ Case #74: 918544373
75
+ Case #75: 582144162
76
+ Case #76: 294768758
77
+ Case #77: 308107401
78
+ Case #78: 2919666
79
+ Case #79: 657198556
80
+ Case #80: 0
81
+ Case #81: 788507080
82
+ Case #82: 447769122
83
+ Case #83: 630995283
84
+ Case #84: 0
85
+ Case #85: 0
86
+ Case #86: 191460004
87
+ Case #87: 122517351
88
+ Case #88: 522940385
89
+ Case #89: 501725431
90
+ Case #90: 679753068
91
+ Case #91: 244495234
92
+ Case #92: 951991239
93
+ Case #93: 732415762
94
+ Case #94: 422292557
95
+ Case #95: 61549734
96
+ Case #96: 360169582
97
+ Case #97: 925804013
98
+ Case #98: 0
99
+ Case #99: 994778343
100
+ Case #100: 69156121
101
+ Case #101: 0
102
+ Case #102: 300391736
103
+ Case #103: 958830160
104
+ Case #104: 452633311
105
+ Case #105: 457669197
106
+ Case #106: 376869966
107
+ Case #107: 0
108
+ Case #108: 513749492
109
+ Case #109: 807217730
110
+ Case #110: 886568136
111
+ Case #111: 139597240
112
+ Case #112: 0
113
+ Case #113: 396876954
114
+ Case #114: 746206746
115
+ Case #115: 885654099
116
+ Case #116: 630331049
117
+ Case #117: 975485053
118
+ Case #118: 688222729
119
+ Case #119: 346345463
120
+ Case #120: 0
121
+ Case #121: 0
122
+ Case #122: 790872124
123
+ Case #123: 935207703
124
+ Case #124: 293638348
125
+ Case #125: 275610200
126
+ Case #126: 426278656
127
+ Case #127: 416495665
128
+ Case #128: 970191878
129
+ Case #129: 921587161
130
+ Case #130: 278640938
131
+ Case #131: 959969592
132
+ Case #132: 641068641
133
+ Case #133: 139676810
134
+ Case #134: 882444364
135
+ Case #135: 430504155
136
+ Case #136: 454462189
137
+ Case #137: 914657446
138
+ Case #138: 41279830
139
+ Case #139: 761870044
140
+ Case #140: 943943216
141
+ Case #141: 761613990
142
+ Case #142: 262356424
143
+ Case #143: 402162776
144
+ Case #144: 0
145
+ Case #145: 562337640
146
+ Case #146: 364610077
147
+ Case #147: 108051083
148
+ Case #148: 611455117
149
+ Case #149: 684453493
150
+ Case #150: 481874285
151
+ Case #151: 428459757
152
+ Case #152: 332184810
153
+ Case #153: 658304372
154
+ Case #154: 229790800
155
+ Case #155: 567392000
156
+ Case #156: 496522976
157
+ Case #157: 0
158
+ Case #158: 0
159
+ Case #159: 0
160
+ Case #160: 0
161
+ Case #161: 676773738
162
+ Case #162: 960386728
163
+ Case #163: 962907235
164
+ Case #164: 0
165
+ Case #165: 75611083
166
+ Case #166: 87681450
167
+ Case #167: 0
168
+ Case #168: 652700874
169
+ Case #169: 209976709
170
+ Case #170: 825356878
171
+ Case #171: 469939765
172
+ Case #172: 0
173
+ Case #173: 82338254
174
+ Case #174: 658729214
175
+ Case #175: 845914542
176
+ Case #176: 81692108
177
+ Case #177: 491954794
178
+ Case #178: 0
179
+ Case #179: 825554855
180
+ Case #180: 477679890
181
+ Case #181: 286250721
182
+ Case #182: 40811605
183
+ Case #183: 138857396
184
+ Case #184: 748613548
185
+ Case #185: 0
186
+ Case #186: 0
187
+ Case #187: 944211872
188
+ Case #188: 0
189
+ Case #189: 225408143
190
+ Case #190: 247861419
191
+ Case #191: 953196418
192
+ Case #192: 624462018
193
+ Case #193: 970680424
194
+ Case #194: 738460795
195
+ Case #195: 0
196
+ Case #196: 895052726
197
+ Case #197: 756372468
198
+ Case #198: 606229787
199
+ Case #199: 371816412
200
+ Case #200: 842451044
201
+ Case #201: 220141336
202
+ Case #202: 800719178
203
+ Case #203: 235949736
204
+ Case #204: 0
205
+ Case #205: 177925702
206
+ Case #206: 562911889
207
+ Case #207: 603198078
208
+ Case #208: 40086251
209
+ Case #209: 326382560
210
+ Case #210: 277267864
211
+ Case #211: 284812709
212
+ Case #212: 486202725
213
+ Case #213: 426376568
214
+ Case #214: 0
215
+ Case #215: 40152230
216
+ Case #216: 553261654
217
+ Case #217: 964315920
218
+ Case #218: 553087553
219
+ Case #219: 333254442
220
+ Case #220: 529531478
221
+ Case #221: 24261383
222
+ Case #222: 318643376
223
+ Case #223: 940051082
224
+ Case #224: 326129598
225
+ Case #225: 0
226
+ Case #226: 793791006
227
+ Case #227: 417084080
228
+ Case #228: 905212208
229
+ Case #229: 0
230
+ Case #230: 0
231
+ Case #231: 685393114
232
+ Case #232: 855249209
233
+ Case #233: 765663196
234
+ Case #234: 584891224
235
+ Case #235: 645360648
236
+ Case #236: 66127536
237
+ Case #237: 891920879
238
+ Case #238: 366785354
239
+ Case #239: 587172380
240
+ Case #240: 195409335
241
+ Case #241: 822773861
242
+ Case #242: 660719310
243
+ Case #243: 939251564
244
+ Case #244: 40786136
245
+ Case #245: 383182350
246
+ Case #246: 355063659
247
+ Case #247: 436113052
248
+ Case #248: 368586153
249
+ Case #249: 628864869
250
+ Case #250: 796225384
251
+ Case #251: 809365615
252
+ Case #252: 244554406
253
+ Case #253: 366323087
254
+ Case #254: 0
255
+ Case #255: 493329784
256
+ Case #256: 796983253
257
+ Case #257: 0
258
+ Case #258: 788852534
259
+ Case #259: 341785459
260
+ Case #260: 998294526
261
+ Case #261: 450123132
262
+ Case #262: 417260929
263
+ Case #263: 564979650
264
+ Case #264: 745495271
265
+ Case #265: 932721844
266
+ Case #266: 101881099
267
+ Case #267: 570596011
268
+ Case #268: 225089623
269
+ Case #269: 583785117
270
+ Case #270: 867381945
271
+ Case #271: 2
272
+ Case #272: 0
273
+ Case #273: 206522367
274
+ Case #274: 876681220
275
+ Case #275: 622910845
276
+ Case #276: 855819395
277
+ Case #277: 89649016
278
+ Case #278: 339753503
279
+ Case #279: 962820568
280
+ Case #280: 794370470
281
+ Case #281: 924563005
282
+ Case #282: 735879783
283
+ Case #283: 645696679
284
+ Case #284: 0
285
+ Case #285: 0
286
+ Case #286: 23539975
287
+ Case #287: 641175092
288
+ Case #288: 710321213
289
+ Case #289: 258478632
290
+ Case #290: 241279884
291
+ Case #291: 469676919
292
+ Case #292: 387988404
293
+ Case #293: 0
294
+ Case #294: 0
295
+ Case #295: 91144251
296
+ Case #296: 939738738
297
+ Case #297: 962156034
298
+ Case #298: 128841555
299
+ Case #299: 635008989
300
+ Case #300: 599117317
301
+ Case #301: 0
302
+ Case #302: 264013430
303
+ Case #303: 0
304
+ Case #304: 520442866
305
+ Case #305: 255620317
306
+ Case #306: 358385903
307
+ Case #307: 569292909
308
+ Case #308: 0
309
+ Case #309: 916864460
310
+ Case #310: 416230742
311
+ Case #311: 841936774
312
+ Case #312: 671189281
313
+ Case #313: 0
314
+ Case #314: 668100766
315
+ Case #315: 83628423
316
+ Case #316: 2
317
+ Case #317: 834739165
318
+ Case #318: 0
319
+ Case #319: 111433604
320
+ Case #320: 393135188
321
+ Case #321: 0
322
+ Case #322: 283357712
323
+ Case #323: 0
324
+ Case #324: 866449438
325
+ Case #325: 574883496
326
+ Case #326: 983486412
327
+ Case #327: 278390125
328
+ Case #328: 824179968
329
+ Case #329: 448191118
330
+ Case #330: 500425853
331
+ Case #331: 0
332
+ Case #332: 875783660
333
+ Case #333: 236627763
334
+ Case #334: 997353018
335
+ Case #335: 885094022
336
+ Case #336: 684451879
337
+ Case #337: 280831597
338
+ Case #338: 277072734
339
+ Case #339: 198980978
340
+ Case #340: 279385770
341
+ Case #341: 0
342
+ Case #342: 56561616
343
+ Case #343: 0
344
+ Case #344: 0
345
+ Case #345: 214330679
346
+ Case #346: 0
347
+ Case #347: 338369590
348
+ Case #348: 446992830
349
+ Case #349: 652721468
350
+ Case #350: 89823493
351
+ Case #351: 798770146
352
+ Case #352: 23943493
353
+ Case #353: 657247993
354
+ Case #354: 2
355
+ Case #355: 462606752
356
+ Case #356: 754834868
357
+ Case #357: 0
358
+ Case #358: 768347917
359
+ Case #359: 574849159
360
+ Case #360: 493991910
361
+ Case #361: 482235403
362
+ Case #362: 733647085
363
+ Case #363: 464886294
364
+ Case #364: 367230392
365
+ Case #365: 963536462
366
+ Case #366: 30896960
367
+ Case #367: 488115680
368
+ Case #368: 100025063
369
+ Case #369: 85505805
370
+ Case #370: 257505032
371
+ Case #371: 0
372
+ Case #372: 112810844
373
+ Case #373: 204386229
374
+ Case #374: 650456788
375
+ Case #375: 886880859
376
+ Case #376: 621284699
377
+ Case #377: 123981371
378
+ Case #378: 628156118
379
+ Case #379: 313050211
380
+ Case #380: 0
381
+ Case #381: 561409061
382
+ Case #382: 884917931
383
+ Case #383: 138761374
384
+ Case #384: 495214827
385
+ Case #385: 0
386
+ Case #386: 339710566
387
+ Case #387: 0
388
+ Case #388: 31526131
389
+ Case #389: 177960879
390
+ Case #390: 0
391
+ Case #391: 373755965
392
+ Case #392: 554616850
393
+ Case #393: 372101523
394
+ Case #394: 0
395
+ Case #395: 328174392
396
+ Case #396: 75452867
397
+ Case #397: 389723110
398
+ Case #398: 903406573
399
+ Case #399: 0
400
+ Case #400: 995181912
401
+ Case #401: 177486120
402
+ Case #402: 0
403
+ Case #403: 875614446
404
+ Case #404: 0
405
+ Case #405: 525150282
406
+ Case #406: 146534421
407
+ Case #407: 195538475
408
+ Case #408: 0
409
+ Case #409: 777208150
410
+ Case #410: 328256885
411
+ Case #411: 383680583
412
+ Case #412: 175838002
413
+ Case #413: 429238401
414
+ Case #414: 61585557
415
+ Case #415: 258463037
416
+ Case #416: 641795625
417
+ Case #417: 583816961
418
+ Case #418: 358121410
419
+ Case #419: 23420325
420
+ Case #420: 2
421
+ Case #421: 19627707
422
+ Case #422: 0
423
+ Case #423: 190132485
424
+ Case #424: 269509236
425
+ Case #425: 810480317
426
+ Case #426: 325938253
427
+ Case #427: 941451213
428
+ Case #428: 800680581
429
+ Case #429: 487252635
430
+ Case #430: 954711152
431
+ Case #431: 429001925
432
+ Case #432: 946913566
433
+ Case #433: 721106388
434
+ Case #434: 0
435
+ Case #435: 954587861
436
+ Case #436: 801862520
437
+ Case #437: 276372696
438
+ Case #438: 0
439
+ Case #439: 0
440
+ Case #440: 26220406
441
+ Case #441: 20177848
442
+ Case #442: 755314322
443
+ Case #443: 83217457
444
+ Case #444: 413683734
445
+ Case #445: 694150498
446
+ Case #446: 563690043
447
+ Case #447: 201547053
448
+ Case #448: 174915366
449
+ Case #449: 556096921
450
+ Case #450: 780300334
451
+ Case #451: 713858371
452
+ Case #452: 983021025
453
+ Case #453: 931983039
454
+ Case #454: 589408389
455
+ Case #455: 586961042
456
+ Case #456: 406189696
457
+ Case #457: 140574466
458
+ Case #458: 857491232
459
+ Case #459: 240667579
460
+ Case #460: 515774682
461
+ Case #461: 493891161
462
+ Case #462: 0
463
+ Case #463: 969535949
464
+ Case #464: 840879442
465
+ Case #465: 441075634
466
+ Case #466: 46805019
467
+ Case #467: 0
468
+ Case #468: 241109538
469
+ Case #469: 527338767
470
+ Case #470: 276060246
471
+ Case #471: 196235025
472
+ Case #472: 388970413
473
+ Case #473: 992000839
474
+ Case #474: 439128316
475
+ Case #475: 0
476
+ Case #476: 674627147
477
+ Case #477: 83147549
478
+ Case #478: 648051263
479
+ Case #479: 117467131
480
+ Case #480: 186885847
481
+ Case #481: 993453521
482
+ Case #482: 0
483
+ Case #483: 421710031
484
+ Case #484: 141152733
485
+ Case #485: 0
486
+ Case #486: 0
487
+ Case #487: 638818706
488
+ Case #488: 278540304
489
+ Case #489: 196194859
490
+ Case #490: 0
491
+ Case #491: 469271047
492
+ Case #492: 507731637
493
+ Case #493: 886093544
494
+ Case #494: 537120297
495
+ Case #495: 837983363
496
+ Case #496: 457950493
497
+ Case #497: 0
498
+ Case #498: 308666732
499
+ Case #499: 133051573
500
+ Case #500: 845916814
501
+ Case #501: 556775891
502
+ Case #502: 0
503
+ Case #503: 194973586
504
+ Case #504: 847611749
505
+ Case #505: 0
506
+ Case #506: 442361677
507
+ Case #507: 765950527
508
+ Case #508: 424875258
509
+ Case #509: 974163489
510
+ Case #510: 0
511
+ Case #511: 552423844
512
+ Case #512: 805129686
513
+ Case #513: 44854795
514
+ Case #514: 894969538
515
+ Case #515: 0
516
+ Case #516: 377676609
517
+ Case #517: 947305236
518
+ Case #518: 0
519
+ Case #519: 149366674
520
+ Case #520: 340647779
521
+ Case #521: 633524706
522
+ Case #522: 0
523
+ Case #523: 329047588
524
+ Case #524: 904019457
525
+ Case #525: 477069465
526
+ Case #526: 772725243
527
+ Case #527: 192943800
528
+ Case #528: 832901080
529
+ Case #529: 464479569
2016/quals/boomerang_constellations.html ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <p>
2
+ The night sky can be modeled as an infinite 2D plane. There are <strong>N</strong> stars at distinct positions on this plane, the <strong>i</strong>th of which is at coordinates
3
+ (<strong>X<sub>i</sub></strong>, <strong>Y<sub>i</sub></strong>).
4
+ </p>
5
+
6
+ <p>
7
+ A boomerang constellation is a pair of distinct equal-length line segments which share a single endpoint, such that both endpoints of each segment coincide with a star's location.
8
+ </p>
9
+
10
+ <p>
11
+ Two boomerang constellations are distinct if they're not made up of the same unordered pair of line segments. How many distinct boomerang constellations can you spot?
12
+ </p>
13
+
14
+
15
+ <h3>Input</h3>
16
+ <p>
17
+ Input begins with an integer <strong>T</strong>, the number of nights on which you look out at the sky.
18
+ For each night, there is first a line containing the integer <strong>N</strong>. Then, <strong>N</strong>
19
+ lines follow, the <strong>i</strong>th of which contains the space-separated integers
20
+ <strong>X<sub>i</sub></strong> and <strong>Y<sub>i</sub></strong>.
21
+ </p>
22
+
23
+
24
+ <h3>Output</h3>
25
+ <p>
26
+ For the <strong>i</strong>th night, print a line containing "Case #<strong>i</strong>: " followed by
27
+ the number of boomerang constellations in the night sky.
28
+ </p>
29
+
30
+
31
+ <h3>Constraints</h3>
32
+ <p>
33
+ 1 &le; <strong>T</strong> &le; 50 <br />
34
+ 1 &le; <strong>N</strong> &le; 2,000 <br />
35
+ -10,000 &le; <strong>X<sub>i</sub></strong>, <strong>Y<sub>i</sub></strong> &le; 10,000 <br />
36
+ </p>
37
+
38
+
39
+
40
+ <h3>Explanation of Sample</h3>
41
+ <p>
42
+ On the first night, every pair of stars is a unique distance apart, so there are no boomerang constellations. On the second night, there are 4 boomerang constellations. One of them consists of the line segments (0,0)-(0,2) and (0,2)-(0,4).
43
+ </p>
44
+
45
+
2016/quals/boomerang_constellations.in ADDED
The diff for this file is too large to render. See raw diff
 
2016/quals/boomerang_constellations.md ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ The night sky can be modeled as an infinite 2D plane. There are **N** stars at
2
+ distinct positions on this plane, the **i**th of which is at coordinates
3
+ (**Xi**, **Yi**).
4
+
5
+ A boomerang constellation is a pair of distinct equal-length line segments
6
+ which share a single endpoint, such that both endpoints of each segment
7
+ coincide with a star's location.
8
+
9
+ Two boomerang constellations are distinct if they're not made up of the same
10
+ unordered pair of line segments. How many distinct boomerang constellations
11
+ can you spot?
12
+
13
+ ### Input
14
+
15
+ Input begins with an integer **T**, the number of nights on which you look out
16
+ at the sky. For each night, there is first a line containing the integer
17
+ **N**. Then, **N** lines follow, the **i**th of which contains the space-
18
+ separated integers **Xi** and **Yi**.
19
+
20
+ ### Output
21
+
22
+ For the **i**th night, print a line containing "Case #**i**: " followed by the
23
+ number of boomerang constellations in the night sky.
24
+
25
+ ### Constraints
26
+
27
+ 1 ≤ **T** ≤ 50
28
+ 1 ≤ **N** ≤ 2,000
29
+ -10,000 ≤ **Xi**, **Yi** ≤ 10,000
30
+
31
+ ### Explanation of Sample
32
+
33
+ On the first night, every pair of stars is a unique distance apart, so there
34
+ are no boomerang constellations. On the second night, there are 4 boomerang
35
+ constellations. One of them consists of the line segments (0,0)-(0,2) and
36
+ (0,2)-(0,4).
37
+
2016/quals/boomerang_constellations.out ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Case #1: 0
2
+ Case #2: 4
3
+ Case #3: 4
4
+ Case #4: 3
5
+ Case #5: 12
6
+ Case #6: 8293552
7
+ Case #7: 7734388
8
+ Case #8: 7156263
9
+ Case #9: 6744808
10
+ Case #10: 6234753
11
+ Case #11: 5844124
12
+ Case #12: 6
13
+ Case #13: 0
14
+ Case #14: 81
15
+ Case #15: 58
16
+ Case #16: 197
17
+ Case #17: 2712
18
+ Case #18: 19
19
+ Case #19: 1
20
+ Case #20: 662
21
+ Case #21: 28
22
+ Case #22: 92
23
+ Case #23: 0
24
+ Case #24: 94
25
+ Case #25: 53
26
+ Case #26: 463
27
+ Case #27: 210
28
+ Case #28: 283
29
+ Case #29: 0
30
+ Case #30: 0
31
+ Case #31: 105
32
+ Case #32: 1396
33
+ Case #33: 126
34
+ Case #34: 98
35
+ Case #35: 31
36
+ Case #36: 225
37
+ Case #37: 872
38
+ Case #38: 60
39
+ Case #39: 362
40
+ Case #40: 10
41
+ Case #41: 1
42
+ Case #42: 11
43
+ Case #43: 3009
44
+ Case #44: 132
45
+ Case #45: 2808
46
+ Case #46: 163
47
+ Case #47: 119
48
+ Case #48: 107
49
+ Case #49: 1730
50
+ Case #50: 30
51
+ Case #51: 284
52
+ Case #52: 62
53
+ Case #53: 0
54
+ Case #54: 1
55
+ Case #55: 16
56
+ Case #56: 143
57
+ Case #57: 0
58
+ Case #58: 405452
59
+ Case #59: 57
60
+ Case #60: 1029
61
+ Case #61: 3
62
+ Case #62: 17
63
+ Case #63: 0
64
+ Case #64: 13
65
+ Case #65: 50
66
+ Case #66: 146
67
+ Case #67: 228
68
+ Case #68: 33
69
+ Case #69: 5
70
+ Case #70: 17
71
+ Case #71: 132
72
+ Case #72: 0
73
+ Case #73: 203
74
+ Case #74: 35
75
+ Case #75: 168
2016/quals/high_security.html ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <p>
2
+ A top-secret algorithmic research facility has decided to up its security by hiring guards to keep watch over the premises.
3
+ After all, they don't want anyone sneaking in and learning the answers to questions such as "does P = NP?" and
4
+ "what are the solutions to the 2016 Facebook Hacker Cup problems?".
5
+ </p>
6
+
7
+ <p>
8
+ When viewed from above, the facility can be modeled as a grid <strong>G</strong> with 2 rows and <strong>N</strong> columns.
9
+ The <strong>j</strong>th cell in the <strong>i</strong>th row is either empty (represented by <strong>G<sub>i,j</sub></strong> = ".")
10
+ or occupied by a building (<strong>G<sub>i,j</sub></strong> = "X"), and the grid includes at least one empty cell.
11
+ </p>
12
+
13
+ <p>
14
+ Guards may be potentially stationed in any of the empty cells. A guard can see not only their own cell, but also all contiguous empty cells in each of the 4 compass directions
15
+ (up, down, left, and right) until the edge of the grid or a building. For example, in the grid below, the guard ("G") can see every cell marked with an asterisk ("*"):
16
+ </p>
17
+
18
+ <pre>
19
+ .*.X.X..
20
+ *G*****X
21
+ </pre>
22
+
23
+ <p>
24
+ What is the minimum number of guards required such that every empty cell in the grid can be seen by at least one of them?
25
+ </p>
26
+
27
+
28
+ <h3>Input</h3>
29
+ <p>
30
+ Input begins with an integer <strong>T</strong>, the number of facilities that need guarding.
31
+ For each facility, there is first a line containing the integer <strong>N</strong>. The next line contains the grid cells
32
+ <strong>G<sub>1,1</sub></strong> to <strong>G<sub>1,N</sub></strong> in order. The third line contains the grid cells
33
+ <strong>G<sub>2,1</sub></strong> to <strong>G<sub>2,N</sub></strong> in order.
34
+ </p>
35
+
36
+
37
+ <h3>Output</h3>
38
+ <p>
39
+ For the <strong>i</strong>th facility, print a line containing "Case #<strong>i</strong>: " followed by
40
+ the number of guards required to guard the facility.
41
+ </p>
42
+
43
+
44
+ <h3>Constraints</h3>
45
+ <p>
46
+ 1 &le; <strong>T</strong> &le; 200 <br />
47
+ 1 &le; <strong>N</strong> &le; 1,000 <br />
48
+ </p>
49
+
50
+
51
+
52
+ <h3>Explanation of Sample</h3>
53
+ <p>
54
+ In the first case, one solution is to place three guards as follows:
55
+ </p>
56
+
57
+ <pre>
58
+ .G.X.XG.
59
+ ....G..X
60
+ </pre>
61
+
62
+
2016/quals/high_security.in ADDED
The diff for this file is too large to render. See raw diff
 
2016/quals/high_security.md ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ A top-secret algorithmic research facility has decided to up its security by
2
+ hiring guards to keep watch over the premises. After all, they don't want
3
+ anyone sneaking in and learning the answers to questions such as "does P =
4
+ NP?" and "what are the solutions to the 2016 Facebook Hacker Cup problems?".
5
+
6
+ When viewed from above, the facility can be modeled as a grid **G** with 2
7
+ rows and **N** columns. The **j**th cell in the **i**th row is either empty
8
+ (represented by **Gi,j** = ".") or occupied by a building (**Gi,j** = "X"),
9
+ and the grid includes at least one empty cell.
10
+
11
+ Guards may be potentially stationed in any of the empty cells. A guard can see
12
+ not only their own cell, but also all contiguous empty cells in each of the 4
13
+ compass directions (up, down, left, and right) until the edge of the grid or a
14
+ building. For example, in the grid below, the guard ("G") can see every cell
15
+ marked with an asterisk ("*"):
16
+
17
+ .*.X.X..
18
+ *G*****X
19
+
20
+ What is the minimum number of guards required such that every empty cell in
21
+ the grid can be seen by at least one of them?
22
+
23
+ ### Input
24
+
25
+ Input begins with an integer **T**, the number of facilities that need
26
+ guarding. For each facility, there is first a line containing the integer
27
+ **N**. The next line contains the grid cells **G1,1** to **G1,N** in order.
28
+ The third line contains the grid cells **G2,1** to **G2,N** in order.
29
+
30
+ ### Output
31
+
32
+ For the **i**th facility, print a line containing "Case #**i**: " followed by
33
+ the number of guards required to guard the facility.
34
+
35
+ ### Constraints
36
+
37
+ 1 ≤ **T** ≤ 200
38
+ 1 ≤ **N** ≤ 1,000
39
+
40
+ ### Explanation of Sample
41
+
42
+ In the first case, one solution is to place three guards as follows:
43
+
44
+ .G.X.XG.
45
+ ....G..X
46
+
2016/quals/high_security.out ADDED
@@ -0,0 +1,307 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Case #1: 3
2
+ Case #2: 3
3
+ Case #3: 2
4
+ Case #4: 5
5
+ Case #5: 6
6
+ Case #6: 1
7
+ Case #7: 1
8
+ Case #8: 411
9
+ Case #9: 360
10
+ Case #10: 345
11
+ Case #11: 315
12
+ Case #12: 67
13
+ Case #13: 223
14
+ Case #14: 134
15
+ Case #15: 174
16
+ Case #16: 325
17
+ Case #17: 98
18
+ Case #18: 308
19
+ Case #19: 236
20
+ Case #20: 220
21
+ Case #21: 70
22
+ Case #22: 241
23
+ Case #23: 161
24
+ Case #24: 128
25
+ Case #25: 20
26
+ Case #26: 147
27
+ Case #27: 376
28
+ Case #28: 240
29
+ Case #29: 191
30
+ Case #30: 132
31
+ Case #31: 267
32
+ Case #32: 10
33
+ Case #33: 237
34
+ Case #34: 338
35
+ Case #35: 238
36
+ Case #36: 213
37
+ Case #37: 315
38
+ Case #38: 187
39
+ Case #39: 325
40
+ Case #40: 146
41
+ Case #41: 103
42
+ Case #42: 237
43
+ Case #43: 146
44
+ Case #44: 129
45
+ Case #45: 173
46
+ Case #46: 252
47
+ Case #47: 25
48
+ Case #48: 355
49
+ Case #49: 244
50
+ Case #50: 270
51
+ Case #51: 285
52
+ Case #52: 10
53
+ Case #53: 283
54
+ Case #54: 203
55
+ Case #55: 107
56
+ Case #56: 262
57
+ Case #57: 319
58
+ Case #58: 213
59
+ Case #59: 380
60
+ Case #60: 177
61
+ Case #61: 282
62
+ Case #62: 99
63
+ Case #63: 304
64
+ Case #64: 285
65
+ Case #65: 116
66
+ Case #66: 246
67
+ Case #67: 103
68
+ Case #68: 120
69
+ Case #69: 164
70
+ Case #70: 351
71
+ Case #71: 185
72
+ Case #72: 61
73
+ Case #73: 254
74
+ Case #74: 314
75
+ Case #75: 249
76
+ Case #76: 231
77
+ Case #77: 147
78
+ Case #78: 375
79
+ Case #79: 304
80
+ Case #80: 62
81
+ Case #81: 320
82
+ Case #82: 273
83
+ Case #83: 282
84
+ Case #84: 201
85
+ Case #85: 207
86
+ Case #86: 406
87
+ Case #87: 284
88
+ Case #88: 268
89
+ Case #89: 150
90
+ Case #90: 250
91
+ Case #91: 179
92
+ Case #92: 197
93
+ Case #93: 264
94
+ Case #94: 374
95
+ Case #95: 172
96
+ Case #96: 74
97
+ Case #97: 208
98
+ Case #98: 277
99
+ Case #99: 58
100
+ Case #100: 146
101
+ Case #101: 217
102
+ Case #102: 58
103
+ Case #103: 203
104
+ Case #104: 68
105
+ Case #105: 286
106
+ Case #106: 350
107
+ Case #107: 118
108
+ Case #108: 151
109
+ Case #109: 249
110
+ Case #110: 402
111
+ Case #111: 81
112
+ Case #112: 382
113
+ Case #113: 239
114
+ Case #114: 366
115
+ Case #115: 250
116
+ Case #116: 286
117
+ Case #117: 318
118
+ Case #118: 137
119
+ Case #119: 320
120
+ Case #120: 151
121
+ Case #121: 284
122
+ Case #122: 176
123
+ Case #123: 196
124
+ Case #124: 182
125
+ Case #125: 107
126
+ Case #126: 220
127
+ Case #127: 253
128
+ Case #128: 215
129
+ Case #129: 260
130
+ Case #130: 290
131
+ Case #131: 202
132
+ Case #132: 217
133
+ Case #133: 136
134
+ Case #134: 258
135
+ Case #135: 220
136
+ Case #136: 55
137
+ Case #137: 228
138
+ Case #138: 349
139
+ Case #139: 126
140
+ Case #140: 352
141
+ Case #141: 373
142
+ Case #142: 35
143
+ Case #143: 108
144
+ Case #144: 166
145
+ Case #145: 234
146
+ Case #146: 220
147
+ Case #147: 126
148
+ Case #148: 392
149
+ Case #149: 312
150
+ Case #150: 211
151
+ Case #151: 127
152
+ Case #152: 144
153
+ Case #153: 235
154
+ Case #154: 213
155
+ Case #155: 379
156
+ Case #156: 189
157
+ Case #157: 388
158
+ Case #158: 247
159
+ Case #159: 85
160
+ Case #160: 209
161
+ Case #161: 201
162
+ Case #162: 255
163
+ Case #163: 258
164
+ Case #164: 311
165
+ Case #165: 123
166
+ Case #166: 253
167
+ Case #167: 72
168
+ Case #168: 223
169
+ Case #169: 233
170
+ Case #170: 161
171
+ Case #171: 259
172
+ Case #172: 265
173
+ Case #173: 294
174
+ Case #174: 310
175
+ Case #175: 180
176
+ Case #176: 173
177
+ Case #177: 233
178
+ Case #178: 333
179
+ Case #179: 201
180
+ Case #180: 236
181
+ Case #181: 114
182
+ Case #182: 228
183
+ Case #183: 380
184
+ Case #184: 143
185
+ Case #185: 368
186
+ Case #186: 231
187
+ Case #187: 313
188
+ Case #188: 246
189
+ Case #189: 362
190
+ Case #190: 111
191
+ Case #191: 297
192
+ Case #192: 212
193
+ Case #193: 99
194
+ Case #194: 250
195
+ Case #195: 225
196
+ Case #196: 361
197
+ Case #197: 190
198
+ Case #198: 163
199
+ Case #199: 78
200
+ Case #200: 10
201
+ Case #201: 208
202
+ Case #202: 275
203
+ Case #203: 139
204
+ Case #204: 193
205
+ Case #205: 269
206
+ Case #206: 77
207
+ Case #207: 258
208
+ Case #208: 261
209
+ Case #209: 234
210
+ Case #210: 391
211
+ Case #211: 262
212
+ Case #212: 319
213
+ Case #213: 280
214
+ Case #214: 214
215
+ Case #215: 222
216
+ Case #216: 311
217
+ Case #217: 166
218
+ Case #218: 234
219
+ Case #219: 370
220
+ Case #220: 289
221
+ Case #221: 236
222
+ Case #222: 236
223
+ Case #223: 279
224
+ Case #224: 186
225
+ Case #225: 77
226
+ Case #226: 286
227
+ Case #227: 239
228
+ Case #228: 196
229
+ Case #229: 58
230
+ Case #230: 306
231
+ Case #231: 226
232
+ Case #232: 346
233
+ Case #233: 194
234
+ Case #234: 65
235
+ Case #235: 110
236
+ Case #236: 115
237
+ Case #237: 327
238
+ Case #238: 271
239
+ Case #239: 181
240
+ Case #240: 213
241
+ Case #241: 245
242
+ Case #242: 254
243
+ Case #243: 133
244
+ Case #244: 286
245
+ Case #245: 102
246
+ Case #246: 109
247
+ Case #247: 129
248
+ Case #248: 185
249
+ Case #249: 340
250
+ Case #250: 248
251
+ Case #251: 369
252
+ Case #252: 232
253
+ Case #253: 103
254
+ Case #254: 250
255
+ Case #255: 218
256
+ Case #256: 321
257
+ Case #257: 120
258
+ Case #258: 338
259
+ Case #259: 330
260
+ Case #260: 238
261
+ Case #261: 128
262
+ Case #262: 301
263
+ Case #263: 193
264
+ Case #264: 190
265
+ Case #265: 220
266
+ Case #266: 213
267
+ Case #267: 127
268
+ Case #268: 201
269
+ Case #269: 239
270
+ Case #270: 55
271
+ Case #271: 112
272
+ Case #272: 90
273
+ Case #273: 147
274
+ Case #274: 163
275
+ Case #275: 378
276
+ Case #276: 255
277
+ Case #277: 296
278
+ Case #278: 73
279
+ Case #279: 335
280
+ Case #280: 7
281
+ Case #281: 357
282
+ Case #282: 290
283
+ Case #283: 175
284
+ Case #284: 370
285
+ Case #285: 116
286
+ Case #286: 136
287
+ Case #287: 396
288
+ Case #288: 269
289
+ Case #289: 410
290
+ Case #290: 86
291
+ Case #291: 318
292
+ Case #292: 289
293
+ Case #293: 222
294
+ Case #294: 169
295
+ Case #295: 284
296
+ Case #296: 231
297
+ Case #297: 377
298
+ Case #298: 274
299
+ Case #299: 231
300
+ Case #300: 13
301
+ Case #301: 216
302
+ Case #302: 182
303
+ Case #303: 170
304
+ Case #304: 278
305
+ Case #305: 144
306
+ Case #306: 109
307
+ Case #307: 305
2016/quals/price.html ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <p>
2
+ You've managed to become a contestant on the hottest new game show, The Price is Correct!
3
+ </p>
4
+
5
+ <p>
6
+ After asking you to come on down to the stage, the show's host presents you with a row of <strong>N</strong> closed boxes,
7
+ numbered from 1 to <strong>N</strong> in order, each containing a secret positive integer.
8
+ A curtain opens to reveal a shiny, new tricycle &mdash; you recognize it as an expensive, top-of-the-line model.
9
+ </p>
10
+
11
+ <p>
12
+ The host then proceeds to explain the rules: you must select a contiguous sequence of the boxes (boxes a..b, for some 1 &le; a &le; b &le; <strong>N</strong>).
13
+ Your chosen boxes will then be opened, and if the sum of the numbers inside is no greater than the price of the tricycle, you win it!
14
+ </p>
15
+
16
+ <p>
17
+ You'd sure like to win that tricycle. Fortunately, not only are you aware that its price is exactly <strong>P</strong>, but you've paid off the host to let you in
18
+ on the contents of the boxes! You know that each box <strong>i</strong> contains the number <strong>B<sub>i</sub></strong>.
19
+ </p>
20
+
21
+ <p>
22
+ How many different sequences of boxes can you choose such that you win the tricycle? Each sequence is defined by its starting and ending box indices (a and b).
23
+ </p>
24
+
25
+
26
+ <h3>Input</h3>
27
+ <p>
28
+ Input begins with an integer <strong>T</strong>, the number of times you appear on The Price is Correct.
29
+ For each show, there is first a line containing the space-separated integers <strong>N</strong> and <strong>P</strong>.
30
+ The next line contains <strong>N</strong> space-separated integers, <strong>B<sub>1</sub></strong> through <strong>B<sub>N</sub></strong> in order.
31
+ </p>
32
+
33
+
34
+ <h3>Output</h3>
35
+ <p>
36
+ For the <strong>i</strong>th show, print a line containing "Case #<strong>i</strong>: " followed by
37
+ the number of box sequences that will win you the tricycle.
38
+ </p>
39
+
40
+
41
+ <h3>Constraints</h3>
42
+ <p>
43
+ 1 &le; <strong>T</strong> &le; 40 <br />
44
+ 1 &le; <strong>N</strong> &le; 100,000 <br />
45
+ 1 &le; <strong>P</strong> &le; 1,000,000,000 <br />
46
+ 1 &le; <strong>B<sub>i</sub></strong> &le; 1,000,000,000 <br />
47
+ </p>
48
+
49
+
50
+ <h3>Explanation of Sample</h3>
51
+ <p>
52
+ In the first case no sequence adds up to more than 50, so all 10 sequences are winners. In the fourth case, you can select any single box, or the sequences (1, 2), (1, 3), and (2, 3), for 9 total winning sequences.
53
+ </p>
2016/quals/price.in ADDED
The diff for this file is too large to render. See raw diff
 
2016/quals/price.md ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ You've managed to become a contestant on the hottest new game show, The Price
2
+ is Correct!
3
+
4
+ After asking you to come on down to the stage, the show's host presents you
5
+ with a row of **N** closed boxes, numbered from 1 to **N** in order, each
6
+ containing a secret positive integer. A curtain opens to reveal a shiny, new
7
+ tricycle — you recognize it as an expensive, top-of-the-line model.
8
+
9
+ The host then proceeds to explain the rules: you must select a contiguous
10
+ sequence of the boxes (boxes a..b, for some 1 ≤ a ≤ b ≤ **N**). Your chosen
11
+ boxes will then be opened, and if the sum of the numbers inside is no greater
12
+ than the price of the tricycle, you win it!
13
+
14
+ You'd sure like to win that tricycle. Fortunately, not only are you aware that
15
+ its price is exactly **P**, but you've paid off the host to let you in on the
16
+ contents of the boxes! You know that each box **i** contains the number
17
+ **Bi**.
18
+
19
+ How many different sequences of boxes can you choose such that you win the
20
+ tricycle? Each sequence is defined by its starting and ending box indices (a
21
+ and b).
22
+
23
+ ### Input
24
+
25
+ Input begins with an integer **T**, the number of times you appear on The
26
+ Price is Correct. For each show, there is first a line containing the space-
27
+ separated integers **N** and **P**. The next line contains **N** space-
28
+ separated integers, **B1** through **BN** in order.
29
+
30
+ ### Output
31
+
32
+ For the **i**th show, print a line containing "Case #**i**: " followed by the
33
+ number of box sequences that will win you the tricycle.
34
+
35
+ ### Constraints
36
+
37
+ 1 ≤ **T** ≤ 40
38
+ 1 ≤ **N** ≤ 100,000
39
+ 1 ≤ **P** ≤ 1,000,000,000
40
+ 1 ≤ **Bi** ≤ 1,000,000,000
41
+
42
+ ### Explanation of Sample
43
+
44
+ In the first case no sequence adds up to more than 50, so all 10 sequences are
45
+ winners. In the fourth case, you can select any single box, or the sequences
46
+ (1, 2), (1, 3), and (2, 3), for 9 total winning sequences.
47
+
2016/quals/price.out ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Case #1: 10
2
+ Case #2: 0
3
+ Case #3: 3
4
+ Case #4: 9
5
+ Case #5: 18
6
+ Case #6: 5000050000
7
+ Case #7: 4447875291
8
+ Case #8: 4444789339
9
+ Case #9: 4442082364
10
+ Case #10: 999955
11
+ Case #11: 0
12
+ Case #12: 1
13
+ Case #13: 246753
14
+ Case #14: 193131
15
+ Case #15: 286146
16
+ Case #16: 176715
17
+ Case #17: 348195
18
+ Case #18: 179700
19
+ Case #19: 427350
20
+ Case #20: 365940
21
+ Case #21: 250278
22
+ Case #22: 241860
23
+ Case #23: 183315
24
+ Case #24: 261003
25
+ Case #25: 360825
26
+ Case #26: 154290
27
+ Case #27: 241860
28
+ Case #28: 203203
29
+ Case #29: 306153
30
+ Case #30: 141778
31
+ Case #31: 170820
32
+ Case #32: 243951
33
+ Case #33: 305371
34
+ Case #34: 411778
35
+ Case #35: 404550
36
+ Case #36: 140185
37
+ Case #37: 376278
38
+ Case #38: 240471
39
+ Case #39: 378885
40
+ Case #40: 125250
41
+ Case #41: 429201
42
+ Case #42: 187578
43
+ Case #43: 246753
44
+ Case #44: 190653
45
+ Case #45: 269011
46
+ Case #46: 271216
47
+ Case #47: 409060
48
+ Case #48: 158203
49
+ Case #49: 287661
50
+ Case #50: 431056
51
+ Case #51: 368511
52
+ Case #52: 284635
53
+ Case #53: 137026
54
+ Case #54: 139656
55
+ Case #55: 220780
2016/quals/text_editor.html ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <p>
2
+ You have a list of <strong>N</strong> distinct words, consisting of only lowercase letters. You'd like to print any <strong>K</strong> words from this list, one per page, in any order.
3
+ </p>
4
+
5
+ <p>
6
+ You will accomplish this using a very basic text editor. It supports 3 types of operations: typing a letter, deleting the previous letter, and printing the current document.
7
+ Note that it does not allow the cursor to be moved! This means that the first operation may only add a letter to the end of the document, and the second may only delete the last letter (if any).
8
+ Due to issues with memory leakage, you also need to remember to leave the document completely empty after you've printed your <strong>K</strong> words!
9
+ </p>
10
+
11
+ <p>
12
+ What's the minimum number of operations required to get the job done?
13
+ </p>
14
+
15
+ <p>
16
+ As an example, let's say that you want to print 3 of the following 5 words:
17
+ </p>
18
+
19
+ <pre>
20
+ a
21
+ hair
22
+ box
23
+ awesome
24
+ hail
25
+ </pre>
26
+
27
+ <p>
28
+ One optimal sequence of 15 operations is as follows:
29
+ </p>
30
+
31
+ <p>
32
+ <ul>
33
+ <li> - type 'h', 'a', 'i', and 'r' (document = 'hair')
34
+ <li> - print
35
+ <li> - backspace (document = 'hai')
36
+ <li> - type 'l' (document = 'hail')
37
+ <li> - print
38
+ <li> - backspace 4 times (document = empty)
39
+ <li> - type 'a' (document = 'a')
40
+ <li> - print
41
+ <li> - backspace (document = empty)
42
+ </ul>
43
+ </p>
44
+
45
+
46
+ <h3>Input</h3>
47
+ <p>
48
+ Input begins with an integer <strong>T</strong>, the number of sets of words you want to print.
49
+ For each set, there is first a line containing the space-separated integers <strong>N</strong> and <strong>K</strong>.
50
+ The next <strong>N</strong> lines contain the set of words, one per line.
51
+ </p>
52
+
53
+
54
+ <h3>Output</h3>
55
+ <p>
56
+ For the <strong>i</strong>th set of words, print a line containing "Case #<strong>i</strong>: " followed by
57
+ the minimum number of operations required to print <strong>K</strong> of the words and then leave the document empty.
58
+ </p>
59
+
60
+
61
+ <h3>Constraints</h3>
62
+ <p>
63
+ 1 &le; <strong>T</strong> &le; 100 <br />
64
+ 1 &le; <strong>K</strong> &le; <strong>N</strong> &le; 300 <br />
65
+ The total length of all <strong>N</strong> words in each set will be at most 100,000 characters.<br />
66
+ </p>
67
+
2016/quals/text_editor.in ADDED
The diff for this file is too large to render. See raw diff
 
2016/quals/text_editor.md ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ You have a list of **N** distinct words, consisting of only lowercase letters.
2
+ You'd like to print any **K** words from this list, one per page, in any
3
+ order.
4
+
5
+ You will accomplish this using a very basic text editor. It supports 3 types
6
+ of operations: typing a letter, deleting the previous letter, and printing the
7
+ current document. Note that it does not allow the cursor to be moved! This
8
+ means that the first operation may only add a letter to the end of the
9
+ document, and the second may only delete the last letter (if any). Due to
10
+ issues with memory leakage, you also need to remember to leave the document
11
+ completely empty after you've printed your **K** words!
12
+
13
+ What's the minimum number of operations required to get the job done?
14
+
15
+ As an example, let's say that you want to print 3 of the following 5 words:
16
+
17
+ a
18
+ hair
19
+ box
20
+ awesome
21
+ hail
22
+
23
+ One optimal sequence of 15 operations is as follows:
24
+
25
+ * \- type 'h', 'a', 'i', and 'r' (document = 'hair')
26
+ * \- print
27
+ * \- backspace (document = 'hai')
28
+ * \- type 'l' (document = 'hail')
29
+ * \- print
30
+ * \- backspace 4 times (document = empty)
31
+ * \- type 'a' (document = 'a')
32
+ * \- print
33
+ * \- backspace (document = empty)
34
+
35
+ ### Input
36
+
37
+ Input begins with an integer **T**, the number of sets of words you want to
38
+ print. For each set, there is first a line containing the space-separated
39
+ integers **N** and **K**. The next **N** lines contain the set of words, one
40
+ per line.
41
+
42
+ ### Output
43
+
44
+ For the **i**th set of words, print a line containing "Case #**i**: " followed
45
+ by the minimum number of operations required to print **K** of the words and
46
+ then leave the document empty.
47
+
48
+ ### Constraints
49
+
50
+ 1 ≤ **T** ≤ 100
51
+ 1 ≤ **K** ≤ **N** ≤ 300
52
+ The total length of all **N** words in each set will be at most 100,000
53
+ characters.
54
+
2016/quals/text_editor.out ADDED
@@ -0,0 +1,305 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Case #1: 9
2
+ Case #2: 9
3
+ Case #3: 11
4
+ Case #4: 15
5
+ Case #5: 26
6
+ Case #6: 8812
7
+ Case #7: 8774
8
+ Case #8: 8756
9
+ Case #9: 27491
10
+ Case #10: 36411
11
+ Case #11: 15019
12
+ Case #12: 14591
13
+ Case #13: 5427
14
+ Case #14: 3944
15
+ Case #15: 9756
16
+ Case #16: 605
17
+ Case #17: 3025
18
+ Case #18: 5849
19
+ Case #19: 3192
20
+ Case #20: 13078
21
+ Case #21: 6533
22
+ Case #22: 16314
23
+ Case #23: 9331
24
+ Case #24: 189
25
+ Case #25: 920
26
+ Case #26: 16748
27
+ Case #27: 24532
28
+ Case #28: 91
29
+ Case #29: 13890
30
+ Case #30: 4846
31
+ Case #31: 3371
32
+ Case #32: 6489
33
+ Case #33: 8552
34
+ Case #34: 1818
35
+ Case #35: 12969
36
+ Case #36: 149
37
+ Case #37: 60
38
+ Case #38: 12903
39
+ Case #39: 10685
40
+ Case #40: 9150
41
+ Case #41: 3262
42
+ Case #42: 1595
43
+ Case #43: 13824
44
+ Case #44: 81
45
+ Case #45: 1071
46
+ Case #46: 1012
47
+ Case #47: 502
48
+ Case #48: 8756
49
+ Case #49: 497
50
+ Case #50: 512
51
+ Case #51: 2543
52
+ Case #52: 416
53
+ Case #53: 7446
54
+ Case #54: 6005
55
+ Case #55: 15052
56
+ Case #56: 19605
57
+ Case #57: 1252
58
+ Case #58: 8206
59
+ Case #59: 25244
60
+ Case #60: 1124
61
+ Case #61: 361
62
+ Case #62: 8077
63
+ Case #63: 1681
64
+ Case #64: 6060
65
+ Case #65: 1701
66
+ Case #66: 11117
67
+ Case #67: 2693
68
+ Case #68: 7593
69
+ Case #69: 9253
70
+ Case #70: 177
71
+ Case #71: 2861
72
+ Case #72: 10045
73
+ Case #73: 2511
74
+ Case #74: 2761
75
+ Case #75: 1723
76
+ Case #76: 482
77
+ Case #77: 11676
78
+ Case #78: 16966
79
+ Case #79: 4015
80
+ Case #80: 4553
81
+ Case #81: 713
82
+ Case #82: 10694
83
+ Case #83: 12851
84
+ Case #84: 3949
85
+ Case #85: 19783
86
+ Case #86: 67
87
+ Case #87: 22149
88
+ Case #88: 15807
89
+ Case #89: 514
90
+ Case #90: 17968
91
+ Case #91: 3162
92
+ Case #92: 312
93
+ Case #93: 1229
94
+ Case #94: 1075
95
+ Case #95: 3481
96
+ Case #96: 4546
97
+ Case #97: 213
98
+ Case #98: 7898
99
+ Case #99: 78
100
+ Case #100: 2891
101
+ Case #101: 2012
102
+ Case #102: 1908
103
+ Case #103: 2070
104
+ Case #104: 11511
105
+ Case #105: 585
106
+ Case #106: 3812
107
+ Case #107: 11050
108
+ Case #108: 1057
109
+ Case #109: 2438
110
+ Case #110: 230
111
+ Case #111: 14344
112
+ Case #112: 24529
113
+ Case #113: 8410
114
+ Case #114: 1661
115
+ Case #115: 4128
116
+ Case #116: 15214
117
+ Case #117: 4299
118
+ Case #118: 983
119
+ Case #119: 21284
120
+ Case #120: 8296
121
+ Case #121: 1771
122
+ Case #122: 9697
123
+ Case #123: 1059
124
+ Case #124: 4413
125
+ Case #125: 5259
126
+ Case #126: 3061
127
+ Case #127: 69
128
+ Case #128: 44
129
+ Case #129: 3428
130
+ Case #130: 3857
131
+ Case #131: 1439
132
+ Case #132: 10028
133
+ Case #133: 28577
134
+ Case #134: 979
135
+ Case #135: 116
136
+ Case #136: 628
137
+ Case #137: 405
138
+ Case #138: 6963
139
+ Case #139: 21
140
+ Case #140: 4596
141
+ Case #141: 4237
142
+ Case #142: 12634
143
+ Case #143: 16377
144
+ Case #144: 12038
145
+ Case #145: 109
146
+ Case #146: 52
147
+ Case #147: 1596
148
+ Case #148: 57
149
+ Case #149: 1249
150
+ Case #150: 13407
151
+ Case #151: 577
152
+ Case #152: 9905
153
+ Case #153: 19302
154
+ Case #154: 1695
155
+ Case #155: 1378
156
+ Case #156: 10398
157
+ Case #157: 109
158
+ Case #158: 21556
159
+ Case #159: 7114
160
+ Case #160: 19997
161
+ Case #161: 3106
162
+ Case #162: 1231
163
+ Case #163: 1902
164
+ Case #164: 29865
165
+ Case #165: 201
166
+ Case #166: 928
167
+ Case #167: 6361
168
+ Case #168: 20818
169
+ Case #169: 591
170
+ Case #170: 1729
171
+ Case #171: 6985
172
+ Case #172: 14782
173
+ Case #173: 3282
174
+ Case #174: 3935
175
+ Case #175: 6762
176
+ Case #176: 6063
177
+ Case #177: 856
178
+ Case #178: 5034
179
+ Case #179: 573
180
+ Case #180: 6627
181
+ Case #181: 6669
182
+ Case #182: 2433
183
+ Case #183: 211
184
+ Case #184: 589
185
+ Case #185: 376
186
+ Case #186: 11340
187
+ Case #187: 1972
188
+ Case #188: 4038
189
+ Case #189: 12784
190
+ Case #190: 2861
191
+ Case #191: 14958
192
+ Case #192: 4865
193
+ Case #193: 857
194
+ Case #194: 4837
195
+ Case #195: 10637
196
+ Case #196: 411
197
+ Case #197: 8735
198
+ Case #198: 5426
199
+ Case #199: 2115
200
+ Case #200: 5699
201
+ Case #201: 335
202
+ Case #202: 20860
203
+ Case #203: 3803
204
+ Case #204: 20437
205
+ Case #205: 29841
206
+ Case #206: 4470
207
+ Case #207: 194
208
+ Case #208: 11023
209
+ Case #209: 4031
210
+ Case #210: 10424
211
+ Case #211: 6847
212
+ Case #212: 473
213
+ Case #213: 6304
214
+ Case #214: 1201
215
+ Case #215: 629
216
+ Case #216: 8371
217
+ Case #217: 3149
218
+ Case #218: 84
219
+ Case #219: 20585
220
+ Case #220: 2301
221
+ Case #221: 17243
222
+ Case #222: 1673
223
+ Case #223: 1920
224
+ Case #224: 1960
225
+ Case #225: 1582
226
+ Case #226: 2987
227
+ Case #227: 5288
228
+ Case #228: 13014
229
+ Case #229: 911
230
+ Case #230: 854
231
+ Case #231: 832
232
+ Case #232: 2482
233
+ Case #233: 1828
234
+ Case #234: 13224
235
+ Case #235: 21
236
+ Case #236: 712
237
+ Case #237: 14188
238
+ Case #238: 7393
239
+ Case #239: 11388
240
+ Case #240: 7482
241
+ Case #241: 2847
242
+ Case #242: 4123
243
+ Case #243: 14069
244
+ Case #244: 1009
245
+ Case #245: 25057
246
+ Case #246: 1059
247
+ Case #247: 12862
248
+ Case #248: 5596
249
+ Case #249: 6062
250
+ Case #250: 1956
251
+ Case #251: 21
252
+ Case #252: 2523
253
+ Case #253: 361
254
+ Case #254: 233
255
+ Case #255: 3824
256
+ Case #256: 2953
257
+ Case #257: 13889
258
+ Case #258: 3942
259
+ Case #259: 6759
260
+ Case #260: 1545
261
+ Case #261: 5651
262
+ Case #262: 4665
263
+ Case #263: 31
264
+ Case #264: 853
265
+ Case #265: 5826
266
+ Case #266: 20405
267
+ Case #267: 7706
268
+ Case #268: 26556
269
+ Case #269: 37
270
+ Case #270: 143
271
+ Case #271: 3938
272
+ Case #272: 977
273
+ Case #273: 81
274
+ Case #274: 9834
275
+ Case #275: 11271
276
+ Case #276: 2309
277
+ Case #277: 1945
278
+ Case #278: 10732
279
+ Case #279: 9839
280
+ Case #280: 389
281
+ Case #281: 12091
282
+ Case #282: 4845
283
+ Case #283: 2144
284
+ Case #284: 439
285
+ Case #285: 13056
286
+ Case #286: 10592
287
+ Case #287: 2083
288
+ Case #288: 5505
289
+ Case #289: 9785
290
+ Case #290: 289
291
+ Case #291: 161
292
+ Case #292: 1736
293
+ Case #293: 5432
294
+ Case #294: 2745
295
+ Case #295: 9092
296
+ Case #296: 5091
297
+ Case #297: 1158
298
+ Case #298: 18546
299
+ Case #299: 411
300
+ Case #300: 1042
301
+ Case #301: 4056
302
+ Case #302: 2093
303
+ Case #303: 6747
304
+ Case #304: 285
305
+ Case #305: 44
2016/round1/boomerang_tournament.html ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <p>
2
+ This weekend, the long-awaited BIT (Boomerang Invitational Tournament) will be taking place!
3
+ <strong>N</strong> of the finest boomerangists will be competing in a randomly-seeded single-elimination bracket.
4
+ </p>
5
+
6
+ <p>
7
+ For those unfamiliar with this tournament format, the process can be modelled as follows:
8
+ </p>
9
+
10
+ <p>
11
+ <ol>
12
+ <li> The <strong>N</strong> competitors are arranged in a queue (an ordered list), in some order </li>
13
+ <li> If the queue currently contains only 1 competitor, the tournament ends with them as the champion </li>
14
+ <li> Otherwise, the first 2 competitors in the front of the queue are removed, and they play a match against one another </li>
15
+ <li> The winner of that match is re-inserted into the queue, at the back </li>
16
+ <li> Repeat from step 2 </li>
17
+ </ol>
18
+ </p>
19
+
20
+ <p>
21
+ The one-on-one matches in this tournament are, of course, boomerang duels to the death.
22
+ If the <strong>i</strong>th and <strong>j</strong>th competitors face off against one another, the <strong>i</strong>th competitor will win if
23
+ <strong>W<sub>i,j</sub></strong> = 1. Otherwise, if <strong>W<sub>i,j</sub></strong> = 0, the <strong>j</strong>th competitor will win.
24
+ Note that, for all (1 &le; <strong>i</strong>, <strong>j</strong> &le; <strong>N</strong>),
25
+ <strong>W<sub>i,j</sub></strong> = 0 or 1, and <strong>W<sub>i,i</sub></strong> = 0 (no one will play against themselves anyway),
26
+ and <strong>W<sub>i,j</sub></strong> &ne; <strong>W<sub>j,i</sub></strong> (if <strong>i</strong> &ne; <strong>j</strong>).
27
+ Those are the only constraints. It's possible that, for example, competitor A can beat B, B can beat C, and C can beat A.
28
+ </p>
29
+
30
+ <p>
31
+ Once the tournament is over, each boomerangist is given a placing (even if they didn't survive the competition). A given competitor <strong>c</strong>'s placing is an
32
+ integer one greater than the number of competitors who won strictly more matches than <strong>c</strong> did.
33
+ </p>
34
+
35
+ <p>
36
+ For each boomerangist, you'd like to know both the best (smallest) and the worst (largest) placing they could possibly end up with,
37
+ given that the initial ordering of the competitors (in step 1 of the tournament) is unknown.
38
+ </p>
39
+
40
+
41
+
42
+ <h3>Input</h3>
43
+ <p>
44
+ Input begins with an integer <strong>T</strong>, the number of tournaments.
45
+ For each tournament, there is first a line containing the integer <strong>N</strong>.
46
+ Then follow <strong>N</strong> lines, the <strong>i</strong>th of which contains the space-separated integers
47
+ <strong>W<sub>i,1</sub></strong> through <strong>W<sub>i,N</sub></strong>.
48
+ </p>
49
+
50
+
51
+ <h3>Output</h3>
52
+ <p>
53
+ For the <strong>i</strong>th tournament, print a line containing "Case #<strong>i</strong>: " followed by
54
+ <strong>N</strong> lines that each contain two space-separated integers. The first integer on the <strong>i</strong>th line
55
+ should be the best possible placing for the <strong>i</strong>th competitor, and the second should be the worst possible placing.
56
+ </p>
57
+
58
+
59
+ <h3>Constraints</h3>
60
+ <p>
61
+ 1 &le; <strong>T</strong> &le; 250 <br />
62
+ <strong>N</strong> = 2<sup><strong>K</strong></sup> where <strong>K</strong> is an integer and 0 &le; <strong>K</strong> &le; 4 <br />
63
+ </p>
64
+
65
+
66
+
67
+ <h3>Explanation of Sample</h3>
68
+ <p>
69
+ In the second tournament, the first competitor will always beat the second competitor, so the first competitor will finish in 1st place, and the other in 2nd place.
70
+
71
+ In the third tournament, the first competitor never loses, so they will finish in 1st place. The fourth competitor never wins, so they will finish tied for 3rd place with
72
+ the other competitor who loses their initial match.
73
+
74
+ The other two competitors will either lose their first match (if initially paired with the first competitor) or their second match (if initially paired with the fourth competitor),
75
+ so they can each finish in 2nd place, or tied for 3rd place.
76
+ </p>
77
+
2016/round1/boomerang_tournament.in ADDED
@@ -0,0 +1,2395 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ This weekend, the long-awaited BIT (Boomerang Invitational Tournament) will be
2
+ taking place! **N** of the finest boomerangists will be competing in a
3
+ randomly-seeded single-elimination bracket.
4
+
5
+ For those unfamiliar with this tournament format, the process can be modelled
6
+ as follows:
7
+
8
+ 1. The **N** competitors are arranged in a queue (an ordered list), in some order
9
+ 2. If the queue currently contains only 1 competitor, the tournament ends with them as the champion
10
+ 3. Otherwise, the first 2 competitors in the front of the queue are removed, and they play a match against one another
11
+ 4. The winner of that match is re-inserted into the queue, at the back
12
+ 5. Repeat from step 2
13
+
14
+ The one-on-one matches in this tournament are, of course, boomerang duels to
15
+ the death. If the **i**th and **j**th competitors face off against one
16
+ another, the **i**th competitor will win if **Wi,j** = 1. Otherwise, if
17
+ **Wi,j** = 0, the **j**th competitor will win. Note that, for all (1 ≤ **i**,
18
+ **j** ≤ **N**), **Wi,j** = 0 or 1, and **Wi,i** = 0 (no one will play against
19
+ themselves anyway), and **Wi,j** ≠ **Wj,i** (if **i** ≠ **j**). Those are the
20
+ only constraints. It's possible that, for example, competitor A can beat B, B
21
+ can beat C, and C can beat A.
22
+
23
+ Once the tournament is over, each boomerangist is given a placing (even if
24
+ they didn't survive the competition). A given competitor **c**'s placing is an
25
+ integer one greater than the number of competitors who won strictly more
26
+ matches than **c** did.
27
+
28
+ For each boomerangist, you'd like to know both the best (smallest) and the
29
+ worst (largest) placing they could possibly end up with, given that the
30
+ initial ordering of the competitors (in step 1 of the tournament) is unknown.
31
+
32
+ ### Input
33
+
34
+ Input begins with an integer **T**, the number of tournaments. For each
35
+ tournament, there is first a line containing the integer **N**. Then follow
36
+ **N** lines, the **i**th of which contains the space-separated integers
37
+ **Wi,1** through **Wi,N**.
38
+
39
+ ### Output
40
+
41
+ For the **i**th tournament, print a line containing "Case #**i**: " followed
42
+ by **N** lines that each contain two space-separated integers. The first
43
+ integer on the **i**th line should be the best possible placing for the
44
+ **i**th competitor, and the second should be the worst possible placing.
45
+
46
+ ### Constraints
47
+
48
+ 1 ≤ **T** ≤ 250
49
+ **N** = 2**K** where **K** is an integer and 0 ≤ **K** ≤ 4
50
+
51
+ ### Explanation of Sample
52
+
53
+ In the second tournament, the first competitor will always beat the second
54
+ competitor, so the first competitor will finish in 1st place, and the other in
55
+ 2nd place. In the third tournament, the first competitor never loses, so they
56
+ will finish in 1st place. The fourth competitor never wins, so they will
57
+ finish tied for 3rd place with the other competitor who loses their initial
58
+ match. The other two competitors will either lose their first match (if
59
+ initially paired with the first competitor) or their second match (if
60
+ initially paired with the fourth competitor), so they can each finish in 2nd
61
+ place, or tied for 3rd place.
62
+