Skip to content

Commit 8af834e

Browse files
committed
srm 609
1 parent 8fa82f0 commit 8af834e

3 files changed

Lines changed: 368 additions & 0 deletions

File tree

TopCoder/SRM/609/LotteryTree.cpp

Lines changed: 297 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,297 @@
1+
// BEGIN CUT HERE
2+
3+
// END CUT HERE
4+
#include <algorithm>
5+
#include <iostream>
6+
#include <sstream>
7+
#include <string>
8+
#include <vector>
9+
#include <queue>
10+
#include <set>
11+
#include <map>
12+
#include <cstdio>
13+
#include <cstdlib>
14+
#include <cctype>
15+
#include <cmath>
16+
#include <string>
17+
#include <cstring>
18+
using namespace std;
19+
20+
// BEGIN CUT HERE
21+
#define ARRSIZE(x) (sizeof(x)/sizeof(x[0]))
22+
23+
template<typename T> void print( T a ) {
24+
cerr << a;
25+
}
26+
static void print( long long a ) {
27+
cerr << a << "L";
28+
}
29+
static void print( string a ) {
30+
cerr << '"' << a << '"';
31+
}
32+
template<typename T> void print( vector<T> a ) {
33+
cerr << "{";
34+
for ( int i = 0 ; i != a.size() ; i++ ) {
35+
if ( i != 0 ) cerr << ", ";
36+
print( a[i] );
37+
}
38+
cerr << "}" << endl;
39+
}
40+
template<typename T> void eq( int n, T have, T need ) {
41+
if ( have == need ) {
42+
cerr << "Case " << n << " passed." << endl;
43+
} else {
44+
cerr << "Case " << n << " failed: expected ";
45+
print( need );
46+
cerr << " received ";
47+
print( have );
48+
cerr << "." << endl;
49+
}
50+
}
51+
template<typename T> void eq( int n, vector<T> have, vector<T> need ) {
52+
if( have.size() != need.size() ) {
53+
cerr << "Case " << n << " failed: returned " << have.size() << " elements; expected " << need.size() << " elements.";
54+
print( have );
55+
print( need );
56+
return;
57+
}
58+
for( int i= 0; i < have.size(); i++ ) {
59+
if( have[i] != need[i] ) {
60+
cerr << "Case " << n << " failed. Expected and returned array differ in position " << i << ".";
61+
print( have );
62+
print( need );
63+
return;
64+
}
65+
}
66+
cerr << "Case " << n << " passed." << endl;
67+
}
68+
static void eq( int n, string have, string need ) {
69+
if ( have == need ) {
70+
cerr << "Case " << n << " passed." << endl;
71+
} else {
72+
cerr << "Case " << n << " failed: expected ";
73+
print( need );
74+
cerr << " received ";
75+
print( have );
76+
cerr << "." << endl;
77+
}
78+
}
79+
// END CUT HERE
80+
81+
#define REP(i,n) for(int i=0;i<(n);++i)
82+
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
83+
#define RFOR(i,a,b) for(int i=(a);i>=(b);--i)
84+
#define FOREACH(it,c) for(typeof((c).begin())it=(c).begin();it!=(c).end();++it)
85+
#define CLR(x) memset((x),0,sizeof((x)))
86+
typedef long long LL;
87+
typedef vector<int> VI;
88+
typedef vector<string> VS;
89+
90+
// BEGIN CUT HERE
91+
vector<string> split( const string& s, const string& delim =" " ) {
92+
vector<string> res;
93+
string t;
94+
for ( int i = 0 ; i != s.size() ; i++ ) {
95+
if ( delim.find( s[i] ) != string::npos ) {
96+
if ( !t.empty() ) {
97+
res.push_back( t );
98+
t = "";
99+
}
100+
} else {
101+
t += s[i];
102+
}
103+
}
104+
if ( !t.empty() ) {
105+
res.push_back(t);
106+
}
107+
return res;
108+
}
109+
110+
vector<int> splitInt( const string& s, const string& delim =" " ) {
111+
vector<string> tok = split( s, delim );
112+
vector<int> res;
113+
for ( int i = 0 ; i != tok.size(); i++ )
114+
res.push_back( atoi( tok[i].c_str() ) );
115+
return res;
116+
}
117+
// END CUT HERE
118+
119+
// BEGIN CUT HERE
120+
int s2i(string s) {
121+
stringstream ss;
122+
ss << s;
123+
int res;
124+
ss >> res;
125+
return res;
126+
}
127+
128+
string i2s(int n) {
129+
stringstream ss;
130+
ss << n;
131+
string res;
132+
ss >> res;
133+
return res;
134+
}
135+
// END CUT HERE
136+
#define MAXN 105
137+
#define _clr(x) memset(x,0xff,sizeof(int)*MAXN)
138+
139+
int match1[MAXN], match2[MAXN];
140+
141+
int hungary(int m,int n,int mat[][MAXN],int* match1,int* match2){
142+
int s[MAXN],t[MAXN],p,q,ret=0,i,j,k;
143+
for (_clr(match1),_clr(match2),i=0;i<m;ret+=(match1[i++]>=0))
144+
for (_clr(t),s[p=q=0]=i;p<=q&&match1[i]<0;p++)
145+
for (k=s[p],j=0;j<n&&match1[i]<0;j++)
146+
if (mat[k][j]&&t[j]<0){
147+
s[++q]=match2[j],t[j]=k;
148+
if (s[q]<0)
149+
for (p=j;p>=0;j=p)
150+
match2[j]=k=t[j],p=match1[k],match1[k]=j;
151+
}
152+
return ret;
153+
}
154+
155+
vector<int> children[MAXN];
156+
int P;
157+
map<int, int> mm[MAXN];
158+
159+
// for memoization, we use an associative array. mem[i][j] describes the
160+
// entry for node i. Where j is the number of sub-interval of length w
161+
// the number of sub-interval can be pretty large, hence why we do not
162+
// use a simple array. Note each mem[i] will need at most P values in the map<int,int>
163+
164+
bool doable(int i, int x, int j) {
165+
// interval length w = 1 / x
166+
// Can we put node i in interval [j/x , (j+1)/x] ?
167+
168+
if (mm[i].count(j) != 0) return mm[i][j];
169+
170+
// A leaf.
171+
// make sure there is no integer k such that k/p is strictly inside interval
172+
bool res = false;
173+
if (children[i].size() == 0) {
174+
res = true;
175+
FOR(k,1,P-1) {
176+
// Check if ( j/x < k/P < (j+1)/x):
177+
if ((P * j < x * k) && (x * k < P * (j + 1))) res = false;
178+
}
179+
} else {
180+
int g = children[i].size();
181+
int can[MAXN][MAXN];
182+
//memset(can, 1, sizeof(can));
183+
REP(b,g) {
184+
bool nontrivial = false;
185+
186+
// We want to know if a k exists such that k/P is between
187+
// the b-th sub-interval
188+
FOR(k,1,P-1) {
189+
// the b-th sub-interval starts at j/x + b /gx
190+
// and finishes at j/x + (b+1)/gx
191+
// (j/x is the start of node i's interval)
192+
193+
// Check if ( j/x + b/gx < k/P < j/x + (b+1)/gx
194+
// j*g*P + b*P <k*g*x< j*g*P+(b+1)*P
195+
if ((g * j * P + b * P < g * k * x) && (g * k * x < g * j * P + (b + 1) * P)) nontrivial = true;
196+
}
197+
198+
if (nontrivial) {
199+
REP(a,g) {
200+
can[a][b] = doable(children[i][a], x * g, j * g + b);
201+
}
202+
} else {
203+
REP(a,g) can[a][b] = true;
204+
}
205+
}
206+
int t = hungary(g, g, can, match1, match2);
207+
res = (t == g);
208+
}
209+
210+
return (mm[i][j] = res);
211+
}
212+
213+
class LotteryTree {
214+
public:
215+
string isFairTree(vector <int> tree, int _P) {
216+
P = _P;
217+
REP(i,MAXN) {
218+
children[i].clear();
219+
mm[i].clear();
220+
}
221+
REP(i,tree.size()) children[tree[i]].push_back(i + 1);
222+
return doable(0, 1, 0) ? "YES" : "NO";
223+
}
224+
};
225+
// BEGIN CUT HERE
226+
int main() {
227+
{
228+
int treeARRAY[] = {0, 0, 0};
229+
vector <int> tree( treeARRAY, treeARRAY+ARRSIZE(treeARRAY) );
230+
LotteryTree theObject;
231+
eq(0, theObject.isFairTree(tree, 3),"YES");
232+
}
233+
{
234+
int treeARRAY[] = {0, 0, 0, 1, 1, 2, 2, 3, 3};
235+
vector <int> tree( treeARRAY, treeARRAY+ARRSIZE(treeARRAY) );
236+
LotteryTree theObject;
237+
eq(1, theObject.isFairTree(tree, 2),"YES");
238+
}
239+
{
240+
int treeARRAY[] = {0, 0, 1, 1, 2, 2, 4, 4, 4};
241+
vector <int> tree( treeARRAY, treeARRAY+ARRSIZE(treeARRAY) );
242+
LotteryTree theObject;
243+
eq(2, theObject.isFairTree(tree, 3),"NO");
244+
}
245+
{
246+
int treeARRAY[] = {0, 0, 1, 1, 1, 3, 3, 3};
247+
vector <int> tree( treeARRAY, treeARRAY+ARRSIZE(treeARRAY) );
248+
LotteryTree theObject;
249+
eq(3, theObject.isFairTree(tree, 3),"NO");
250+
}
251+
{
252+
int treeARRAY[] = {0, 0, 0, 3, 0, 0, 3, 6, 3, 1, 0, 2, 0, 4, 6, 15, 1, 15, 11, 11, 1, 4, 11, 2, 11, 2, 6}
253+
;
254+
vector <int> tree( treeARRAY, treeARRAY+ARRSIZE(treeARRAY) );
255+
LotteryTree theObject;
256+
eq(4, theObject.isFairTree(tree, 6),"YES");
257+
}
258+
{
259+
int treeARRAY[] = {0, 1, 2, 3, 1, 1, 4, 4, 0, 1, 6, 9, 1, 12, 9, 2, 4, 8, 6, 13, 8, 5, 11, 12, 17,
260+
19, 13, 9, 3, 24, 30, 29, 28, 28, 11, 27, 2, 26, 6, 14, 8, 26, 15, 25, 33, 38,
261+
1, 24, 15, 43, 3, 39, 26, 8, 13, 50, 28, 8, 6, 27, 8, 38, 27, 50, 17, 50, 25,
262+
40, 7, 29, 22, 40, 2, 24, 22, 30, 33, 40, 19, 14, 26, 39, 5, 43, 7, 4};
263+
vector <int> tree( treeARRAY, treeARRAY+ARRSIZE(treeARRAY) );
264+
LotteryTree theObject;
265+
eq(5, theObject.isFairTree(tree, 9),"NO");
266+
}
267+
{
268+
int treeARRAY[] = {0, 1, 0, 0, 4, 0, 2, 2, 0, 2, 6, 1, 3, 6, 5, 9, 11, 13, 1, 10, 14, 4, 7, 21,
269+
16, 8, 25, 4, 5, 22, 25, 14, 12, 11, 12, 26, 21, 8, 2, 38, 3, 5, 4, 38, 27,
270+
35, 38, 30, 38, 9, 16, 36, 6, 10, 7, 27, 30, 33, 17, 26, 17, 10, 35, 10, 38,
271+
41, 15, 9, 3, 27, 8, 15, 38, 22, 41, 33, 33, 36, 30, 13, 18, 22, 18};
272+
vector <int> tree( treeARRAY, treeARRAY+ARRSIZE(treeARRAY) );
273+
LotteryTree theObject;
274+
eq(6, theObject.isFairTree(tree, 12),"YES");
275+
}
276+
{
277+
int treeARRAY[] = {0, 0, 2, 3, 4, 3, 2, 1, 8, 6, 8, 8, 2, 7, 14, 2, 8, 1, 11, 11, 12, 16, 12,
278+
19, 20, 13, 7, 12, 26, 11, 18, 19, 18, 20, 4, 9, 1, 1, 6, 16, 1, 35, 27, 24,
279+
37, 30, 36, 41, 32, 36, 8, 2, 6, 14, 41, 1, 35, 6, 30, 16, 12, 2, 35, 25, 50,
280+
13, 1, 24, 8, 32, 26, 50, 9, 19, 9, 20, 26, 27, 6, 12, 25, 9, 37, 37, 9} ;
281+
vector <int> tree( treeARRAY, treeARRAY+ARRSIZE(treeARRAY) );
282+
LotteryTree theObject;
283+
eq(7, theObject.isFairTree(tree, 7),"NO");
284+
}
285+
{
286+
int treeARRAY[] = {0, 0, 1, 0, 2, 3, 0, 0, 8, 5, 7, 5, 2, 12, 12, 14, 14, 13, 8, 2, 1, 7, 18,
287+
16, 8, 24, 18, 2, 24, 3, 11, 5, 24, 4, 34, 6, 31, 13, 38, 19, 4, 3, 22, 3,
288+
11, 12, 21, 34, 41, 8, 19, 4, 13, 29, 33, 8, 14, 50, 18, 45, 16, 50, 44, 50,
289+
38, 5, 43, 31, 29, 7, 6, 45, 38, 4, 19, 41, 50, 21, 44, 41, 43, 22, 33, 6, 8}
290+
;
291+
vector <int> tree( treeARRAY, treeARRAY+ARRSIZE(treeARRAY) );
292+
LotteryTree theObject;
293+
eq(8, theObject.isFairTree(tree, 12),"YES");
294+
}
295+
return 0;
296+
}
297+
// END CUT HERE

TopCoder/SRM/609/LotteryTree.html

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
<html><body bgcolor="#000000" text="#ffffff"><table><tr><td colspan="2"><h3>Problem Statement</h3></td></tr><tr><td>&#160;&#160;&#160;&#160;</td><td>You held a lottery and <b>P</b> people participated in it.
2+
Now you want to determine who won the lottery prize.
3+
<br></br>
4+
You have decided to choose the winner using a rooted tree.
5+
You are going to make a lottery with the tree as follows:
6+
<ul>
7+
<li>The participants are conveniently numbered from 1 to P, inclusive.</li>
8+
<li>First, you draw the tree onto a rectangular board in such a way that the tree satisfies the following conditions:
9+
<ul>
10+
<li>Each node of the tree corresponds to a small circle on the board.
11+
The circles are so small that you can ignore their size.</li>
12+
<li>Each edge of the tree corresponds to a line segment connecting two circles.
13+
No two edges are allowed to intersect. </li>
14+
<li>The root node must be drawn on the top edge of the board.</li>
15+
<li>For each node, all edges to its children must be going downwards. (In other words, the parent of a node must always be drawn above the node.)</li>
16+
<li>All of the leaves must be drawn on the bottom edge of the board.</li>
17+
</ul>
18+
19+
</li>
20+
<li>Next, you split the bottom edge of the board into <b>P</b> segments in such a way that each leaf belongs to exactly one segment.
21+
For each segment, you choose a different integer between 1 and <b>P</b>, inclusive, and write that integer into each of the leaves that belong to that segment.</li>
22+
23+
<li>Now, you will repeat the following process:
24+
Find an empty node X such that you have already written integers into all of its children.
25+
If there are multiple nodes with this property, choose one uniformly at random.
26+
Choose a child of X uniformly at random, and copy the integer written in the chosen child into X.
27+
28+
The process terminates once the root node contains an integer.</li>
29+
30+
</ul>
31+
You are given the int <b>P</b> and a vector &lt;int&gt; <b>tree</b> that describes the tree you will use.
32+
The tree has N nodes, conveniently numbered 0 through N-1.
33+
Node 0 is the root of the tree.
34+
For each other node, the number of its parent is smaller than its own number.
35+
More precisely, for each i between 1 and N-1, inclusive, <b>tree</b>[i-1] is the parent of node i.
36+
37+
You want to make the lottery fair.
38+
That is, you want to guarantee that each of the participants will have the same probability to win the lottery.
39+
To do that, you can choose how to draw the tree, and how to assign integers to its leaves (while following the above procedure).
40+
41+
Return "YES" (quotes for clarity) if you can make the lottery fair and "NO" otherwise.
42+
</td></tr><tr><td colspan="2"><h3>Definition</h3></td></tr><tr><td>&#160;&#160;&#160;&#160;</td><td><table><tr><td>Class:</td><td>LotteryTree</td></tr><tr><td>Method:</td><td>isFairTree</td></tr><tr><td>Parameters:</td><td>vector &lt;int&gt;, int</td></tr><tr><td>Returns:</td><td>string</td></tr><tr><td>Method signature:</td><td>string isFairTree(vector &lt;int&gt; tree, int P)</td></tr><tr><td colspan="2">(be sure your method is public)</td></tr></table></td></tr><tr><td colspan="2"><h3>Limits</h3></td></tr><tr><td>&#160;&#160;&#160;&#160;</td><td><table><tr><td>Time limit (s):</td><td>2.000</td></tr><tr><td>Memory limit (MB):</td><td>256</td></tr></table></td></tr><tr><td colspan="2"><h3>Constraints</h3></td></tr><tr><td align="center" valign="top">-</td><td><b>tree</b> will have between 2 and 100 elements, inclusive.</td></tr><tr><td align="center" valign="top">-</td><td>For each i, element i (0-based index) of <b>tree</b> will be between 0 and i, inclusive.</td></tr><tr><td align="center" valign="top">-</td><td><b>P</b> will be between 2 and 100, inclusive.</td></tr><tr><td align="center" valign="top">-</td><td>Each node that is not a leaf will have at least 2 children.</td></tr><tr><td colspan="2"><h3>Examples</h3></td></tr><tr><td align="center" nowrap="true">0)</td><td></td></tr><tr><td>&#160;&#160;&#160;&#160;</td><td><table><tr><td><table><tr><td><pre>{0, 0, 0}</pre></td></tr><tr><td><pre>3</pre></td></tr></table></td></tr><tr><td><pre>Returns: &quot;YES&quot;</pre></td></tr><tr><td><table><tr><td colspan="2">One of the ways to draw the tree is as follows:
43+
<br></br>
44+
<br></br>
45+
<img src="http://www.topcoder.com/contest/problem/LotteryTree/pic1.png"></img>
46+
</td></tr></table></td></tr></table></td></tr><tr><td align="center" nowrap="true">1)</td><td></td></tr><tr><td>&#160;&#160;&#160;&#160;</td><td><table><tr><td><table><tr><td><pre>{0, 0, 0, 1, 1, 2, 2, 3, 3}</pre></td></tr><tr><td><pre>2</pre></td></tr></table></td></tr><tr><td><pre>Returns: &quot;YES&quot;</pre></td></tr><tr><td><table><tr><td colspan="2">One of the ways to draw the tree is as follows:
47+
<br></br>
48+
<br></br>
49+
<img src="http://www.topcoder.com/contest/problem/LotteryTree/pic2-1.png"></img>
50+
<br></br>
51+
<br></br>
52+
Note that you cannot assign integers to the leaves as follows:
53+
<br></br>
54+
<br></br>
55+
<img src="http://www.topcoder.com/contest/problem/LotteryTree/pic2-2.png"></img></td></tr></table></td></tr></table></td></tr><tr><td align="center" nowrap="true">2)</td><td></td></tr><tr><td>&#160;&#160;&#160;&#160;</td><td><table><tr><td><table><tr><td><pre>{0, 0, 1, 1, 2, 2, 4, 4, 4}</pre></td></tr><tr><td><pre>3</pre></td></tr></table></td></tr><tr><td><pre>Returns: &quot;NO&quot;</pre></td></tr><tr><td><table><tr><td colspan="2">You would be able to make this tree fair if you were allowed to assign integers to leaves arbitrarily. However, given the additional restriction that each integer must be assigned to a consecutive segment of leaves, making this tree fair is not possible.</td></tr></table></td></tr></table></td></tr><tr><td align="center" nowrap="true">3)</td><td></td></tr><tr><td>&#160;&#160;&#160;&#160;</td><td><table><tr><td><table><tr><td><pre>{0, 0, 1, 1, 1, 3, 3, 3}</pre></td></tr><tr><td><pre>3</pre></td></tr></table></td></tr><tr><td><pre>Returns: &quot;NO&quot;</pre></td></tr><tr><td><table><tr><td colspan="2"></td></tr></table></td></tr></table></td></tr><tr><td align="center" nowrap="true">4)</td><td></td></tr><tr><td>&#160;&#160;&#160;&#160;</td><td><table><tr><td><table><tr><td><pre>{0, 0, 0, 3, 0, 0, 3, 6, 3, 1, 0, 2, 0, 4, 6, 15, 1, 15, 11, 11, 1, 4, 11, 2, 11, 2, 6}
56+
</pre></td></tr><tr><td><pre>6</pre></td></tr></table></td></tr><tr><td><pre>Returns: &quot;YES&quot;</pre></td></tr><tr><td><table><tr><td colspan="2"></td></tr></table></td></tr></table></td></tr><tr><td align="center" nowrap="true">5)</td><td></td></tr><tr><td>&#160;&#160;&#160;&#160;</td><td><table><tr><td><table><tr><td><pre>{0, 1, 2, 3, 1, 1, 4, 4, 0, 1, 6, 9, 1, 12, 9, 2, 4, 8, 6, 13, 8, 5, 11, 12, 17,
57+
19, 13, 9, 3, 24, 30, 29, 28, 28, 11, 27, 2, 26, 6, 14, 8, 26, 15, 25, 33, 38,
58+
1, 24, 15, 43, 3, 39, 26, 8, 13, 50, 28, 8, 6, 27, 8, 38, 27, 50, 17, 50, 25,
59+
40, 7, 29, 22, 40, 2, 24, 22, 30, 33, 40, 19, 14, 26, 39, 5, 43, 7, 4}</pre></td></tr><tr><td><pre>9</pre></td></tr></table></td></tr><tr><td><pre>Returns: &quot;NO&quot;</pre></td></tr><tr><td><table><tr><td colspan="2"></td></tr></table></td></tr></table></td></tr><tr><td align="center" nowrap="true">6)</td><td></td></tr><tr><td>&#160;&#160;&#160;&#160;</td><td><table><tr><td><table><tr><td><pre>{0, 1, 0, 0, 4, 0, 2, 2, 0, 2, 6, 1, 3, 6, 5, 9, 11, 13, 1, 10, 14, 4, 7, 21,
60+
16, 8, 25, 4, 5, 22, 25, 14, 12, 11, 12, 26, 21, 8, 2, 38, 3, 5, 4, 38, 27,
61+
35, 38, 30, 38, 9, 16, 36, 6, 10, 7, 27, 30, 33, 17, 26, 17, 10, 35, 10, 38,
62+
41, 15, 9, 3, 27, 8, 15, 38, 22, 41, 33, 33, 36, 30, 13, 18, 22, 18}</pre></td></tr><tr><td><pre>12</pre></td></tr></table></td></tr><tr><td><pre>Returns: &quot;YES&quot;</pre></td></tr><tr><td><table><tr><td colspan="2"></td></tr></table></td></tr></table></td></tr><tr><td align="center" nowrap="true">7)</td><td></td></tr><tr><td>&#160;&#160;&#160;&#160;</td><td><table><tr><td><table><tr><td><pre>{0, 0, 2, 3, 4, 3, 2, 1, 8, 6, 8, 8, 2, 7, 14, 2, 8, 1, 11, 11, 12, 16, 12,
63+
19, 20, 13, 7, 12, 26, 11, 18, 19, 18, 20, 4, 9, 1, 1, 6, 16, 1, 35, 27, 24,
64+
37, 30, 36, 41, 32, 36, 8, 2, 6, 14, 41, 1, 35, 6, 30, 16, 12, 2, 35, 25, 50,
65+
13, 1, 24, 8, 32, 26, 50, 9, 19, 9, 20, 26, 27, 6, 12, 25, 9, 37, 37, 9} </pre></td></tr><tr><td><pre>7</pre></td></tr></table></td></tr><tr><td><pre>Returns: &quot;NO&quot;</pre></td></tr><tr><td><table><tr><td colspan="2"></td></tr></table></td></tr></table></td></tr><tr><td align="center" nowrap="true">8)</td><td></td></tr><tr><td>&#160;&#160;&#160;&#160;</td><td><table><tr><td><table><tr><td><pre>{0, 0, 1, 0, 2, 3, 0, 0, 8, 5, 7, 5, 2, 12, 12, 14, 14, 13, 8, 2, 1, 7, 18,
66+
16, 8, 24, 18, 2, 24, 3, 11, 5, 24, 4, 34, 6, 31, 13, 38, 19, 4, 3, 22, 3,
67+
11, 12, 21, 34, 41, 8, 19, 4, 13, 29, 33, 8, 14, 50, 18, 45, 16, 50, 44, 50,
68+
38, 5, 43, 31, 29, 7, 6, 45, 38, 4, 19, 41, 50, 21, 44, 41, 43, 22, 33, 6, 8}
69+
</pre></td></tr><tr><td><pre>12</pre></td></tr></table></td></tr><tr><td><pre>Returns: &quot;YES&quot;</pre></td></tr><tr><td><table><tr><td colspan="2"></td></tr></table></td></tr></table></td></tr></table><p>This problem statement is the exclusive and proprietary property of TopCoder, Inc. Any unauthorized use or reproduction of this information without the prior written consent of TopCoder, Inc. is strictly prohibited. (c)2003, TopCoder, Inc. All rights reserved. </p></body></html>

TopCoder/SRM/609/README.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Editorial
2+
http://apps.topcoder.com/wiki/display/tc/SRM+609

0 commit comments

Comments
 (0)