I couldn't find a place to discuss this.

When will we get results? Is anyone confident with B or F?

# | User | Rating |
---|---|---|

1 | tourist | 3602 |

2 | LHiC | 3287 |

3 | Radewoosh | 3266 |

4 | W4yneb0t | 3181 |

5 | TakanashiRikka | 3178 |

6 | moejy0viiiiiv | 3122 |

7 | izrak | 3109 |

8 | anta | 3105 |

8 | Um_nik | 3105 |

8 | ershov.stanislav | 3105 |

# | User | Contrib. |
---|---|---|

1 | rng_58 | 178 |

2 | csacademy | 167 |

3 | tourist | 165 |

4 | Errichto | 164 |

4 | Petr | 164 |

6 | Swistakk | 158 |

7 | matthew99 | 152 |

8 | Zlobober | 151 |

9 | zscoder | 143 |

10 | GlebsHP | 137 |

Codeforces (c) Copyright 2010-2017 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Aug/20/2017 08:47:33 (c2).

Desktop version, switch to mobile version.

User lists

Name |
---|

I was wondering the same :).

I think my idea of B is right, but there could always be an implementation bug (especially since the sample cases were very small; I did not stress test my solution). What I did was for each subtree compute how much beacon time from the root you need and how much beacon time you have remaining if you need to traverse this entire subtree. And then do another dfs to determine final node you are going to end up in. The have/need for the parent structure is passed as a parameter to this function and have/need for the siblings can be calculated with prefixes and suffixes from the first calculation.

Hm, I have the same feeling about B (idea seems right, but could have bugs), but my solution does not have any prefixes and suffixes :)

Basically, for each vertex we compute the number of vertices a and the total power p in its subtree (we root the tree at 1). If p<a, then there's no solution. Now we look at complements: n-a and total_power-p. Let delta be n-a-(total_power-p). If delta>0, it means that the path from 1 to the final vertex must go at least delta steps towards our vertex. Now we have constraints like "the path to final vertex must go at least x steps towards vertex y", so with another dfs we can find all edges that must lie on the path to final vertex, and then we just check if they lie on one path, if yes, extend it down as much as possible, and finally check that total_power is enough for that traversal.

And that's exactly what happened: had a really tiny bug, more specifically that in the "if p < a, there's no solution" line above we should exclude the subtree corresponding to the root (full tree), since the root does not need to be entered. A one-line fix, and it passes in upsolving :)

Would've been really amazing to win after not being able to solve any problem for the first hour.

I had exactly the same bug! In addition, I also had an overflow, but with those two fixes my solution passes in upsolving.

Would not have meant a win for me (Gennady was just too fast for that), but for me a second place also counts as 'amazing' :).

Were you really not able to solve E for first hour :P?

"solve"

Solving E in one hour is pretty tough. Good thing all of us already "solved" the exact same problem about a dozen times already.

Seriously, what kind of problem-setting is this? "I made 5 problems and don't feel like making another one, just throw in Catalan numbers or something"

Well, I find the problem nice enough for the easiest problem. I've spent a couple of minutes thinking before I got the Catalan numbers idea. It seems I'm not the only one who haven't got the idea instantly, so the problem is ok.

I definitely agree, I read this problem and was like "wtf, did they just give me Catalan's number definition?" and spent more time convincing myself that there is no hidden trap here and it really is just Catalan than actually solving this problem :P. Especially after participating in dozen of Andrew Stankevich contests there shouldn't be anyone out there who doesn't know what Catalan numbers are xd. I don't know which definitions people that needed to think about it know (because Catalan's numbers have a lot), but what is described in statement is in my opinion best known one (maybe after slight change that Um_nik mentioned), so I see no point of posing that problem in a contest. At least I got a screen when I was leading, but that would be it for my today's achievements xD.

Yes. Well, I've been trying to solve D and E, since everybody was submitting them. I've briefly switched to F, implemented incorrect approach, and submitted it, but that took me probably 15 minutes or so. So the remaining ~1 hour before my first accepted run I spent on D and E, I think roughly equal — about half an hour for each. Since coding for E is trivial, all this half an hour was spent before noticing that those are Catalan numbers.

I guess I did not implement the slow solution and notice the pattern because of the logic that W4yneb0t alludes to: this is Yandex.Algorithm finals, they won't give a sequence that is OEISable :)

Ehm... Isn't it like the definition of Catalan numbers? Just assume that each player can take only one stone in one move but they don't have to alternate moves.

Yes, rub it in :)

I don't know what else to say. Yes, in hindsight it's obvious. But I still spent 30 minutes before seeing it.

Approximately in 2 hours from now there will be an award ceremony, after that the results will be unfrozen.

Btw, since there are also a number of people competing onsite, I think they will be announcing the results in some kind of award ceremony, which might take a while.

I also asked a question (using the messages) about when the results will become available a while a go, but haven't received an answer yet. I am afraid that whoever is answering the messages is now also busy with the award ceremony.

Formulas for calculating bonus penalty work awful at contests like this. I think getting -13, -6 or -0 (lol) minutes for blind submit is a joke. Maybe you should set a lower bound -20 or -40 minutes next time?

The choice between submitting open and blind shouldn't be obvious. Since almost everyone solved those 3 problems, you should be almost certain that your solution is correct, so you will have some incentive to submit blind even if the bonus is very low. Predicting whether a task will have -0 or -20 for a blind submission could also be considered a skill.

Is there a way for non-contestants to see (and try) the problems?

Yea, guys, how to see problems?

Maybe you can try here: https://contest.yandex.com/algorithm2017/contest/4737/enter/

So, does anyone have any ideas on how to solve F? Even solutions that timed out, but are still runing in reasonable time will be welcomed.

What is reasonable time for you? I think that obvious

O(6^{n}) can be sqeezed through TL with some hacks.If the dimension of linear space is big (close to

n) then for each number there are few corresponding subsets and for many branches it is obvious that Bob wins because he forbade all good subsets.If the dimension is small then:

1. The amount of numbers to check is not so big

2. If Alice already has some set of numbers

Xthenaand are essentially the same. If two numbers are the same then Alice only need one of them and she can guarantee that she will get one (after Bob take one, Alice take another). When the dimension is small we can significantly (or not) reduce search space.Also I have a hypothesis that in every state Alice can win for numbers in some linear space. If it is true then we can solve the problem in

O(3^{n}polynom(n)).For a faster solution, after making this observation, the problem becomes much easier:

observationLet span(X) denote the set of xors of a subset of X.

Suppose Alice currently has set A, and she wants to get k. Alice can win if and only if there exists two disjoint subsets B1 and B2 such that span(A+B1) = span(A+B2) and k is in span(A+B1).

We can use this fact with A = {} to get a simple winning condition for Alice.

After making that observation, there is a straightforward

O(3^{n}*n) solution. It's possible to speed up toO(2^{n}*poly(n)), but I didn't think it was easy to squeeze aO(6^{n}) solution, so that's why the bounds are so low.How to prove the solution of problem C? I know the solution is sort

x_{i}and add points start from largestx_{i}. But I cannot prove it.Let . Say, the input weights are sorted non-increasingly (

x_{1}≥x_{2}≥ ... ≥x_{n}). We want to show the existence of such that λ(y_{1}, ...,y_{n}) ≥ λ(x_{1}, ...,x_{n}) for . Then, λ(y_{1}, ...,y_{n}) is equal to the density of the subgraph containingkheaviest vertices.We'll take the input sequence of weights (

x_{1}, ...,x_{n}) and transform it into (y_{1}, ...,y_{n}). If already someklargest elements of (x_{i}) is equal to , we're done. In the opposite case, take two largest weightsx_{1},x_{a + 1}and say thatx_{1}=x_{2}= ... =x_{a}>x_{a + 1}=x_{a + 2}= ... =x_{a + b}>x_{a + b + 1}(assumex_{n + 1}= 0).Now, we want to transform (

x_{1}, ...,x_{n}) into (x_{1}', ...,x_{a + b}',x_{a + b + 1}, ...,x_{n}) so thatx_{1}' =x_{2}' = ... =x_{a}' ≥x_{a + 1}' =x_{a + 2}' = ... =x_{a + b}' ≥x_{a + b + 1}, the sum of weights is equal to 1, at least one of the inequalities is an equality, and λ((x_{i}')) ≥ λ((x_{i})). Now, the choice ofx_{1}' determines uniquely the new sequence of weights. Moreover, it's not hard to see that λ is a linear function onx_{1}'. It means it suffices either to minimizex_{1}' (in this casex_{a}' becomes equal tox_{a + 1}') or to maximizex_{1}' (in this casex_{a + b}' becomes equal tox_{a + b + 1}).A single step increased the value of λ and reduced the number of distinct non-zero weights in the sequence. We apply this step until a single such non-zero weight is left and in this way we arrive at the sought sequence (

y_{1}, ...,y_{n}).Thank you! I got the idea!

Somewhat more elementary proof. For simplicity consider the case

n= 4. Suppose thatx_{1}≥x_{2}≥x_{3}≥x_{4}, and λ =ax_{2}+bx_{3}+cx_{4}.When

x_{1}≥x_{2}≥x_{3}≥x_{4}andx_{1}+x_{2}+x_{3}+x_{4}= 1, it is natural to replace them with non-negativep,q,r,ssuch that . Then,This is a weighted harmonic mean of {(

a+b+c) / 4, (a+b) / 3,a/ 2, 0}. We can find subgraphs with density {(a+b+c) / 4, (a+b) / 3,a/ 2, 0} as you described.Here is a proof which seems most natural. We would like to find a subset

Asuch that , or equivalently |E(A)| ≥ λ |A|. LetA_{p}= {x_{i}|x_{i}≥p}. Then .Therefore we can find some

pfor which this quantity is nonnegative. (WhenA_{p}is empty, it contributes 0 to the sum so we can find some nonempty set.)