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

Автор chromate00, 18 месяцев назад, По-английски

Well, that was a blast, certainly. I hope that you... learned a lot from the contest. I wouldn't say "enjoy the contest", I know most of you hate geometry, I get you. But please do remember that, at least I did try my best to make every problem as high quality as possible. Like, if you don't get familiar with thinking about geometry now, you might never get familiar with it in the future. Though I apologize that E was quite hard, I suggest you to upsolve or read the editorials of the tasks you could not solve. I am telling you, it will be an experience that will make you improve much more from now.

Solution codes will be posted after the open hack phase. They are now added.

Spoiler

2074A - Draw a Square

Editorial
Code

2074B - The Third Side

Editorial
Code

2074C - XOR and Triangle

Editorial
Code

2074D - Counting Points

Editorial
Code

2074E - Empty Triangle

Editorial
Code

2074F - Counting Necessary Nodes

Editorial
Code

2074G - Game With Triangles: Season 2

Editorial
Code
Разбор задач Codeforces Round 1009 (Div. 3)
  • Проголосовать: нравится
  • +101
  • Проголосовать: не нравится

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

Geometry dash ah contest :p

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

Solved E on pure luck, 310074961 The if condition is so stupid from me because earlier I was getting TLE on TC30, and then I mistakenly added the stupid if condition (which queries n-2, n-1, n) repeatedly after 50 queries which somehow got me AC which I do not deserve.

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

    Worst E ever. I appreciate that the author thought of such a creative idea but still Im not conviced this was a good E

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

    I could not kill all deterministic heuristics. I was simply unable to. And, well, I tried my best, leading to an interactor that is $$$308$$$ lines long. If I want to kill all of them I could put $$$100$$$ inputs, which indeed kills the Codeforces platform before your solution

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

      Yes thats understandable, with a problem which involves probability, you always have to and unintentionally leave room for a solution which gets AC with no proof. I also take it that thats the reason why hacks are disabled because so many solutions (including mine) are so easily hackable

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

With high probability, I can say that the number of participants who guessed $$$E$$$ without proving the bound of queries on $$$75$$$ is more than $$$75\%$$$

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

I didnt know x+y = x^y + 2(x&y)

how cooked am i chat

»
18 месяцев назад, скрыть # |
Rev. 2  
Проголосовать: нравится +1 Проголосовать: не нравится

I submitted my solution for E just to try (actually, I thought it was wrong), but it got accepted... Why is it correct?

310125203

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

    Same with mine, can someone tell me if there is a proof for this approach or was i just lucky 310070577

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

    Your method is equivalent to creating a full trinomial tree using BFS. Imagine that each time you take a node out of the queue, you randomly assign the value of that node to three children. - Your probability of success is the probability that no child node of the process has a zero. The higher up the tree you go, the higher your probability of passing. Suppose the height of your tree is x . Then there's a value that keeps getting smaller by x-1, each time randomly changing to [0,x]. And the smaller it is, the higher the probability that the next reduction will result in a 0 in its children. But you chose BFS over DFS, which makes the tree fat and short, which is probably the worst way to do it. But the probability of passing in completely randomized data is still not bad.

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

For anyone wondering about the solution of D, the reason why you can compute for all N circles at each value of x without clocking O(N*M) solution, is that you're only computing points on the circumference of the circles which is bounded by 2*pi*M.

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

Why does E exist

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

I couldn't do E because I thought, "What if they use the exact test case where they are chasing my choice?".

With some probability, everything can be done in O(1) ig

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

Legendary

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

It is actually possible to solve C in O(1)

https://codeforces.me/contest/2074/submission/310059528

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

Geometry wasn't geometrying today -.-

»
18 месяцев назад, скрыть # |
 
Проголосовать: нравится -12 Проголосовать: не нравится

E is a poor question. The problem states that the interactor is adaptive, which led me to mistake it for a proof problem. Because I think that as long as I can't guarantee that there are no points in my triangles, the interactor will definitely beat me.

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

where to practice questions like E?

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

GeometryForces

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

anyone know any other questions like E? i want to make sure i avoid them

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

I was solving the E question in the last few minutes and I have no idea how this solution got accepted This submission could have much much more than 75 queries in a worst case scenario

How did it get AC?? https://codeforces.me/contest/2074/submission/310144435

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

The way author hint on problem D with m bound to solve is true gold. It really saves my contest performance this time.

`the sum of radii is exactly m∗.`
`∗Is this information really useful? Don't ask me; I don't really know.`
»
18 месяцев назад, скрыть # |
Rev. 4  
Проголосовать: нравится +1 Проголосовать: не нравится

310109380 Solution of C. Why Binary search working ? Any proof? Note : suppose x^y = z. z can be x+y-1 maximum and x-y+1 minimum

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

You mean my 10 WA submissions of E were all unluckily under the 1.8 * 10^-20 probility? I have tried 4 different method to change the triples which ask for. At last AC by srand() and rand()? What a poor problem

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

Very misplaced problems E should be C C should be D D should be F F should be E

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

On problem E, I ended up testing the 3 triangles formed by the inside point and each pair of the other vertices and continuing with the new triangle formed by these 3 interior points (if solution not found yet). But I'm not yet sure that this is equivalent to the editorial solution minus the probabilistic approach. Mainly because it looks like I use 4 queries to reduce the space by at least a factor of 3. If anyone can explain, I'd appreciate it!

https://codeforces.me/contest/2074/submission/310129128

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

Is it an AD of Geometry dash? it's a good game by the way ;)

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

D was nuts.

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

My solution to G passes with $$$O(n^4)$$$, should this happen?

https://codeforces.me/contest/2074/submission/310074015

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

It felt more like a Geometry Olympiad than a programming contest.

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

Fun fact: A very assuring hint about E's solution was that they disabled hacks and guaranteed a fixed number of test cases. This pretty much implies that the intended solution relies on random and they didn't want participants to suffer from their "weak" random solutions being hacked. Of course, even without such restrictions, the intended solution can still be random if the chances to pass are high enough, but we all know that chromate00 is too kind to let such a massacre to happen :)

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

    thanks to him my solution without randomisation passed and will not be hacked XD

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

    He (and I) believe this is the only correct way to set randomized solution problems. But ofcourse it comes at the cost of giving away information.

    • »
      »
      »
      18 месяцев назад, скрыть # ^ |
       
      Проголосовать: нравится -9 Проголосовать: не нравится

      Whats the point of such problems? what do they teach i found E extremly useless.

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

        It teaches you that randomization is sometimes useful.

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

          Then why are solutions that aren't random also AC? Why keep a question if you can't ensure that only truly random solutions can pass? Why not make a strong interactor that WA'S all solutions that aren't random, if you can't make it dont keep the question, or keep it in the end.

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

            Do you really think every problem can set a constraint that only the very intended solution can pass and others can never? Let me tell you: almost every problem in the world has at least one way to solve that the authors couldn't come up with. Some kinds of problems are much harder to prevent suboptimal/heuristic solutions from passing than others, but it doesn't mean the problem should never exist, nor that it implies that the authors didn't try to prevent them at all.

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

              Yeah right a problem can have many solutions, but it can be proven that those solutions are also right.

              But a problem whose intended solution is a randomized solution,if that problem also AC's some non random solutions but WA'S some non random solution, is it a good problem? Doesn't it make it unfair?

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

                Authors don't have responsibility to hack every unintended solutions. If your definition of 'unfairness' is to give WA on every single solution that has some chance to be hacked, then I would say that there are many many problems that are unfair. It just can't always be prevented. You can't and shouldn't expect the authors to invest thousands of hours into a problem to test every possible heuristics just to cut out a few more unintended solutions. It's not productive.

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

                  Then why not allow hacking in E and let's how your randomization algorithm helps you there. lol

                  Too big to admit when someone's wrong.

                  I dont really know why is it so hard to comprehend that such problems where a lot of "lucky" solutions can pass aren't good problems and yes author can't spend gazillions of minutes making it good, but yeah sure can spend a couple of minutes to not keep that problem at all.

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

                  Your initial comment was this:

                  Whats the point of such problems? what do they teach i found E extremly useless.

                  and I don't understand why a problem has to be rejected because of these 'lucky' solutions when it can definitely teach you something more valuable, if that's what you were looking for. Why do you even care if some other solutions passed or not, if you can learn something good from the intended solution?

                  but yeah sure can spend a couple of minutes to not keep that problem at all.

                  ... Then you don't care about the time to invent a new problem to replace it at all?

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

                  You are right, I was blinded by my rating drop and ignored the actual reason why i am writing contests.

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

                  You regret yourself when you could not solve 1008C, while it could have been solved with randomization.

                  And now you complain about a task teaching you about the whole concept.

                  I guess you are very ironic.

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

                  I think that C has a very nice analytical solution, it was too adhoc for me.

                  Did you AC it via a random solution? if yes then you are just lucky.

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

                  There are of course proofs for any provably correct solution. I believe sufficiently many Div. 1 participants proved it while using randomized solutions to solve it. I don't think I get your unnecessary hate about it when you could use it as an opportunity to improvement.

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

                  L

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

      Wrong. If the chance of your code to fail is less then $$$10^{-9}$$$ on one test and it actually failed — you just suck at life.

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

Interesting observation in C:

  1. For x of form 2^k or 2^k-1, there doesn't exist any y which can give you a non-degenerate solution.

  2. For rest of the numbers, getting the leftmost closest 2^k-1 will always result in a degenerate solution.

Solution: https://codeforces.me/contest/2074/submission/310084628

Note: Got the observations by analyzing the patterns generated by brute force

Got no formal way of proving this, please let me know if anyone can help with the proof.

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

    Proofs:

    Let's denote x^y as z.

    1.

    1) Let x = 2^k for an integer k. y < 2^k implies that y&(2^k) = 0 = y&x. x⊕y = x+y-2*(x&y) = x+y = z. x+y <= z -> There is no y, satisfying the given conditions.

    2) Let x = 2^k-1 for an integer k. y < x implies that y&x = y. x⊕y = x+y-2*(x&y) = x+y-2*y = x-y = z. z+y = x-y+y = x <= x -> There is no y, satisfying the given conditions.

    2.

    Let x != 2^k and x != 2^k-1 for any integer k. Let i denote the most significant bit of x, j denote any other set bit of x, k denote any bit lower than i and being unset (i, j, k always exist). Then, by construction y = 2^i-1. x+y >= 2^i+2^j+2^i-1 >= 2^(i+1), z's most significant bit is i, therefore z < 2^(i+1) <= x+y holds. y < x+z holds because y < x holds by construction. x < 2^(i+1) — 2^k. z >= 2^i and y = 2^i-1 implies that z+y >= 2^(i+1)-1 and z+y > 2^(i+1) >= 2^(i+1) — 2^k > x. All conditions hold -> y = 2^i-1 satisfies the given conditions.

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

    You are right. This leads to an $$$O(\log x)$$$ solution.

    The editorial tells us that $$$y$$$ must have at least 2 on bits — one matching $$$x$$$ and one not matching $$$x$$$. Also, $$$y \lt x$$$.

    1. If all bits in $$$x$$$ are on, i.e. $$$x=2^k-1$$$, then y cannot exist.
    2. If only one bit in $$$x$$$ is on, it must be the MSB and $$$x=2^k$$$. Any $$$y$$$ will end up greater than $$$x$$$, so $$$y$$$ cannot exist.

    If you discount these cases, then $$$x$$$ has an on bit in MSB and some on bits and some off bits afterward.

    One easy solution for $$$y$$$ is to copy $$$x$$$, turn off the MSB (so now $$$y \lt x$$$), and turn on all the other bits, i.e. $$$y=2^{k-1}-1$$$ where $$$k$$$ is the bit length of $$$x$$$.

    The time complexity is determined by counting the bit length of $$$x$$$.

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

LL

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

It is technically possible to solve the problem by fixing the value of y instead of the value of x, but it is significantly more tedious to implement.

Can anyone tell me if its possible to do this? I tried this but I think we can't just keep the maximum x for a given y (the order of processing matters and we don't know exactly what should be processed first or do we?) I'd really appreciate if someone can share the solution if they solved it by fixing y instead

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

    Yes, it's possible to do. Let's begin by considering a solution where we fix $$$x$$$ from the other side. For each $$$x$$$, we have segments $$$[y_i - R; y_i + R]$$$, where $$$R$$$ is the maximum possible value (which can be find by math formula or bin search) such that the considered segment lies within circle $$$i$$$.

    Okay, then the number of points for each $$$x$$$ will be the number of points that lie in at least one of those segments. This is a standard problem of finding the length of the intersection of segments, which can be solved using a scanline algorithm. However, it is harder to do for $$$x$$$ than for $$$y$$$, because the range of $$$x$$$ is $$$[-10^9; 10^9]$$$.

    In the case of $$$y$$$, its range is $$$[-m; m]$$$. Analogously, for each $$$y$$$, we have segments $$$[x_i - R; x_i + R]$$$, where $$$R$$$ is the maximum possible value such that the considered segment lies within circle $$$i$$$. Similarly, let's find the length of the intersections of such segments for each $$$y$$$. The final asymptotic complexity is $$$O(m \log m)$$$.

    Code 310266037

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

Yeah, when the contest finished I was very angry as you said, but I learnt from you and you enforced me to learn more and be familiar with geometry, so sorry if I was angry or wrote that it was a bad contest maybe I didn't like it in the start coz I wanted to be an Expert, but now I will never forget the lesson that I should be good at geometry as the other things, so thanks so much ^_^

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

I liked this contest. I solved A-E in contest and E was awesome. Idk why people get triggered at these types of less traditional problems, they care too much about rating.

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

Could someone can explain the editorial of F more clearly for me,I'm a Chinese and a English noob,so I would appreciate it if someone would give me a better explanation(I can read the editorial,but it's too hard for a specialist to understand).

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

    i have an alternate solution that is much simpler

    for each $$$k$$$, count how many of those $$$2^{k}$$$ squares that can fit inside the range

    for $$$k = 0$$$ this is just $$$(q-p)(s-r)$$$

    for every other value of $$$k$$$:

    we must find the number of pairs $$$(u,v)$$$ so that $$$[u.2^{k};(u+1).2^{k}] × [v.2^{k};(v+1).2^{k}]$$$ fits inside $$$[p;q] × [r;s]$$$ $$$(u,v \ge 0)$$$

    which means it has to satisfy:

    $$$p \le u.2^{k}$$$ and $$$(u+1)2^{k} \le q \Leftrightarrow \frac{p}{2^{k}} \le u \le \frac{q}{2^{k}}-1$$$

    $$$r \le v.2^{k}$$$ and $$$(v+1)2^{k} \le s \Leftrightarrow \frac{r}{2^{k}} \le v \le \frac{s}{2^{k}}-1$$$

    from there finding the number of $$$(u,v)$$$ is trivial, and for each square, it would "overlap" with $$$4$$$ squares of size $$$2^{k-1}$$$, which means $$$4$$$ of them are replaced by $$$1$$$ square of this size, thus the result will be subtracted by $$$3$$$ times the number of squares

    code: 310097100

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

Interesting problems ,had to use high school geometry . I liked all the problems even though I wasn't able to solve last 3 problems

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

I love these ``heuristic'' problems! Really forces one to think outside of the box in terms of how to approach them.

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

For problem C, I think we only need to check all numbers with the binary form 11...11.

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

Nice Contest

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

problem G grind me a lot lol, i found that dp range can solve, but after all i can't find the dp transition state:LL

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

For C, i found a solution which runs in O(1) (or O(k) where k = complexity for builtinclz(), ive heard that its practically constant time):

int msb(int i)
{
    return i ? __builtin_clz(1) - __builtin_clz(i) : -1;
}

void xortriangle(int x)
{
    int y = x + 1;  // if all bits are set, then x + 1 only has 1 bit set;
    if (!(x & (x - 1)) || !(y & (y - 1))) cout<<-1<<'\n';
    else cout<<((1 << msb(x)) - 1)<<'\n';
}

basically if number has only 1 set bit or all bits are set then its not possible, since xor then is like regular addition there so triangle will always be degenerate there else i just used a slightly smaller number with all set bits, since xorring with that is guaranteed to result in some xor result which will be less than the sum

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

chromate00 As someone who has tried problem setting before, really curious as to how you made the test cases for E.

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

Who else solved E without random probability! I couldn't prove but this worked https://codeforces.me/contest/2074/submission/310087663

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

Most concise O(1) solution for C 310203051

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

Where's the code?

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

Why did my solution passed on Problem C and E

Problem C : 310037314 Problem E : 310096257

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

For 2074E - Empty Triangle, I don't know why this 310209003 got an AC. Maybe on luck. But it worked :)

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

Got a question, I finished my first contest ever. Why do i see no rating in my profile?

Got 2/7 right.

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

failed to solve D but it's really a good problem (I didn't notice that m<=2e5 and i thought calculate each x will get MLE :( )

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

can someone pls help me with this I do not understand why we are looking at probabilities for problem E isn't it obvious after choosing good triangles(with least no. of hidden points) 7 times will get the desired triangle? that is in total of 7*3 queries?

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

    We don't know which triangle is good and therefore choose a new triangle randomly. Otherwise, it might be the case we choose the worst triangle at each step, which will result in asking more than 75 queries. But when randomising choices, probability of such cases are very low.

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

Nice contest to understand triangles in depth and C was really nice for a XOR question

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

My Solution to E is something like a BFS, I have no idea why it works mathematically, someone proving it would be nice, my guess is it might be doing something very close to what the editorial does. Also, for C, I brute-forced the code on my machine to find a pattern that for an x what is the smallest value of y. I noticed that the answer was always of the form (1+ 2^n)< x. If such a n did not exist the answer is -1. I iterated over all valid n's and solved the problem in log2(x).E: 310096412 C: 310115607

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

    For E, I came up with the same approach 310209003, surprised by it. I cannot prove it mathematically either. I now think that it is a coincidence because:

    1. The starting condition may not include all 1500 points

    2. The initial triangle is split up into about 50 small triangles when reaching 75 queries. For random data, the probability of getting a triangle with no point inside it is considerable.

    3. Possibly the problem maker did not think of this BFS approach, so it is not hacked.

»
18 месяцев назад, скрыть # |
 
Проголосовать: нравится -9 Проголосовать: не нравится

E is the worst CP problem I have ever seen, nothing beats a problem which depends on luck.

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

When I solved 6 problems:Great!Yeah!Killed the F in last 5 min before Ended! System Test:Hello. (Rejected on the test 11 of problem D)

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

who hacked the D problem? So many competitors got WA on TC11 after system testing!(Unluckily I am one of the poor guys) how does the idea come up??!!

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

For Problem E, it actually pases with failure probabilty of at most $$$1e-33$$$. To see this, consider the event that each point stayed alive after 75 queries. This happens with probability at most $$$\frac{1}{3^{75}}$$$. Using a union bound, we can see that the probability that any point stayed alive after all 75 is at most $$$\frac{n}{3^{75}}$$$, which is somewhere near 1e-33. (Note that union bound doesn't require any assumptions about dependencies (or lack of) in ther random events).

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

I was initially curious why you were calculating the expectation when solving problem E. It turns out that as long as the probability is close enough to success, the program is considered correct. Given that, this means there's still a very small chance that the code won't pass when submitted. This is the first time I've seen a problem like this.

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

    This probability thing is actually quite common. For example, using hashes (like set or dict in Python) is also probabilistic which takes expectedly $$$\mathcal{O}(1)$$$ time with proper randomization, but it can also take $$$\mathcal{O}(n)$$$ time in the worst case with extremely low chance. Without randomization they can be easily hacked by manually creating the worst case.

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

.

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

Just wanted to share my solution to F :)

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

Can anyone explains why this brute force solution passes? I haven't be able to proof the complexity, but I think it's probably $$$O(log^2(r))$$$.

Fun fact
About hacks in F
  • »
    »
    18 месяцев назад, скрыть # ^ |
     
    Проголосовать: нравится 0 Проголосовать: не нравится

    I checked your hacked submission and it seems the number of recursions alone is $$$\mathcal{O}(\log^2{r})$$$, and it runs a $$$20$$$-time loop, which actually comes from the value of $$$\log{r}$$$ so the solution can be considered $$$\mathcal{O}(\log^3{r})$$$. Plus, the statements inside the loop are quite costly, having a number of division operations. I counted the number of calls to f and the number of loops and there were $$$702$$$ and $$$10895$$$, respectively for one test case of the hack.

    Any real $$$\mathcal{O}(\log^2{r})$$$ solution shouldn't be struggling to pass, as it's only like $$$400$$$ per test case, so even with maximum test cases it operates only around $$$4$$$ million times, which should be safe even with very large constants. You can check mine which is also $$$\mathcal{O}(\log^2{r})$$$ and passed only in $$$155$$$ ms.

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

    The loop of your passed version, on the other hand, seems to run only the required amount of times by tightly setting the iteration range, so it is actually $$$\mathcal{O}(\log^2{r})$$$. Its constant is fairly huge, but it is still more than enough to pass.

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

Tried solving E with a random approach and still can't figure out why it got AC. Is there a proof for this solution?

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

    this method is equivalent to creating a full trinomial tree using BFS. Imagine that each time you take a node out of the queue, you randomly assign the value of that node to three children. — Your probability of success is the probability that no child node of the process has a zero. The higher up the tree you go, the higher your probability of passing. Suppose the height of your tree is x . Then there's a value that keeps getting smaller by x-1, each time randomly changing to [0,x]. And the smaller it is, the higher the probability that the next reduction will result in a 0 in its children. But you chose BFS over DFS, which makes the tree fat and short, which is probably the worst way to do it. But the probability of passing in completely randomized data is still not bad.

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

      Here's a DFS implementation which exceeds the query limit. The question relies too much on probability that using a random number generator between [0,2] to replace a vertex gives AC, but a well thought out approach may exceed the limits.

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

        For random data, DFS should pass with a higher probability than BFS.

        The problem solver probably expected that some people would try a similar strategy, so a DFS that enumerates the children in a fixed order can be easily hacked by an adaptive interactor.

        that's why the solution lets us choose one of the three points at a time at random to avoid the adaptive interactors from working.

        The BFS passes with worse probability, and can be hacked with relatively high probability by a set of perfectly evenly distributed points.

        any solution, whether DFS or BFS, executed in a particular order passes or fails seems to depend entirely on whether or not the questioner has considered the method and given a strategy for targeting the data and the interactors, which makes this question controversial.

        I think this question should use completely random data, and then slightly increase the amount of data to make it more rigorous. This would suggest to the participants that they should try to find a reasonable randomisation scheme rather than just pass with confusion.

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

          There are more matters that must be and have been considered than what you have enumerated.

          For example, completely random data would not prevent deterministic heuristics so well in the first place, because the expected number of points on the three sub-triangles is already around $$$n/3$$$. These data experimentally have been very bad at killing those solutions.

          On the perspective of number of test cases, it was practically impossible to increase the number of test cases in one input. There exists no algorithm faster than $$$\mathcal{O}(n^2)$$$ to determine if there exist three collinear points, unless there exists one for 3SUM (due to a reduction from 3SUM to 3-COLLINEAR). Even worse, there is a severe issue of I/O bound in interactive tasks, making it impossible to allow so many interactions in the first place.

          On the perspective of number of inputs, it was impossible to add more of them. It may and will kill the judging queue during the contest. $$$35$$$ is already quite excessive for the number of inputs in a Div3E.

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

I got hacked on D, can anyone explain difference between this 310321442 and this 310321612 submissions? Why python dict be that way? Is this hashing problem? Realy sucks when you cant even understand where the problem is

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

E and F are two sides of the same coin, and as interesting as they are, they drive me crazy.

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

For problem G,

We only wanted to split our range into three disjoint ones

what was the motivation for this?

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

    Notice how a triangle splits the problem into $$$[L,i-1]$$$, $$$[i+1,j-1]$$$, $$$[j+1,k-1]$$$, $$$[k+1,R]$$$. After we know that the problem of $$$[i,k]$$$ will be split into $$$[i+1,j-1]$$$ and $$$[j+1,k-1]$$$, what we need now is a way to split $$$[L,R]$$$ into $$$[L,i-1]$$$, $$$[i,k]$$$, $$$[k+1,R]$$$.

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

Loved the editorial for C and E. Thank you.

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

I hate E!!!

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

My solution for F, with the observation that if we zoom in by 2 (multiply each number by 2), we still get the same answer as we simply increase k by 1

func run(a []int) int {
	res := 0
	for a[0] < a[1] && a[2] < a[3] {
		if a[0]&1 == 1 || a[1]&1 == 1 {
			if a[0]&1 == 1 {
				a[0] += 1
			} else {
				a[1] -= 1
			}
			res += a[3] - a[2]
		} else if a[2]&1 == 1 || a[3]&1 == 1 {
			if a[2]&1 == 1 {
				a[2] += 1
			} else {
				a[3] -= 1
			}
			res += a[1] - a[0]
		} else {
			for i, v := range a {
				a[i] = v >> 1
			}
		}
	}
	return res
}
»
18 месяцев назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Thank you, chromate00, for such a great contest. I think it's got too much undeserved hate. Yeah, E was very unusual, but I think it is a very nice and fun problem (tho, it's sad I ruined it). I'll go learn bitmasks now, couldn't understand C at all XD. Wish you all the best! =)

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

However, there is also the following information that we gain.

  • If we found $$$c_i, c_j, c_k$$$ points after substituting one index with $$$p$$$, and found $$$c$$$ points after querying $$$(i, j, k)$$$, then
    $$$ c_i + c_j + c_k + 1 = c. $$$

can someone explain the following lines in the editorial of E?

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

being a geometry lover this contest was amazing, tho I only solved ABC in virtual. C was just a WOW (given the fact that I came up with a different $$$ O(log_2 n) $$$ solution) but I loved it. Could've ac'ed D in vc too but I wasn't too sure about the time complexity.

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

We can also do D by merging possible intervals of X at different Ys from [-rmax to rmax], for each Y find the possible [Xleft, Xright] for all the circles, then merge the intervals and find the count, implementation: https://codeforces.me/contest/2074/submission/311520361

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

I think C can also be done in O(1) per test case. See my submission- 311576242

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

My approach for C was a bit different , but I find it more practical

I bruteforced for a valid pair $$$(x,y)$$$ such that

$$$\begin{cases} x+y \gt x \oplus y \\ x+x \oplus y \gt y \\ y+x \oplus y \gt x \\ \end{cases}$$$

If you done this for example upto $$$(n \le 50)$$$ you'll notice that some cases are $$$-1$$$ , let's focus on cases where it's valid you'll notice answers on form of $$$2,5,9,17,33,65,129,266,513,1025,..$$$ , Notice that this pattern is $$$2^n+1$$$ , according to the constraints , it's enough to precalculate powers of $$$2$$$ upto $$$30$$$ and for each case iterate through all $$$2^i+1$$$ for $$$(1 \le i \le 30)$$$ , try all powers until we find a value , Complexity $$$O(\log(n))$$$.

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

Me vs the one she told me not to worry about.

(My code 313631492 vs editorial code in problem F)

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

started hating probability

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

Очередной говно-разбор, среди очередных говно-разборов(точнее всех разборов на это проклятом и мерзком сайте)