Hello!
Informal contest Codeforces Testing Round #2 is scheduled on 10/29/2011 01:00PM (UTC). We will test the latest innovations on Codeforces that they do not affect the contests. If not, we will fix it quickly :) So, this round will take place "as is", no warranty about it.
Problems for the round may be famous to someone, but I'll try to make them such not for any of you. It will be about 4 problems, as quite simple and something more tricky.
I say thanks in advance to all those who will come and test the system. Thank you!
The contest moved to start on 10/29/2011 01:00PM (UTC) (it has been announced to start on other time, be careful).
It will be unrated round.
Thank you all for your help. I think it turned out pretty fun for you and useful for us!
MikeMirzayanov
Will it be rated?
Edit: To those who minused this, when I originally asked this question, the "It will be unrated round" part wasn't present in the text above (this was added later), which is why I asked it.
I have tried enough but I cannot understand problem C.
Now taht the contest is over could someone explain me what the problem wanted to say.
Find the largest complete graph with at most N edges.
At this view, a Day is actually a node, a man is an edge, the problem then becomes so obvious
I didn't notice this until I saw hex539's post. I passed pro.C by a construction method
something like:
something like:
1 2 3 4 5 1 2 3 4 5 1 2 3 4 5
1 1 6 7 8 9 1 6 7 8 9
2 => 2 6 => 2 6 10 11 12
3 3 7 3 7 10
4 4 8 4 8 11
5 5 9 5 9 12 ...
I think it can be solved this way. For n=3 you have this solution:
Sorry wrong observation!.
http://www.codeforces.com/contest/125/standings/2/page/9
Thanks in advance.
The first element in any case goes to the first sequence.
Then for any two adjacent elements we have 4 variants of their placement - both in the first sequence, both are in the second one, or first of them is in the first sequence or the first is in the second sequence.
Every time we check each variant of partition, if at some stage we were not able to do so - no decision at all, otherwise continue. In the end we print the answer
Did you guys ACed it to explain solution here?
could you please explain the rest - it is not easy for me. if you know 2 numbers, say, A and B, from particular sequence, and there are lots numbers (2B-A) further in the sequence, how you deal with that situation. which one you take, which one - release for the second sequence?
Now, read the a[i] from left to right, put them in either one list or the other.
The problematic i are those for which a[i] could be in both lists.
If i=n, it doesn't matter which one. Otherwise, look at the difference a[i+1]-a[i]:
- If it's the difference of the first list, put a[i] in the first list.
- If it's the difference of the second list, put a[i] in the second list.
- Otherwise, a[i] is the end of the first list, a[i+1] is in the second.
See my submission here; the first and second list are called b and c.
a naive approach based on this observation is probably wrong
try
e.g.
k = 2
1 2 100
1 3 100
1 4 110
2 3 1
the right solution is (1,2),(2,3),(3,4)
The question in problem E is to find a minimum spanning tree, such that the degree of node 1 is equal to k.
It is easy to find if we don't have this additional constraint with k.
The trick is to modify the graph a bit so that the MST in the new graph is the one we are looking for.
Separate all the spanning trees into groups, depending on the degree of node 1.
Consider the MST within each group.
What happens if you increase by the same value x all the weights of edges incident to 1?
In group i, the MST is the same set of edges, but the optimal weight is now increased by i*x.
So the optimal weight of group i+1 increases more than that of group i:
(i+1)*x>i*x
So the MST of group k is the MST of the new graph with the right increment x. This increment can be found with binary search.
See the code by MBabin.
UPDATE: systems test are a bit too weak; some solutions break on this example:
4 3 3
2 1 62
3 2 3
4 2 27
Can anyone explain why this solution is correct?
UPD:Sorry, I already understand.
Can you please explain me?