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

Автор xcyle, 2 года назад, перевод, По-русски

EPIC

Привет, Codeforces!

Мы рады пригласить вас на EPIC Institute of Technology Round August 2024 (Div. 1 + Div. 2), который состоится в 11.08.2024 17:35 (Московское время).

Задачи подготовлены Flamire, le0n и xcyle. Вам будет дано 8 задач и 3 часа на их решение. Две задачи разделены на две подзадачи. Раунд будет рейтинговым для всех.

Мы бы хотели поблагодарить всех, кто помогал нам в подготовке этого раунда:

Разбалловка задач: 500 - 750 - 1000 - (1000 - 1000) - 2000 - (2000 - 1250) - 4000 - 6000

Всем удачи!

Наши поздравления победителям!

  1. jiangly
  2. Radewoosh
  3. Benq
  4. Um_nik
  5. maspy

Разбор доступен в виде pdf и будет опубликован отдельно завтра.

А теперь несколько слов от сегодняшнего спонсора!

About EPIC Institute of Technology

EPIC Institute of Technology is an innovative educational project, driven by the Deltix team under the EPAM Systems umbrella. As part of EPIC — EPAM Product Innovation Center, we aim to cultivate the brightest minds and prepare them for a future in cutting-edge technology projects.

Why EPIC:

EPIC Institute of Technology is an accelerator for the best talents. Our students will acquire hands-on experience in one of the selected major programs, all of which are highly demanded right now on top projects, together with the fundamental knowledge, so indispensable for real professionals. Successful graduates will have a unique chance to jumpstart their career on the most challenging and interesting EPAM projects worldwide. You will join the community of intelligent and driven individuals and have an honor to work with and learn from them.

Here are the answers to the most common questions:

How much does education cost?

EPIC Institute of Technology is completely free. There are no fees to register for exams, tuition fees or any other hidden liabilities. The only restriction for getting into EPIC Institute of Technology is age. You must be older than 18 years old to become a student.

How is the educational process organized?

Each program lasts exactly one year. The academic year consists of two semesters. Courses in the first semester are the same for all programs. Courses in the second semester depend on the selected major program.

During the semester, students complete homework assignments and take 2 exams—a midterm and a final. The final grade a student gets for each training course depends on the quality of completed assignments and participation in practical classes.

How will the classes be held?

Lectures will be pre-recorded and available for self-study. Practical classes will be held at the specified time according to the provided schedule. Also, students will have an access to a Discord server, where they can discuss topics of academic interest with teachers and other students.

In what language will I study?

All programs are in English.

How can I apply?

The admissions process is as follows:

  1. Fill out the form on the website.

  2. Take part in one of the entrance exams that will be held in our Codeforces group. You can also find past exam breakdowns there, which may help you in your preparation. Exam dates will be announced later, so stay tuned to the announcement channel and our LinkedIn group.

  3. If you successfully pass the exam, you will receive an invitation email.

What will happen after graduation?

All EPIC Institute of Technology graduates will get a diploma and the best students will be offered to join, either as an intern or a full-time position, one of the hot EPAM projects where skills acquired at EPIC Institute of Technology will be demanded.

Please visit our website to learn more about EPIC Institute of Technology and the available programs. If you have any questions, you can quickly ask them in our chat.

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

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

I hope Gennady will win this round, break 4000, and finally achieve a new rank 'God'!

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

I am the first comment ;)

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

As a tester, I missed the opportunity to post the first comment because I spent too much time thinking about what to post as an "as a tester" comment.

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

yay! as a tester & translator, good luck to everyone!

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

$$${\color{orange}{\text{As}}}$$$ $$${\color{purple}{\text{a}}}$$$ $$${\color{blue}{\text{tester}}}$$$,

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

I got -155 last EPIC round, hopefully it will go better this time!

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

As a tester, I tested this round.

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

As a tester, I suggest you taking a nap when you got stuck. (It did help me)

BTW le0n is so cute! It's such a pity we don't have a photo of the authors.

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

boooo 3-hour round

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

My last performance in EPIC div1+2 was so bad. Hope I can come back this round

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

Hope tourist cross 4000 rating after this round.

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

le0n is BeiJing's Captain!

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

Can anyone please explain the score distribution (esp the bracket part)?

The score distribution is 500 — 750 — 1000 — (1000 — 1000) — 2000 — (2000 — 1250) — 4000 — 6000

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

    The brackets means the problems (in this case pD and pF) are divided into subtasks. So you'll see problem D1, D2 and F1, F2 in the competition.

    Usually, the second part has tighter constraints, and a code passing the second part would also pass the first part (hence the harder second part might award less points, like in pF. But actually you get 2000+1250 by solving the hard and only 2000 by solving the easy.)

    However there are examples where the two parts are different questions, such as problem 1984C1 and 1984C2.

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

Hoping to break the 1400 barrier and becoming specialist this contest! Wishing everyone goodluck!

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

please no median this time

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

Hopefully the problem score distribution is proportional to the problem difficulty this time.

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

Good luck, Gennady.

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

hope to reach expert in this round

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

All the best everyone

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

Did you notice that the logo in the announcement doesn't loop? This is the first time I saw a GIF not looping. Did some search and found out that there's a “loop count” field in a GIF file.

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

I hope the best for every candidate.

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

I hope I will become Red after this round

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

Am I a mad man by going in div1+2 and expect to reach specialist?

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

All eyes on tourist!

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

As a newbie, I am sure that I will lose my rating.

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

Today's Target :- A, B and C.

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

where is tourist :<<<

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

hope for Salah7_a

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

all the best

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

My brain ain't braining after seeing problem B and C.

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

Not intending to be whiny but 1100 ACs for D2 is crazy ngl (all evidence points towards cheaters). Someone remind me to skip the next EPIC round (got -117 delta lol).

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

I hope I am not the only one skipping both D1+D2 to solve E+F, like I honestly can't grasp how to implement even D1...

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

    My implementation was really messy but the idea (at least for me) was to notice that the nodes in a perfect binary tree have to have specific positions. Like, 2 has to be either 1 after $$$1$$$ or $$$2^{k-1}$$$ after 1, and so on like that.

    So I kept a Fenwick tree $$$c$$$ where $$$c_i$$$ represented whether node $$$i$$$ was in the right spot in reference to its parent.

    Then after each query, I just checked if $$$\sum_{i=1}^n c_i = n$$$.

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

      F*ck me, I was stupid. In fact if I got it right, that could be implemented much more simple even, not requiring a Fenwick tree.

      Thank you.

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

        I think I tried along these lines but couldn't convert to a right solution. Got WA at pretest 4. Can you help me with this pls?

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

any suggest on C to deal with epsilon stuff in python?

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

For me A >> B :(
Please someone explain with proof...
I was able to come up with a logic on pen & paper but could not implement it :(

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

    it took me an hour or even more to derive it mathematically and implement it :')

    Spoiler

    hope this helps

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

    basically you can make a k x k square of all different colors and just copy it around. But if one side of the board is smaller than k you can cut a part of the square that doesn't fit (either in height or width independently)

  • »
    »
    2 года назад, скрыть # ^ |
     
    Проголосовать: нравится +4 Проголосовать: не нравится
    Solution for problem A
»
2 года назад, скрыть # |
 
Проголосовать: нравится -7 Проголосовать: не нравится

EPIC fail

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

Couldn't solve C. The fact that I rarely got AC from a problem relating to real numbers :(.

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

2.6k solves on that D1? lmao sure

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

is D2 HLD ?

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

275842383

Hello, I'm wondering what is wrong on my code here. It fails on Test Case 4 and have been searching the error for more than an hour but don't find it.

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

Stuck at C for more than one hour before I realize it's simply to solve the intersection between perpendicular bisector and the path.

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

Me while submitting D2: "Yeah it's definitely gonna TLE"
OMG running on pretest 10 !!
OMG running on pretest 20 !!
TLE on pretest 23
WHY GIVE HOPE ?????

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

    be thankful to organiser. It could have been worse.

    OMG running on pretest 10 !!

    OMG running on pretest 20 !!

    OMG Pretest Passed !!

    FST on test case 183 :(

    Glass half-full half-empty brother. Think on positive side :) ,

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

E < D < C

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

    LOL, kidding right ?

    C is just taking distance of circle to target, and comparing if it is less than or equal to character's distance from target.

    One simple if condition... The only thing is,,, we need to keep the square of the distance, rather than taking square-root.

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

      E was waaaaay more intuitive for me than C.

      In C I thought we shoud take colinear vector and for each point check if distance from intersection to circle center is less than distance to start point.

      E has a simple stack solution (you can check my sub: 275826831)

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

        Please don't make me feel further depressed lol

        I solved C in 5 minutes but came up with all kinds of wrong intuitions on E so that I almost could not solve it. I literally debugged E for 1.5 hours using a random generator and completely wrote new solutions several times. The solution is simple but it was a hard way to reach there...

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

      In a way, I can see their sentiment on E < C. E actually required less "thinking" to come up with the idea, like the solution is straight-up simulating the given process in a careful way — at least the catch is partially within what's given. For C, it's more covert.

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

      I think the hard part is to convince yourself that this works and not the implementation difficulty...

      My way of convincing is that if you can't go to the end point through a straight line and instead you bump into a circle, you can't go to the end point through a curve without bumping as well

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

    sure? I got C in 15 minutes and struugled 2hours for D and ended up not solving it :/

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

nice problems but i'm too weak for them.

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

Was able to blaze trough ABC in half an hour but then i saw D. Got the idea on how to solve it quiet fast but then didn't manage to implement it in over 2h. Quite an EPIC fail Otherways great contest

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

    can you tell me your thought process in B ?

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

      Bob can only win if he manage to delete the same element which is deleted by Alice in each operation, and this is only possible when b == a or b == reverse(a).

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

      Lets say that we have a = {1,2,3} and b = {2,3,1}. In this case if alice chooses to remove 3 bob will have to remove a number that is not 3, since his 3 is not on the edge of the array. Now alice can just remove everything except for what bob removed on his first move like this:

      a = {1,2} b = {2,3} // At this point alice can just not remove the 1. If she doesnt remove it bob wont have it and she will win.
      a = {1} b = {2}
      

      What we noticed is that bob will always want to remove the same number as alice since if he doesn't he looses. Knowing this bob will win if he at all points has the same numbers that he can remove as alice. So we will just check if a = b or if REVERSE(a) = b since in that case they still have the same options every turn.

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

Was writing line intersection in C for an hour(problems with precision), only to realise it is solved with one distance check.

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

    kak?

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

    true story, cost too much time on intersection for naught. I too, fall for the same trap

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

    i was thinking the same kind of thing ... I just guessed the distance check at the end.. can you explain me the proof ?

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

      Can't prove it. Just guessed it is something simple considering how many people solved it. Distance solution was kinda reasonable so I tried it.

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

      I did some haphazard proof on pen and paper that first it's always optimal to take a straight line between start and end points. Then I started doing some perpendicular distance stuff and then I checked using Pythagoras theorem and found that if a circle will intersect the straight path at some time "t" before you reach that same point, then it will for sure also intersect the end point before you reach it. Hence you can just check if any circle reaches the end point before you do. Honestly it's kind of a half-assed thought process that I just went with intuitively so I didn't really have a formal proof.

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

      Assume you walk the straight line from A to B. Then for each circle with origin C, you can calculate the earliest time a when the circle touches the line AB, which is just the closest point from AB to C:

                C
                |
               a|
                |
        A-------+----+--B
      

      At time c > a, the circle covers some length 2b of the segment:

                C
              / | \
           c / a|  \ c
            /   |   \
        A--+----+----+--B
              b    b
      

      The Pythagorean theorem says a² + b² = c², and a is constant, so if c grows at a rate of 1/s, then b must grow at a rate greater than 1/s, which means that even if you are ahead of the circle, it will eventually catch up to you, unless you reach the destination (B) before the circle does. That's why it suffices to check that the distance AB < distance BC for all circle origins C.

      This also shows that there is no point in following a curved path (which seems plausible initially), because if distance AB < distance BC then you can just walk the straight path, and if distance AB ≥ distance BC you cannot reach B before the circle does, so there is no solution.

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

    I fell for the same trap :/

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

Problem B really screwed up this contest for me lol

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

D2 — check if 2 neighbors could be next to each other ina a correct dfs order. Check it for every neighbors and update during swaps. Use lca to check if they could be next to each other

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

In D1, I checked if the children were initially OK for all elements and then only checked for the swapped elements and their parents. But this gives WA on pretest 3. Can anyone explain why?

Submission for reference

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

was there a chance I could get pretests passed with some more pragmas? it initially was tle10. with pragmas it got till pretest 13 https://mirror.codeforces.com/contest/2002/submission/275836926

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

I see a lot of complaints about C and even though I didn't get stuck on it, I agree it was misplaced. Geometry automatically adds difficulty, doesn't matter if there's a clever idea behind that simplifies it — a clever idea adds difficulty!

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

Is there anyone trying to find projections in problem C?

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

    I did and failed in vain. Not handling the epsilon good enough

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

    I did shortest distance between line and point then take the intersect to calculate distance between start point and compare distance.

    and then realize that line equation doesn't worked for perpendicular line so I used Area of triangle then take height and use pythagorean theorem to calculate base and compare distance. which also fail

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

      I started doing the perpendicular distance thing but then luckily I realized if a circle reaches that perpendicular distance point on the line before you (or any point on the line in fact), then it will for sure reach the end point before you as well (I did it using Pythagoras theorem and some inequality). So I scrapped everything and just checked distance from end point

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

    I immediately thought of the Voronoi diagram. Makes intuition a whole lot easier.

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

D is nice, it made me notice how I don't know DFS.

The main idea for E is the same as https://uoj.ac/contest/91/problem/890 . I thought I should do something different because at least one of the testers should know it, sad...

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

itsover-2

1 and half hours of debugging C using double only to realize greedy argument with integer distance calculation without sqrt

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

Just checking distance from centre to destination is either completly braindead or ingenious. No in between. Guess it is one of those times when not proving is helpful.

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

Completely got tricked in both B and C. Hands down to the problem setters for giving good problems and traps to test us. Thanks and appreciated.

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

That D (D1) was way harder than usual D in Div2

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

Was D2 just D1 with binary search and some advanced data structures or is there a unique solution?

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

Just a thought at 178th minute for F2, I think it was correct but couldn't confirm. Is it just F1 with more complex casework?

In F1 I thought of DPing the availability of states within range $$$[n-300, n]$$$, F2 would be the same but with more case-handling (checking $$$(i, j)$$$ with $$$i \in [n-300, n]$$$ and $$$j \in [m-300, m]$$$, cannot force $$$i \lt j$$$ like in F1 since $$$n$$$ and $$$m$$$ aren't symmetric anymore).

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

Is it me or someone else also getting "NO" response in 5th test case for C on my local compiler.

Test case 5: 1 999999998 1000000000 999999999 999999999 1 1

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

I think i can pass D2 now. Debug finished. Why not another 30 minutes XD

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

I just realised: Problems A-C all have a simple solution and a complex proof.

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

The most wise thing I have ever done in this contest, is skip D2 and try E in the earliest time. Because I found D2 way much harder than E, at least for me.

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

somehow I solved B in 2 minutes but struggled lot in A

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

A round made up of problems with huge personal differences.

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

Can D1 be solved by calculating hashes for all unique dfs trees and answering yes on queries for which hash exists and no for those which doesnt?

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

any one who solved A in o(1) can explain how did he derive the equation ?

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

D and E were really cool :)

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

Never has a task destroyed my confidence in my braincells as thouroughly as D1. How are people able to solve up to D2 so fast? Am I just a brainlet or is there some straightforward observation that I'm missing?

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

    In problems of the form "swap/modify elements and say if the array is good", you usually have to break down the given global condition $$$C$$$ into local conditions $$$C = c_1 \land \ldots \land c_k$$$ such that each modification impacts a small number of local conditions, and each local condition can be verified quickly.

    Then, you maintain for each condition if it's currently true or false, and the count of satisfied conditions.

    I usually try to find a necessary set of conditions, and then alternate between simplifying/weakening the condition (to make it local) and strengthening the condition (to make it sufficient).

    First attempt (transform the condition into a set of conditions). First I remark that when $$$p_i = u$$$, the interval $$$[p_{i+1}, \ldots, p_{i+\mathrm{sz}_u-1}]$$$ must be a DFS order of the subtree of $$$u$$$. It's necessary and sufficient, but not local (the condition $$$c_1$$$ is literally the global condition, we didn't make any progress).

    So we would like to rewrite $$$c_u = \phi_u \land c_{v_1} \land \ldots \land c_{v_k}$$$ where $$$\phi_u$$$ is a brand new local condition around $$$u$$$ and $$$v_1 \ldots v_k$$$ the direct children. That way, we will have $$$C = \phi_1 \land \ldots \land \phi_n$$$ by induction.

    It's very powerful because you can rely on strong $$$c_v$$$ while building $$$\phi_u$$$!

    Second attempt (weaken the condition $$$c_u$$$ to make it local around $$$u$$$). All direct children of $$$u$$$ are in the interval $$$[pos_u + 1, pos_u + sz_u-1]$$$. It's necessary and local (when you swap two nodes $$$u$$$ and $$$v$$$, you update the good/bad status of $$$u, v$$$ and their parents), but not sufficient anymore, because a child of a child could be outside the interval.

    Third attempt (strengthen the condition to be able to rely on induction). I ask $$$[pos_v, pos_v + sz_v - 1] \subset [pos_u +1, pos_u+sz_u-1]$$$, it's both necessary, sufficient (by induction) and still local. For example, you can use std::set to get $$$\min(pos_v)$$$ and $$$\max(pos_v + sz_v)$$$.

    There is also a linear-time solution, check the editorial!

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

    We have a problem in which we want to find a sufficient and necessary conditions, so we just throw in necessary/sufficient conditions until AC (my real thought process)

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

Can someone explain logic for D1?

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

    height of the tree cannot be greater than 15.

    Now check the all the conditions like the distances of siblings should be constant with a certain value , positions of children should always be greater than parent and also one of the children should adjacent to the parent.

    My solution — 275851102

    P.S: I used a lot of map which resulted in TLE and after changing them into array, I cannot debug till the end of contest.

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

Thanks for geometry!!

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

when will be rating roll back??

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

How to solve problem H?

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

in problem B what if alice has 1 3 5 2 4 and bob has 4 3 5 2 1 how does alice win ?

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

My Insights for A,B,C

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

Solved D1 by hashing the set of nodes in the subtree of each node, and updating the paths for each query.

submission

seems very hackable though, is it feasible?

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

Hi, can someone please help me understand why this code doesn't work for D1? Thanks.

275855167

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

Still no one rainboy the problem H

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

My solution for D1 was to use a node's relative position to its parent. In a DFS of a perfect binary tree, a node can only be in 2 possible positions with respect to its parent node (Ex: for size 3, we can either have 1 2 3 or 1 3 2, i.e. 2 can only be at a distance 1 or 2 from node 1. Same for node 3). So I just maintained a set of "wrong" nodes that did not satisfy this condition. Whenever 2 nodes x and y are swapped, we just check if x and y are wrong nodes after the switch (I did this using a hashmap to maintain positions of parent nodes). Apart from this, you also have to check if the children of x and y are in the right positions with respect to their parents, as that relative position may have changed after swapping x and y. After a swap, if the set of wrong nodes is empty, then it's a valid DFS. However, this only works for D1 as the complexity increases with an increase in the number of children per node. Maybe some data structure could help but I couldn't think of it in the contest.

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

    i spent the contest brainrotting on this idea, it works because there's only two nodes per level and the subtree sizes of both children are the same

    if you generalize the condition to this problem's description of a valid dfs order), you can do some subtree xor hashing thing, though i couldn't come up with any provable solution (ideally you would only need to add O(1) or O(log(n)) bad nodes to your set per swap)

    here was my final solution 275822556 (it's definitely wrong btw but its hard to come up with random tests against it probably, i tried locally too). maybe there's some provable bound or a smarter way to maintain the bad nodes.

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

      Thanks for sharing! Can you explain the hashing part? I don't think I quite understood it from the code. I didn't even consider hashing at all to solve something like this lol

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

        so with xor hashing, you want to map every element to a random number (in my case i used two random numbers to make the hash bigger)

        then, if you want to check if two sets of elements are the same, you can just instead take the total xor of their hashes

        the valid DFS order check that I mentioned is the same as checking whether the set of nodes in my subtree is equal to the set of nodes in the range [position[x], position[x] + size_of_subtree[x]) of the dfs order, so you can verify that a DFS order works by checking the range hash on the dfs order for all nodes, which can be done with a segment tree (after subtree xor hashes)

        to limit the amount of nodes we check, I have no idea how to do it properly with this approach, but I heuristic bashed by adding node X, the node before X in the dfs order, the parent of X, and then the parents of each of those as well

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

I enjoyed problem F very much! G, on the other hand, left me dissatisfied with the contest, because I feel like I just played the system and didn't solve it.

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

I have $$$O(N*Q)$$$ solution for D1. But I am curious about how any tester or author didn't notice that fact.

My submission: 275797240

UPD: Wrong submission, sorry fixed

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

There are some submissions to G that partition into equal halves, I wonder if it's possible to bound the time complexity or hack them:

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

Either I'm blind or there is no H in the editorial...

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

became pupil

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

I will reach expert today

Meanwhile problem D test case 3:

salute to my nonexistent couldve increased rating

UPD: got 658th query wrong

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

Lol it's funny to see submissions of H. A lot of newbies got the logic.

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

For c problem if anyone needs help in c problem u may read this. -- 1)The path we should follow must be a straight line otherwise the chance of any circle cutting our path would be more,so this is the most greedy way and even u can do little casework to get some idea. 2)secondly suppose we cross a circle at a point in our path in that case circle will reach before us or with us at the final point ( geometric observation) it will never reach final point after us(as it is expanding radially with 1). 3)so we can calculate the distances of every circle center from final point this will be the time for it to reach the final position of our path and if we reached to final point before the fastest circle (circle taking minimum time to reach there) we can always get the answer as yes as we would not have encountered any circle in that case, otherwise we can't reach and answer is no. Hopefully it helps Sorry for my poor explanation skills

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

D1 can be solved with divide & conquer ?

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

Thank you for the contest! The problems are nice.

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

Actually the problems are cool,

But the order...

As for me E < D1 < F1 < D2, so maybe it would be better if swapping D and E :)

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

how does this O(n * q) solution pass for D1 275884243. I have calculated every nodes current parent according to the permutation and checked it with its original parent

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

hum, when i solved C it's too late for me to solve D, i waste so much time in problem C

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

there was obvious cheating in last DIV 1 + 2 , this blog explains it — https://codeforces.me/blog/entry/132571

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

It's no useful

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

Hello sir, I have got an email saying my solution coincides [contest:2002][submission:275819490][user:aditya_kh7503] with someone, although i did the whole problem myself, i have attached the proof of my code on the platform, please don't remove my rating and please remove plag from my solutions.

Your text to link here...

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

Hello Codeforces,

In the last contest, I was accused of cheating in it, specifically for tasks D1 and D2. In that contest, I solved the first 5 tasks. I saw that I was accused with many other people. I see that the way I solved the task is similar, but my way of typing the code is different. This is my 10th contest and in each one I used full names for the variables because it's easier for me to understand and I also use the same template from the beginning. I have not cheated in any of the previous contests, nor in this one, nor do I intend to. According to my submissions, I practiced the tasks in order to improve myself in coding, I did 2 virtual contests where I solved the entire Div 3 and Pinely Round 4 (Div 1 + Div 2) did 5 tasks. Even my first contest was from Epic Institute of Technology where I solved 4 tasks. I don't know how to prove my innocence. So please MikeMirzayanov look at this.

Thanks in advance!

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

I love rounds that don't require any special knowledge on most tasks.

I planned to merge the rating, but eventually turned yellow (when I told the girl, she thought that there were liver problems).

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

I want to go back to Newbie...

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

Hey MikeMirzayanov,

My solution[submission:275840267] for Problem 2002D1 was flagged as similar to many others. I believe this happened because the problem had very few possible approaches, and I used an AI tool (LLM) to help write some functions because as far as I know there isn't any restriction on using AI generated code on Codeforces. This might have caused some similarities.

I’ve solved similar problems in other contests too, and I’m confident that my solution is unique. I kindly request that my solution be reviewed again.

This blog also states this : Solutions and test generators can only use source code completely written by you, with the following two exceptions: 1. the code was written and published/distributed before the start of the round, 2. the code is generated using tools that were written and published/distributed before the start of the round.

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

Rating rollback???