Блог пользователя Aksenov239

Автор Aksenov239, история, 3 года назад, По-английски

Hello, everybody!

We would like to invite you to participate in the Mirror of The ICPC World Finals Moscow Invitational Contest. The original contest was made for the teams who cannot come to The World Finals in Moscow. They were competing for the medals and glory. The Invitational contest has already passed and the results will be revealed on October 5th.

The mirror contest will be held by almost standard ICPC rules with 10 to 14 problems. The difference from the traditional ICPC format is that your team can use three computers instead of one. The problems are expected to be of The World Finals difficulty. Also, the round will be unrated!

The problemset was prepared by NERC Jury Team with the help of many other people. The chief judge is Roman elizarov Elizarov. The jury members are Pavel PavelKunyavskiy Kunyavskiy, Georgy kgeorgiy Korneev, Evgeny eatmore Kapun, Ilya izban Zban, Niyaz niyaznigmatul Nigmatullin, Vasiliy SirShokoladina Mokin, Daniil danilka.pro Sagunov, Gennady tourist Korotkevich, Oleg snarknews Hristenko, Egor Egor Kulikov, Borys qwerty787788 Minaev, Pavel pashka Mavrin, Mike MikeMirzayanov Mirzayanov, Anton Paramonov, Bruce bmerry Merry, Zachary Friggstad Friggstad, Jakub Wojtaszczyk, David Van Brackle, and myself. (I hope I haven't missed somebody. :P)

I hope you will like the contest! Good luck and have fun!

UPD: The editorial is available here.

  • Проголосовать: нравится
  • +300
  • Проголосовать: не нравится

»
3 года назад, # |
  Проголосовать: нравится -81 Проголосовать: не нравится

Will we get certificate of participation???

»
3 года назад, # |
  Проголосовать: нравится +22 Проголосовать: не нравится

For the first time ICPC WF problems will get CF ratings (in problem-set page).

  • »
    »
    3 года назад, # ^ |
      Проголосовать: нравится +21 Проголосовать: не нравится

    Which will probably be broken anyway, as the problem X-rated guy can solve in 5 hours is a bit harder than a problem X-rated guy can solve in 2...

    • »
      »
      »
      3 года назад, # ^ |
        Проголосовать: нравится -44 Проголосовать: не нравится

      Most contestants participate in teams, which increases their rating by 100-200, which more or less takes care of the fact you pointed out. But for solo participants, it won't reflect that, it's true.

»
3 года назад, # |
  Проголосовать: нравится +177 Проголосовать: не нравится

Problems are cool, recommend to participate, but if you are not div1, it will be too hard and sad for you.

»
3 года назад, # |
  Проголосовать: нравится -9 Проголосовать: не нравится

Can anyone tell the maximum team size please? Thanks ;_;

»
3 года назад, # |
  Проголосовать: нравится +17 Проголосовать: не нравится
what does it mean?
»
3 года назад, # |
  Проголосовать: нравится +2 Проголосовать: не нравится

Anyone wants to team up with me ?

»
3 года назад, # |
  Проголосовать: нравится +21 Проголосовать: не нравится

Where can I find the live leaderboard of ICPC WF?

»
3 года назад, # |
  Проголосовать: нравится +43 Проголосовать: не нравится

How to solve L ?

  • »
    »
    3 года назад, # ^ |
    Rev. 5   Проголосовать: нравится +58 Проголосовать: не нравится
    Hint 1
    Hint 2
    Hint 3
    Hint 4
    Our Solution
  • »
    »
    3 года назад, # ^ |
      Проголосовать: нравится +14 Проголосовать: не нравится

    Here is a very overcomplicated (I have no idea if this indeed is the solution) and ugly (we managed to fit this in 1880ms) idea.

    We use binary search for the answer. For each $$$W$$$, we check if $$$W$$$ can be the width when we finish the run (hence answer will be $$$W - \sum c_i$$$)

    To check for each $$$W$$$, we use union-find and check the nodes in reverse order. We start with $$$W$$$, and subtract weight every time we eat candy. When we eat sufficiently many candies, width is reduced enough and new edges are now open (thus UF works).

    Although we don't know where to start (i.e, in the original problem, where to end), we can check as "if we started at $$$x$$$, can we reach $$$y$$$" with UF.

    To do this, we maintain for each component of UF, set of next-extendable vertices. When we eat a candy, we have information in the form of "by taking this component as a whole, we can decrease our width by $$$x$$$" and for all extendable vertices from this component, we can merge those vertices with current component, increasing $$$x$$$ and possibly opening new edges.

    When merging, this 'set of next extendable vertices' should also be merged. Here we use small-to-large trick. Also the set can be maintained as priority queues.

    Summary : Binary search with (DSU + priority queue extendable vertices + small to large). Time complexity is $$$O(n \alpha(n) \log^2 n \log 10^{9})$$$ which looks horrendous.

    • »
      »
      »
      3 года назад, # ^ |
        Проголосовать: нравится +11 Проголосовать: не нравится

      This idea can be implemented without binary searching for the answer: at every step of your DSU process, just pick the edge that allows for the greatest initial width. Then, the minimum of these allowed initial widths is the final answer. This leads to an $$$\mathcal{O}(n \log^2 n)$$$ solution; my code passes in about 200ms.

    • »
      »
      »
      3 года назад, # ^ |
        Проголосовать: нравится 0 Проголосовать: не нравится

      Thanks!

»
3 года назад, # |
  Проголосовать: нравится +53 Проголосовать: не нравится

Will you make others' solutions visible?

»
3 года назад, # |
Rev. 2   Проголосовать: нравится +36 Проголосовать: не нравится

Where can I upsolve the problems?

Also, Is this the intended solution in M? (It passed)

Spoiler
  • »
    »
    3 года назад, # ^ |
    Rev. 2   Проголосовать: нравится +8 Проголосовать: не нравится

    In fact, only output 0 and 1 is enough to pass M. XD

    • »
      »
      »
      3 года назад, # ^ |
        Проголосовать: нравится 0 Проголосовать: не нравится

      How to find the proper 01 string ?

      • »
        »
        »
        »
        3 года назад, # ^ |
        Rev. 2   Проголосовать: нравится +10 Проголосовать: не нравится

        I have used evolutionary algorithms and I got 86%:

        code
        • »
          »
          »
          »
          »
          3 года назад, # ^ |
            Проголосовать: нравится +10 Проголосовать: не нравится

          these are the bins of some solutions:

          1. 4 9 14 19 29
          2. 4 9 15 21 31
          3. 3 7 12 19 31
          4. 4 8 13 21 32
»
3 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

How to solve H ?

  • »
    »
    3 года назад, # ^ |
    Rev. 3   Проголосовать: нравится 0 Проголосовать: не нравится

    Pair up brackets using a stack and build such tree:

    Spoiler

    Note: 0 is root there.

    How can it be done? When you meet '(', add its ID to stack, When you meet ')' pop the top of the stack and add this ID to its parent. When you meet '-' just ignore it and the next character.

    Now let's write recursive function int get_order(int ID). It works lazily. If order is already computed return it. Otherwise if there are no children of this vertex then the order is $$$0$$$. Otherwise let's merge all the children into parent's order.

    The answer is get_order(0).

    Code: 130485662

    Code
»
3 года назад, # |
  Проголосовать: нравится +60 Проголосовать: не нравится

Will there are be a mirror of the ICPC WF on the 5th of October?

»
3 года назад, # |
  Проголосовать: нравится +13 Проголосовать: не нравится

How to solve B ?

  • »
    »
    3 года назад, # ^ |
      Проголосовать: нравится +10 Проголосовать: не нравится

    Assume the ranges are $$$[l_i,r_i]$$$ where $$$l_i < r_i$$$. You can show that $$$[l_j,r_j]$$$ intersects this if ( $$$l_j \leq l_i$$$ and $$$l_i \leq r_j \leq r_i$$$ ) or ( $$$l_i \leq l_j \leq r_i$$$ and $$$r_i \leq r_j$$$ ).

    Now, we will draw these $$$[l_i,r_i]$$$ on the eucledian plane. We notice that those intervals that intersects $$$[l_i,r_i]$$$ actually form 2 rectangles on this plane. So we can just maintain some 2d data structure. Since one side of the rectangles extend to infinity, we can use a priority queue as one of the layers of this 2d data structure.

    code

»
3 года назад, # |
  Проголосовать: нравится +31 Проголосовать: не нравится

When the practice submission will be allowed?

»
3 года назад, # |
Rev. 2   Проголосовать: нравится +10 Проголосовать: не нравится

has someone solved L with offline queries of searching the narrowest edge on a path in mst? my approach with sqrt-decomposition is getting wa3 and I don't know whether it's bug or solution is wrong

»
3 года назад, # |
  Проголосовать: нравится +21 Проголосовать: не нравится

It is so funny that my team's solution for K is the fastest. We just did $$$N=61$$$ maximum independent set and copied the fastest solution for MIS from yosupo's judge. Surpringly, it ACs.

code

»
3 года назад, # |
Rev. 2   Проголосовать: нравится +21 Проголосовать: не нравится

How to solve G?

+Is there a scoreboard for official WF Invitational Contest?

  • »
    »
    3 года назад, # ^ |
    Rev. 2   Проголосовать: нравится +10 Проголосовать: не нравится

    It is still frozen. It should be revealed on October 5th as far as I understand.

  • »
    »
    3 года назад, # ^ |
    Rev. 3   Проголосовать: нравится +36 Проголосовать: не нравится

    For each subtree $$$x$$$ and for each leave $$$v$$$ in $$$x$$$, we want to compute the probability of $$$v$$$ to be the winner in that subtree.

    To do so, we simply need to merge two subtrees, which turns the problem into computing ($$$\sum_i \frac{b_i x_j}{y_i+x_j}$$$) for every $$$j$$$. For the part $$$y_i>x_j$$$, we divide the denominator and numerator both by $$$y_i$$$ (now $$$0<\frac{x_j}{y_i}<1$$$), then use the Taylor series of $$$1/(1+x)$$$ around $$$1/2$$$. For the part $$$y_i<x_j$$$, we could divide denominator and numerator both by $$$x_j$$$ and do similarly.

  • »
    »
    3 года назад, # ^ |
      Проголосовать: нравится +18 Проголосовать: не нравится

    Here is the official scoreboard :)

  • »
    »
    3 года назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    We updated the editorial with the editorial of G.

    Thanks for participating!

»
3 года назад, # |
  Проголосовать: нравится +95 Проголосовать: не нравится

A dragon curve related problem :PA2011 5A szl

Problem D is much easier than this PA problem. Since you only need to locate the point here. During the contest, I just found the code I wrote about 10 years ago and passed.

BTW, in this PA problem, you need to answer the number of consecutive lines in a strip. I tried hard and didn't solve it when I was young. And I didn't have another try these years, so I still don't know how to solve it yet.

If anyone knows the solution to this problem, please let me know. Thanks.

  • »
    »
    3 года назад, # ^ |
      Проголосовать: нравится +20 Проголосовать: не нравится

    I love how easily you said " I just found the code I wrote about 10 years ago and passed"

    I can't even find my code from last month.

»
3 года назад, # |
  Проголосовать: нравится +28 Проголосовать: не нравится

Sorry to ask, but is there any access to virtual participation?

»
3 года назад, # |
  Проголосовать: нравится +23 Проголосовать: не нравится

How to solve problem I(Interactive Rays)?

  • »
    »
    3 года назад, # ^ |
    Rev. 3   Проголосовать: нравится +8 Проголосовать: не нравится

    First we can rotate the plane to make sure the center is above the x-axis and the circle doesn't cross the third quadrant. Next I use binary search to find two rays $$$a:(0,0)\to (x_1,y_1)$$$ and $$$b:(0,0)\to (x_2,y_2)$$$ that are almost tangential to the circle.

    Then I enumerate all possible radius $$$r$$$($$$r$$$ is an integer not greater than $$$10^5$$$ so it's ok to do so)。With the distance between $$$a$$$ and the circle (let's call it $$$d_1$$$) and it's radius $$$r$$$ we can work out the coordinate of the center $$$(x,y)$$$ (with some senior high school geometry). I also make sure that $$$(x_1,y_1)$$$ lies in the second quadrant and is as close to the circle as possible (so if the circle doesn't cross the second quadrant, what I will get is $$$x_1=-1$$$ and $$$y_1=10^5$$$). Because of the constraints above (the bolded part) we can see that $$$d_1$$$ is always useful information (which means that $$$d_1$$$ is not $$$\mathrm{distance}((x,y),(0,0))-r$$$, this infomation is useless because it's too easy to get and we can't fix $$$(x,y)$$$ simply with $$$r$$$ and $$$\mathrm{distance}((x,y),(0,0))-r$$$ : we need more infomation : $$$d_1$$$)

    picture

    After fixing $$$(x,y)$$$ we have the whole circle, so we can calculate the distance between the circle and $$$b$$$, and check whether it is equal to what the interactor outputs. If yes, then $$$(x,y,r)$$$ is the answer, otherwise go through other radii until we find out the answer.

    the code

    (I'm a Chinese student, sorry for my poor English.) I spent four hours on the problem (from 9:30 p.m. to 1:30 a.m!) so I don't have time to help my teammates lol

»
3 года назад, # |
Rev. 4   Проголосовать: нравится +22 Проголосовать: не нравится

I almost solved M... I got like 99% of the way to an accepted solution... but couldn't make the final leap. I wasted 3 HOURS faffing about like an idiot.

Spoiler

I want to scream. I feel like a tremendous idiot. I think this will haunt me for the rest of my life...

»
3 года назад, # |
  Проголосовать: нравится -18 Проголосовать: не нравится

Can the editorial be opened without Google?

»
3 года назад, # |
  Проголосовать: нравится +5 Проголосовать: не нравится

How to solve A?

»
3 года назад, # |
  Проголосовать: нравится +16 Проголосовать: не нравится

I have a question regarding the editorial for problem B.

Otherwise, we are joining two components on the same depth. Let’s say A is to the left of B (so, R(A) < L(B)). There can be at most one component between them, which is on a smaller level.

In this case, 3 and 6 have the same depth 2 but there are 2 components between them (14 and 58). Did I misunderstand something?

  • »
    »
    3 года назад, # ^ |
      Проголосовать: нравится +10 Проголосовать: не нравится

    Well, seams there is bug in editorial. I'll try to fix it later,

    In fact, In that case, we can just join both of them with parent, and it's correct (solution do like that). Probably I was thinking this parent is same for them, but than find it's wrong during stressing, but forgot about it again, when writing editorial. Anyway, it will become same at some point, and they would be merged, and total number of merges still small.

    You can check my solution for details

»
3 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Anyone know the members of Peking University team? Peking U (Wang, Yang, Guo)

»
3 года назад, # |
  Проголосовать: нравится +26 Проголосовать: не нравится

Can you change settings to display (failed) tests after the contest? Like in any CF round. I still can't fix my WA on test 102 in 1578I - Interactive Rays.

»
3 года назад, # |
Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

could anyone help me with problem E please, I,ve written a code but I get TLE on test 3, this is my code:

#include <bits/stdc++.h>
using namespace std;
int main(){
    int TC;
    cin>>TC;
    while(TC--){
        int h, p, rem = 0;
        long long n, ans = 0;
        cin>>h>>p;
        int i = 0;
        while(i < h){
        	n = pow(2, i);
            if(n <= p){
                ans++;
            }
            else{
                n -= rem%p;
                ans += n/p;
                rem = p - n%p;
                if(n%p) ans++;
            }
            i++;
        }
    cout<<ans<<endl;
    }
    return 0;
}

thnx in advance.

  • »
    »
    3 года назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    First, you can replace pow(2, i) with a bitwise shift operation: 1 << i. Second, you don't have to go through each value of i. I hope this helps.

  • »
    »
    3 года назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    use faster i/o

    code :

    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

»
3 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Problem E: I submitted a solution which I think shouldn't result in TLE but it is resulting. Can anyone point out possible mistake. I am failing to find any.

My solution: https://mirror.codeforces.com/contest/1578/submission/142363694