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

Автор chokudai, 6 лет назад, По-английски

We will hold AtCoder Beginner Contest 181.

The point values will be 100-200-300-400-500-600.

We are looking forward to your participation!

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

»
6 лет назад, скрыть # |
 
Проголосовать: нравится +32 Проголосовать: не нравится

It collides with CF round. Can it be rescheduled?

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

This is the first time i have seen two contests collide with each other...for this the both rounds may lose many of their participants....will be highly glad if the setter reschedule the round...

»
6 лет назад, скрыть # |
 
Проголосовать: нравится +7 Проголосовать: не нравится

please,reschedule the round.

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

I believe problem F resembles an OI(maybe APIO) problem some years ago (but I can't find it)

Update: Instead of asking the maximum possible $$$R$$$, you are given $$$R$$$ and asked for the minimum number of points needed to be taken out so that the circle with radius $$$R$$$ can pass through. The constraints are similar ($$$N \leq 100$$$).

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

    A friend of mine got problem F as an interview question before. I think it was for Waymo's motion planning team? I also can't find it.

    EDIT: I think it was this one https://www.careercup.com/question?id=6266160824188928. Here the obstacles are balls and the circle is a point instead, but it is still essentially the same problem. Just need to check if the top and bottom are connected which will block all paths. (In the atcoder version you also need to binary search for the radius).

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

    AquaBlaze how to solve the question you mentioned or do you have link to the question?

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

      I think that version can be solved as follows : Draw n circles of radius R with centers as the n points and if any 2 of them intersect add an edge between them. Now for each component find the miny and maxy, and if miny — 2*R <= -100 or maxy + 2*R >= 100, then there is a blockade (I am assuming limits of (-100,100) similar to the question).

      Update : Answer is equal to sum of the minimum number of nodes that you have to remove for each blockade to be removed. This is equivalent to removing min number of vertices to disconnect graph which can be solved by max-flow, min-cut.

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

      The idea of modeling the given points into a graph is the same as in the problem F;

      • create $$$N$$$ nodes for each point and another 2 nodes for top line and bottom line
      • add an edge for any pair that has distance between their points less than $$$R$$$
      • add an edge between top line and any points that distance between that point and the top line is less than $$$R$$$
      • do similary with the bottom line.

      As we learn from problem F, if there is a path from the top line's node to the bottom line's node, then the circle can't pass through.

      So, what we want to do is remove nodes so that the top line's node and bottom line's node become disconnected.

      Finding the minimum number of nodes to be remove so that a pair of nodes become disconnected is minimum vertex-cut problem, which can be solved in $$$\mathcal{O}(N^3)$$$.

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

How to do F , and also in E i think i got logic but got heavily confused while implementing it .

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

Can someone please explain the solution for the problem C?

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

    Run a triple loop and check the slopes by taking two points at a time out of the three i.e. (y2-y1)/(x2-x1) == (y3-y1)/(x3-x1). Note that you can cross multiply the equation to avoid divisibility by 0.

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

    If we consider two points at a time, they will always be collinear. For three points to be collinear, the slope/gradient of the line formed the by the first two points should be equal to the slope/gradient of the line formed by the last two points.

    The formula to calculate slope is (y2 - y1) / (x2 - x1). So I simple need to find these triplets and check if

    ((y2 - y1) / (x2 - x1)) == ((y3 - y2) / (x3 - x2)).

    The constraints allowed a O(n^3) solution which is the complexity to run three for loops to find the triplets. The only thing left to handle will be the division by 0.

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

How to solve E?

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

How to solve F?

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

How to solve D ?

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

Can someone point out the flaw in my code to problem D. It is showing WA in only one input D-Hachi

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

Ideas for Problem F: 1.) Binary search can be used. 2.) To test a particular value of radius, we can make circle of that length taking nail coordinates as centers. 3.) Make a graph, with nodes as nails coordinates and edge if the two circles centered at nails coordinate overlap. 4.) Check if there exist a path of nodes that completely blocks the passage using bfs/dfs. 5.) If no such blockage exist, then test is successful otherwise failed.

Code

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

next_premutation in problem D-Hachi gave me TLE .Somebody please explain why? Thanks.

»
6 лет назад, скрыть # |
 
Проголосовать: нравится +8 Проголосовать: не нравится

Solution for F: First we need to understand that binary search over radius works in this problem because as the radius increases, the area of the possible loci decreases. Now I convert the problem to the following for checking existence of loci for a particular value of radius, say r : Given N circles, each of radius r, check if there exist a valid line path that doesn't pass through any of them. To solve this problem, notice that the Y borders have changed from [-100+r, 100-r]. Another observation is that if there is no path, there is a set of circles that overlap such that minimum Y and the maximum Y covered by the set of circles is less than equal to -100 + r and more than equal to 100 — r, and by iterating on arc of any of the circles from the set, we should be able to reach the arc of any other circle. This can easily be found by union find algo. and maintaining minY and maxY for each connected component of circles, and in the end checking if it is possible for the given r.

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

In problem F, you don't have to do binary search. This is because the maximum possible radius of a circle is definitely equal to the one of the lengths between two points or a point and the line. So you just need to sort by length and check in the ascending order. Of course, you need DSU to see if it is possible for a circle to get through.

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

can we solve problem C in better complexity than $$$n^3$$$?

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

please help why this code is giving WA https://atcoder.jp/contests/abc181/submissions/17866014

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

Test cases for Problem D is weak. Here is a submission which passed all test cases, but it fail on this test case $$$61$$$, the answer should be Yes but the above submission prints No

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

What is the right hand rule mentioned in the editorial for F?

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

how to solve F in N2