tourist's blog

By tourist, 4 months ago, In English,

XIX Open Cup Grand Prix of Gomel takes place on Sunday, February 10, 2019, at 11:00 AM Petrozavodsk time.

The links to the contest:

You need an Open Cup login to participate.

The Division 1 contest also serves as the open qualifying contest for MosCode Festival 2019.

I'm the writer of all the problems. Let's discuss them here after the contest!

 
 
 
 
  • Vote: I like it
  • +173
  • Vote: I do not like it

»
4 months ago, # |
  Vote: I like it -38 Vote: I do not like it

How you are able to come up with such complex solution so easily

»
4 months ago, # |
  Vote: I like it +13 Vote: I do not like it

When I enter the link and the OpenCup login it says "The virtual contest is in progress. You are not allowed to participate". Is it the same for everybody?

  • »
    »
    4 months ago, # ^ |
      Vote: I like it +21 Vote: I do not like it

    Which OpenCup login do you use?

    • »
      »
      »
      4 months ago, # ^ |
        Vote: I like it +8 Vote: I do not like it

      zagreb02 we used it for the first part of the sesaon without any problems.

      • »
        »
        »
        »
        4 months ago, # ^ |
          Vote: I like it +16 Vote: I do not like it

        Hm, maybe its because start time (11:00) was not set when you looked at the contest?

        • »
          »
          »
          »
          »
          4 months ago, # ^ |
            Vote: I like it +8 Vote: I do not like it

          Probably, now everything works, thanks.

  • »
    »
    4 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Same problem again, 15 minutes till contest!

    • »
      »
      »
      4 months ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Same problem right now?

»
4 months ago, # |
  Vote: I like it +5 Vote: I do not like it

How to solve F,B?

  • »
    »
    4 months ago, # ^ |
      Vote: I like it +30 Vote: I do not like it

    F: realize that vertices in L(L(G)) correspond to pairs of adjacent edges in G, and edges in L(L(G)) connect pairs that have a common edge in G.

    For each edge e in G, consider pairs including e. Can you find how many connected components these pairs would be forming at the moment if we ran Kruskal's algorithm on L(L(G))? If you can, then you know the contribution of e to the result.

  • »
    »
    4 months ago, # ^ |
      Vote: I like it +8 Vote: I do not like it

    B: greedy. Very roughly speaking, you want team A to beat team B on penalty and, alternately, team B to beat team A on the number of problems (or vice versa). How would you achieve that?

»
4 months ago, # |
  Vote: I like it +49 Vote: I do not like it

Setting problem A, I pursued one goal... Prime New Year Contest 2019.

Good job, wxhtxdy!

  • »
    »
    4 months ago, # ^ |
      Vote: I like it +5 Vote: I do not like it

    How to solve I. I could realise that we need to find scc's in graph where i->j if j is preferred over i. And take problems from sink onwards. How to construct them fast. Or is the idea totally different?

    • »
      »
      »
      4 months ago, # ^ |
        Vote: I like it +8 Vote: I do not like it

      I don't know how to construct SCC's fast either :)

      The idea is to take the last p vertices of any hamiltonian path.

      • »
        »
        »
        »
        4 months ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        Am I correct in saying that a suitable subset can be found in O(NK) using the quickselect algorithm as opposed to O(NK log N) from sorting?

      • »
        »
        »
        »
        4 months ago, # ^ |
          Vote: I like it +13 Vote: I do not like it

        How did you write the checker for this problem?

        • »
          »
          »
          »
          »
          4 months ago, # ^ |
            Vote: I like it +3 Vote: I do not like it

          As I remember, he precomputed the SCC in O(n2) time, and fed them to the checker :D

        • »
          »
          »
          »
          »
          4 months ago, # ^ |
            Vote: I like it +3 Vote: I do not like it

          That's a good question :) I precalculated SCC's in O(nk2) and provided them to the checker in the answer file.

      • »
        »
        »
        »
        4 months ago, # ^ |
        Rev. 3   Vote: I like it 0 Vote: I do not like it

        I can see how to find a hamiltonian path in nlogn, but still I can't see why that's an answer. Can you please explain?

        Upd. Actually this is easy to map that top p nodes in hamiltonian path is also top p nodes in scc, but still I feel it's quite unintuitive to jump from scc to hamiltonian. May be knowing/coming up the fact that a complete directed graph has a hamiltonian path was the main key to the solution? I am wondering what was your motivation to sort / hamiltonian path?

        • »
          »
          »
          »
          »
          4 months ago, # ^ |
            Vote: I like it +26 Vote: I do not like it

          You can "move" any subset of size p along the hamiltonian path to get to the last p vertices in a finite number of steps -- each with non-zero probability. Hence for any time t large enough, the last p vertices of your ham. path can be the selected subset there with some ε probability.

    • »
      »
      »
      4 months ago, # ^ |
        Vote: I like it +18 Vote: I do not like it

      We had the same idea, you would be a bit disappointed looking at our solution though...

      Spoiler
      Why it works
  • »
    »
    4 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Is the multipoint evaluation and divide and conquer on the tree required in the expected solution? I didn't find any more clever way to solve it.

»
4 months ago, # |
  Vote: I like it +29 Vote: I do not like it

Very nice problems, thank you!

»
4 months ago, # |
  Vote: I like it 0 Vote: I do not like it

How to solve G ?

  • »
    »
    4 months ago, # ^ |
      Vote: I like it +16 Vote: I do not like it

    Let f(i, x) be the length of LIS of a1, a2, ..., ai that contains only integers up to x. Similarly, let g(i, x) be the length of LIS of ai + 1, ai + 2, ..., an that contains only integers larger than x.

    For each i, you want to find the maximum of f(i, x) + g(i + k, x). You can maintain a segment tree of these sums for all x, then moving i forward by 1 can be done with O(1) modifications.

»
4 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Thanks for nice problems :)

How to solve D? Using some clever trick of power series?

  • »
    »
    4 months ago, # ^ |
      Vote: I like it +30 Vote: I do not like it

    Just some typical tricks. Let A(x) be the GF of numbers. .

    The answer should be

    The last four terms can be calculated by brute forces. The time complexity is O(n3).

    The first term can be calculated by "meet in middle". This part is .

    • »
      »
      »
      4 months ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Thanks for replying!

      I couldn't figure out how to calculate s-th coefficient of the first term by "meet in middle" in that order... Would you give me the details of this part?

      • »
        »
        »
        »
        4 months ago, # ^ |
          Vote: I like it +20 Vote: I do not like it

        Let . The answer is .

        You can use the formula to split the binomial coefficients into two parts.

        • »
          »
          »
          »
          »
          4 months ago, # ^ |
            Vote: I like it 0 Vote: I do not like it

          I have never thought about binomial coefficients with negative a... Now I can figure out the solution, thank you! :)

»
4 months ago, # |
  Vote: I like it 0 Vote: I do not like it

How to solve E? Some sort of integration?

  • »
    »
    4 months ago, # ^ |
      Vote: I like it +18 Vote: I do not like it

    Consider 10 lines that pass through two points. Roughly speaking, for each halfline, we are only interested in the direction of the halfline relative to these lines. Thus, essentially, there are only 20 choices for each halfline, and we can brute force all 205 combinations.

    The only problematic situation is when we choose the same direction for multiple halflines. In this case, if we assign the same directions for k halflines, the probability that these halflines are disjoint is 1 / k!, so divide the probability by k!.

»
4 months ago, # |
  Vote: I like it +4 Vote: I do not like it

I don't have login id. Is there any other link from where i download problem set or can see problems?

»
4 months ago, # |
  Vote: I like it +3 Vote: I do not like it

Slightly unrelated question regarding moscode: If we've qualified (and it seems to be the case from what I could find that you count as qualified if you qualified for the world finals), is there any way to take it online, unofficially? I've tried to find a blog about moscode but could only find the one last year, so I hoped that I could get an answer here

  • »
    »
    4 months ago, # ^ |
      Vote: I like it +10 Vote: I do not like it

    You can participate in the Open Cup round.

»
4 months ago, # |
  Vote: I like it +31 Vote: I do not like it

How to solve J?

»
3 months ago, # |
  Vote: I like it 0 Vote: I do not like it

How to solve C?