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

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

Hello Codeforces!

I am glad to invite you to Codeforces Round #601, which will take place on Nov/19/2019 17:35 (Moscow time). The round will be rated for both divisions.

All problems in this round were created and prepared by a team of all-Vietnamese setters: MofK, I_love_tigersugar, UncleGrandpa, ngkan. This is the first Vietnamese Div1 round. We tried to make both the problems and the statements interesting and hope that you will enjoy them!

There is an interactive problem in the round. You can read the guide for interactive problem here.

We would like to give a lot of thanks to:

We wish you an exciting round!

UPD: The message from MikeMirzayanov. If the issue heavily affected you and you want the round to be UNRATED for you, you can fill the appeal form by the link: https://mirror.codeforces.com/userForm/f0458e24fa295 Please do not fill it just in case. Be honest, fill in only if the problem broke your participation in the contest. Mike.

UPD: There will be five problems for Division 1 and six problems for Division 2. The score distribution is as follows:

Division 1: 750 — (500 + 750) — 1500 — 1750 — 2500

Division 2: 500 — 1000 — 1500 — 1750 — (1000 + 1250) — 2750

UPD2: : Thanks for participating! Congratulations to the winners!!!

Div. 1: Top 5 are also the only 5 contestant managed to solve all problems!

  1. Radewoosh

  2. maroonrk

  3. SkyDec

  4. webmaster

  5. ecnerwala

Honorable mention: taeyeon_ss for solving problem E in just 31mins!

Div. 2:

  1. MbahSA1937 (solved all problems!)

  2. mintwhale (solved all problems!)

  3. Nightmare05

  4. Don_Quijote

  5. mangojunior

UPD3:Editorial is out!

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

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

from VNOI with love =))

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

From VN with orz!

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

Is it supposed to last 2:15 opposed to the standard two-hour competition?

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

Interactive problems are always fun and challenging.

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

Wish everyone the best of luck and get a good rating after the contest!!

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

Why will contest be held on Tuesday ? There is a Vietnam football match on this day.

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

From VN with love

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

Vietnam national team will play football at 20:00 :(( oh no

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

Good luck everyone, from Vietnam with love <3

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

There will be Hanoi Tower problems?

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

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

But I always wondered, what if someone pass the 9999 rating in the future?

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

Good luck everyone, from Peru with love <3

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

I should be aware of I_love_tigersugar's tricks

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

highly expecting Prof.PVH throwing some maniac traps into the statements like how he's done those National/Regional problems

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

Hope to see both tourist and Benq participate in this round.

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

Have a nice round!

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

Hoping to see tourist become the highest rated coder on cf again

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

The only question about the contest

Will the No. 1 spot in the rating change ?

tourist or Benq or Anyone else

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

For some reason I am not able to register for the contest :/ There is no register link displayed anywhere.

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

Why close the Registration when the competition begins? I forget to register before the competition.

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

I have no electricity right now and i have made submissions. Can you please make the round unrated for me because i am writing now from my phone with 4G. It is completly dark in my house and the only thing i can do is participate from my phone in a div1 contests which is absurd. Please understand my problem and help me.

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

help in B DIV2

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

This round should be unrated. Sample and constraints should not be modified in-between contests. This creates an overall negative experience.

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

кто-нибудь может объяснить условие B? надеюсь просто я невнимателен. И что всё-таки значит "сообща"??

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

Anyone else thought in Div2D/Div1A that the rice cells assigned to every chicken form a connected area? I was going nuts trying to solve that, would be a really nice problem though.

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

Div2 D and E1 should not have been together because they don't require much concepts and their implementation took a lot of time.

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

How to solve div. 1 C Point ordering ?

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

    Find the next point to first using second type of queries (n-2 queries used).

    Now we have 2 adjacent points. Now find areas of all the others with these 2.(n-2 queries).

    Now the take highest area point (lets say h). Now using 1,h,i we can decide side of i to h. And with information of area we can sort points in each side.

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

Div. 2 Was just a coding contest, sorry but not the best contest :)

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

How to solve Div1 C?

  • »
    »
    7 лет назад, скрыть # ^ |
    Rev. 2  
    Проголосовать: нравится 0 Проголосовать: не нравится
    1. we save the relevant number (1 to n)
      ex) (1,2,3) -> 1 save 2,3 and 2 save 1,3 and 3 save 1,2
      i used set supervising the array
    1. for (1 to n) we find the number that has two sizes of set
      then, that number is what we start to solve the problem
    1. then, keep track of that number
      also erase the already using number from the other set
      the size of set of that number is three , then that is not proper number to keep going

    sorry, i am not good at english.. so i can't write any more

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

    First of all, lock the first and second point. We'll consider other points to be on either side based on those two points.

    We can see that the query $$$(2, 1, i, j)$$$ can tell that in a permutation starting from $$$1$$$, which point will come first: if the response is $$$1$$$, $$$i$$$ comes before $$$j$$$, and the other way around if the response being $$$-1$$$.

    Loop through point from $$$3$$$ to $$$n$$$ to find out if each of them comes before or after $$$2$$$ in the permutation, using the query $$$(2, 1, 2, k)$$$. Here we can see that the points have been separated into two halves.

    For each half, we can see that, following the permutation's order (i.e. the points' counter-clockwise order), the area of the triangle with point $$$1$$$, point $$$2$$$ and point $$$k$$$ forms a bitonic sequence: the area increases until the maxima value, then it decreases. From this knowledge, we may do the following:

    • Use the query $$$(1, 1, 2, k)$$$ for each half to get all the required areas. Pick the point with the maximum area as maxima (if there are many points having the same maximum, pick an arbitrary one).
    • Traverse through the not-chosen-as-maxima points in the area-increasing order, check if it comes before or after the maxima using the 2nd type of query (similar to the aforementioned part). If it comes before the maxima, add it to the left side of the current half, otherwise add it to the right side.

    Total number of queries used will not surpass $$$3n-6$$$.

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

Amazing contest, thanks for it! All tasks were very interesting!

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

bullshit contest.

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

Вопрос к авторам задачи B2: зачем TL в одну секунду? У меня решение за O(n * 12), если вы пытались отсечь такое — то у вас, очевидно, не вышло. А если вы не пытались отсечь, то почему приходится пихать?

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

Div2 C & D are just implementation problems.. got stuck with some sily bug in both..

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

what is pretest 5 in C it's so weird to me it's WA ...

isn't it we just see the first 3 numbers and then we can detect the next number

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

well i thought if div2b if m<n the ans=-1 otherwise just 12/23/34..n1 ans = 2*sum

what's the counter-case?

got it, stupid i am! and thank you

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

How to solve div2B ?

I was thinking of connecting each of them to the 2 with the smallest values

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

    case where you have 3 fridges and 2 chains, your code will fail. answer should be -1.

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

    Solution:

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

      That's incorrect, consider N = 5 nodes with weights 0 1 2 3 4, and M = 6

      After building the cycle with 5 edges, you can remove the edge between 2 and 3 to create two edges between (0 and 2) and (0 and 3), which costs the same and uses all edges instead of creating a new one that costs 1 more.

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

        So to replace a chain between any 2 fridges with 2 chains coming from the smallest-weighted will cost 2*(smallest-weighted). And add a chain between 2 fridges with least values will cost (smallest-weighted + second-smallest-weighted).

        If the first one is smaller then you can just replace any pair of fridges k time. If not, you can add k number of chain between 2 fidges with least values.

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

problem B is bad..

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

wa9 on E1 and pretests passed on E2. cmooon. Does it means that solution differ or threre are just different tests?

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

I was getting wrong in e1 easy. My strategy was to accumualate lowest prime factors of total 1 at one place(middle of that prime factors) . can any tell me what i m doing wrong?

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

Why were constraints for B changed??

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

When you realize that its not the boxes to be shuffled but the units in them in E1.......

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

After one hour of round I see message with words "sorry, we gave you wrong task". What is it?

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

What was the required time complexity for DIV2 c ?

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

Those pretesting times on div1 D...

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

I guess that the std of D is O(n^1.5) . (because of so large time limit)

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

bad div2 B, the first time to get ranked 3k+...

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

What is testcase 2 for div2 C ?

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

Took a long time to implement B & C. Problem D, a zig-zag scan will do but i don't have time to finish it correctly. sad.

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

deleted

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

I thought of a solution for Div2. B as it was originally.Any review would be appreciated : I thought of first making 1 cycle of size N(in case when m>=n) and from set of total edges sorted by weight, to remove edges till my graph contains M edges.Is it a correct solution?Please confirm.

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

Didn't like the problems of this contest, got stuck in Div2/C with some more or less stupid implementation problems. Now, afterwards, having read D and E it would have been better to not work on C.

Afterwards we allways know better.

I was not able to register within like first 10 minutes of contest. That sucks.

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

Not Satisfied with Today's Contest

1 10 10000 1 1 1000 1000 1000 1000 1000 1000 1000 1000

Here is the test case that made me thinking for over an hour in B and finally your announcement came.

Contest should be unrated for everyone

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

Am I the only one who solved div2 D within 50min but could not solve C:(

BTW, how to solve div2 C?

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

I wasted 20 minutes because I missed the $$$p_1 = 1$$$ condition in C (interactive problem). Not reading statements carefully hurts :(

I would highlight it or write something like "all these conditions mean that the output is unique", that would help.

Also, I didn't like the round. Problems A-D didn't require much thinking. Just my opinion.

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

So, what will happen to me because I had 3 WA submits for prob B and after rejudging, I got 3 AC submits in total, tbh I dont like this contest because of rejudging and in prob D, number of rows is r and c for columns and I followed it, then it took me a lot of time to debug because I used variable with same name (in other contest, they use m and n instead of r and c) and I cant like this kind of trick at all. If it had been m and n, I would have been able to solve this prob on time (with some luck). Anyway, I will try my best till I get to my goal. Have a nice day everybody!!

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

What's the correct solution for Div2B in case n < m < 2n — 4? Does greedy work?

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

Wasn't the solution of both the cases (m>n and m<=n) of DIV2 B was to create a cycle and thus the answer will be 2*(sum of weights of all fridges) and if m<n or n=2 answer will be -1 ?

Edit : I think in case of m>n we have (sum of least two weights ) * (m-n) + 2*(sum of weights of all fridges )

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

"If the issue heavily affected you and you want the round to be UNRATED for you, you can fill the appeal form by the link"

Looks like only positive deltas this round!

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

    If people who did poorly withdraw, then this depends on whether the ratings for the rest of us will be calculated based on their absence or presence. If they are ignored when computing our ratings, then we can expect all our deltas to drop, due to our ranking relative to the size of the group diminishing. I hope this does not create a runaway effect, where contestants fear that their rating would drop due to people who did poorly withdrawing, thus withdrawing themselves and exaggerating this effect.

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

If my rating is still increasing after getting affected, will it be unrated for me?

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

Was the modification in Div2 problem B made to simplify it?

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

Even though I might not gain much rating from this contest, It was indeed educational for me, to work on my weak points.Thank you to all the organizers.

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

Implementation problems occur now and then. It's a nice contest overall. Kudos to setters.

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

Too much implementation for a slow coder like me :( Really regret not being able to finish the div2D in time.

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

Thanks for the contest!

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

Deleted .... i am sorry

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

I didn't see the clarification of div2-B ,because I used "m2.codeforces.com" : (

Does anyone have the same situation as me? : (

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

I think Div1-B2's Time Limit is a little severe and I got TLE on the system test...
How to avoid TLE?
My code is following:
https://mirror.codeforces.com/contest/1254/submission/65368643
(I've only used prime numbers as $$$k$$$)

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

It affected me lots but I want this Round to be Rated for me ^^ From Vietnam with love <3

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

I could not really understand what is the issue with div2 B. what is wrong with the case if(m>n).

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

When will editorials be released?

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

Why my 1st AC submission skipped and counted as a wrong submission?? and minimized my score from 748 to 690?? Please check out this issue.(skipped : 65373327 AC : 65391169) Thanks

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

    in normal codeforces rounds(except div3) last pretest passed sollution is judged in maintest. You will also get resubmission penalty. But today's div2 B has a special case. Contraint changed during contest. That may be considered if it is applicable for you.

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

Can someone please tell why this code of div2B is giving TLE? 65391058

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

Back to codeforces after my cultivation days, I became stronger, go to blue!

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

is round rated today?

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

I think that the testcases in D might be weak. My time is 420ms while I'm able to create test on which my program runs 3790ms.

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

    A lot of solutions got TLE on either high-numbered pretests or systests, so they can't be that weak. It's more like your solution happens to not have a strong countertest among these tests. (You can uphack other solutions to find out if it's the case for them too.)

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

      Probably not so many people did it like me and this is strange in my opinion as the solution is very simple.

      If vertex $$$v$$$ has some subtree of size $$$x$$$, then ofc. we want to add $$$(n-x)\cdot d$$$ to all the vertices in the subtree. As there can be at most $$$\sqrt{n}$$$ different sizes of subtrees, we can do the query with $$$\sqrt{n}$$$ operations on BIT.

      Is there anybody who also solved it this way?

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

        Yeah, I solved it that way and used Segment Tree instead. Just hacked myself. 65387642

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

        I too solved it this way and am getting TLE because of unnecessary %mod operations.

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

        I solved it like that but I used a cool trick to eliminate the log factor — sqrt decomposition! When there are many more writes than reads to a data structure like BIT, updates work in $$$O(1)$$$ and queries work in $$$O(\sqrt{n})$$$.

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

        Interestingly enough, it is possible to make this solution faster by applying sqrt-decomposition ideas.

        Fix some $$$k$$$ and do the segment tree operations only for vertices with at most $$$k$$$ different subtree sizes. For vertices with more than $$$k$$$ different subtree sizes (let's call them special), simply precalculate how an update in them with $$$d = 1$$$ "influences" the answers for other vertices.

        I claim that for $$$k = n^{1/3}$$$ the number of special vertices is $$$O(n^{1/3})$$$. The proof is kind of long and technical, so I hid it under a spoiler:

        Proof

        Now, we can handle the queries of the first type in $$$O(k \log n)$$$ for non-special vertices and $$$O(1)$$$ for special vertices: simply increase their value in some separate array. Similarly, the queries of the second type can be handled in $$$O(\log n + \texttt{#special vertices}$$$): the influences of all non-special vertices are taken from the segment tree and the for special vertices we add up their influences separately.

        The total complexity is $$$O(q \cdot n^{1/3} \log n + n^{4/3})$$$. From theoretical standpoint, it is possible make the complexity slightly better by choosing $$$k = (n / \log n)^{1/3}$$$.

        The code is here: 65440117. It runs unnaturaly quickly, probably for the same reason your code did on the contest: there are no tests in the current testset where it achieves its worst perfomance.

        UPD The previous implementation I linked (65398024) had a bug that made it produce incorrect answers on some tests (to be exact, I forgot that vertex influences itself, not only its subtrees). Thanks to alex9801 for the hack.

        UPD 2 I rewrote the proof of the fact that there are $$$O(n/k^2)$$$ special vertices, because the argument I used before did not actually make much sense (you still can see the old argument on the lower edit levels of this comment, if you wish).

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

    Well I personally think for D, there are a bunch of different approaches, solutions and techniques that can be used to solve it. Even just sqrt decomposition, I have currently seen at least 6 or 7 different ways people did it. So I can tell that preparing test cases for this problem was indeed a pain, and the setters did a pretty good job on it (proved by the number of TLEs on System Tests).

    I'm not saying that having an unique way (maybe got TLE on some unprepared test for large const) can give you a free AC on it. But passing all the test cases with a solution that none of the setters and testers were aware of really deserved an AC.

    On the other hand, I really like your approach for it. Learning the fact that all the subtrees having the same size can be treated similarly really made my day.

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

      How does number of TLEs prove anything? Most people had correct asymptotics and struggled with constant optimizations, so to me it seems that TL was pretty bad.

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

    I solved it this way too and was wondering why would it run so fast :/

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

WEAK TESTCASE

I was looking at the solution of Div2 problem B of one of my friends. Although it gives the correct minimum total cost, it prints a wrong network of connection. Here is the code This code got AC but it fails to print out a correct output for the following input:

1

4 6

100 1 100 1

I think the test cases for this problem are very weak

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

Div.1D is very usual I think, at least what about $$$N \cdot \sqrt{N}$$$ solution. Unfortunately, I did not manage to write it fast enough for having time to solve E, so don`t like the contest very much. Although, problem C was interesting for me.

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

By the way,I think Div1-C is one of the best problem in geometry! It's my favorite!

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

Why my submissions are skipped? :/

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

How to solve Div1 — D. Tree Queries?

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

    Have a buffer of $$$\sqrt{q}$$$ queries of type 1. When the buffer is full, flush the answer to permanent storage. For each query of type 2, the answer is the permanent storage for that node + the expected value each of the buffered query gives it. Implement an $$$O(1)$$$ LCA query and you have yourself an $$$O((q+n)\sqrt{q})$$$ solution.

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

    I used HLD and BIT to solve the task. For a modification, add $$$d$$$ to $$$v$$$, add $$$d\cdot\frac{\mathrm{size}_v}n$$$ to all nodes outside the subtree of $$$v$$$, and for each child $$$u$$$ of $$$v$$$, add $$$d\cdot\frac{n-\mathrm{size}_u}{n}$$$ to all nodes inside the subtree of $$$u$$$. But in the last type of modification, we only add to its heavy child, and add a tag to $$$v$$$ which means the subtree of every light child $$$u$$$ of $$$v$$$ is increased by $$$d\cdot\frac{n-\mathrm{size}_u}{n}$$$. When handling a query, find its value on BIT and the sum of all tags on its path to the root.

    Complexity : $$$O(n+q\log n)$$$.

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

My electricity was cut out after the 46 th minute of the contest and i have made some submissions for A. Then i tried to participate from my phone but it is absurd. Can you please make the round unrated for me or at least half rated because i was able to participate less that half a contest, please.Can somebody from the codeforces team try and help me or at least respond . arsijo MikeMirzayanov I appreciate the time.

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

Is Div 2 going to be rated?

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

Thank you for the problems!

Especially Div1C, which went for me, like, "how on earth would this be possible in O(n) while finding convex hull clearly isn't?". Loved it.

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

Will codeforces round #601 div.2 be rated??

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

Is div 2 going to be UNRATED? Because div 1 participants RATING is CHANGED already

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

Is this round unrated? I really wish it isn't:(

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

MikeMirzayanov is it rated?

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

MofK can you add somewhere 'hard' version of div 2 B?

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

I couldn't notice the constraint was changed, and I gave up to solve B. I will lost rating.. but fine. Im looking forward to next contest, and I will recover rating :)

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

Div1 starts at 1900 or 2100. Also when will the rating be updated for last 601 div2.

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

Not able to see rating graph for tourist. Profile P.S :The rating graph is showing now.

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

Hello everyone,

I have tried to make video solution for first three problems hoping to help people understand the problem and what was my approach for the same. Codeforces Round 601 Div2 Video playlist

Please do like the video and do subscribe for more such content.

Happy Coding

Divyanshu Kumar

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

Почему-то рейтинг для див2 не обновился

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

How to solve Div.2 C.?

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

    Observe that there are only 2 different possible solutions and either end point will appear only once in total, so you know where to begin from and the second point will appear in a triplet with your assumed first point and have a total frequency of 2, rest you can follow up from there checking points, in triplets where 2 of the points have been placed in order already.

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

Hey, guys! I have a small questions. My idea for problem E sounds like this. Compute the sum of all values in the array. Now we know that if we have k which should divides all numbers in the array, then k should divide the sum. Therefore, I need to check all divisors of sum and see the minimum cost. For a divisor d of the sum, I do the following:

  1. Change v[i] with v[i] % d. Because I am interested only in what sweets (or whatever they are) should be moved.

  2. Go from left to right, find d sweets and move all of them at the index of the (d + 1) / 2 sweet. Do this with two pointers to have O(n).

Now, we also notice that we do not need to check all divisors because if we have d % d1 == 0, then the answer for d is greater or equal than the answer for d1. Therefore, we have to check only the prime factors of the sum.

With this solution, I got WA on test 50 and I have no idea why. This is the submission: 65391533

If someone can explain what I do wrong here or maybe you see a case where my solution is not correct, I would appreciate it. Thank you! Have a good day everyone!

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

When will ratings get updated. It still says afternoon. What is the time zone exactly.

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

Does November/20/afternoon mean next year?

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

Terrible contest

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

Game Theory Problems seldom appear. They should occur more frequently!!!!

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

when will the rating be updated of this contest

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

When the rate of DIV2 will appear ?

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

sometimes you have to wait for afternoon too...not evening :)

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

Any updates regarding ratings ?

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

orz

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

.

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

why rating changes are not appearing for this contest?

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

afternoon 2020 :)

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

Why it happened again?

10enf1.jpg

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

MikeMirzayanov your message is being displayed in "Russian" when I have opened codeforces in "English" and vice versa.

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

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

i am new to codeforces platform.i took part in codeforces round 2 divison ,i solved few questions but i am still unrated . how and when is the rating awarded ?pls help

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

May i please know why most of the B solutions are remained as pretests passed and why B problem is not considered in the total score ?

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

    Maybe Checker is checking 1st version of problem's solution who has solved it and the 2nd version and making the penalty score perfect by Compairing those, rating will be some called perfect if it does.

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

I want this round unrated for me but i couldn't find the form.

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

Finally rating changes into effect :3

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

Finally rating changed.

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

I solved one Problem and got 174 score but i became Newbie from Pupil. Why!!!!??? [Note : My previous rating was 1242!!]

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

ez problems

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

what is the "wrong output format Unexpected end of file — int32 expected" mean ? why my code can't pass the pretest 5 ? div2 601 problem C

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define fp(i,a,b) for(register int i=a;i<=b;i++)
#define mp(a,b) make_pair(a,b)
const int MAXN=4e6+5;
struct Node{
	ll a[4];
}node[MAXN];
int n,root,head,en,a[4],b[4],fa[MAXN],son[MAXN];
map<pair<int,int>,int > book;map<pair<pair<int,int>,int>,int> p;
vector<pair<int,int> > v;vector<int> vv;
inline void ycl(){
    fp(i,1,n) fa[i]=son[i]=i;
    fp(i,1,n-2){
    	fp(j,1,2){
    		fp(k,j+1,3){
    			book[mp(node[i].a[j],node[i].a[k])]++;
    			if(book[mp(node[i].a[j],node[i].a[k])]==2) 
				v.push_back(mp(node[i].a[j],node[i].a[k]));
			}
		}
	}
}
inline int judge(int x){
	if(fa[x]==x&&son[x]==x) return 0;
	if(fa[x]!=x&&son[x]==x) return -1;
	if(fa[x]==x&&son[x]!=x) return 1;
}
inline void rt(){
	fp(i,1,n){
		if(fa[i]!=i&&son[i]==i) root=i;
		if(fa[i]==i&&son[i]!=i) head=i;
		if(fa[i]==i&&son[i]==i) vv.push_back(i);
	}
}
int main(){
	scanf("%d",&n);
	fp(i,1,n-2){
		scanf("%d%d%d",&a[1],&a[2],&a[3]);
		sort(a+1,a+4);
		fp(j,1,3) node[i].a[j]=a[j];
		p[mp(mp(a[1],a[2]),a[3])]=1;
	}
	ycl();
    fp(i,0,v.size()-1){
    	int x=v[i].first,y=v[i].second;
    	if(!judge(x)){
    		int num=judge(y);
    		if(!num) son[x]=y,fa[y]=x;
    		else if(num==1) son[x]=y,fa[y]=x;
    		else son[y]=x,fa[x]=y;
		}
		else if(judge(x)==1) fa[x]=y,son[y]=x;
		else son[x]=y,fa[y]=x;
	}
	rt();int cnt=0;
	b[++cnt]=vv[0],b[++cnt]=root,b[++cnt]=fa[root];
	sort(b+1,b+cnt+1);
	if(p[mp(mp(b[1],b[2]),b[3])]) fa[vv[0]]=root,fa[head]=vv[1],son[vv[1]]=head,son[root]=vv[0],en=vv[0];
	else fa[vv[1]]=root,son[root]=vv[1],fa[head]=vv[0],son[vv[0]]=head,en=vv[1];
	/*
	while(en!=fa[en]){printf("%d ",en);en=fa[en];}
	printf("%d\n",fa[en]);
	*/
    while(en!=fa[en]){
    	printf("%d ",en);
    	en=fa[en];
	}
	printf("%d\n",en);
	return 0;
}
/*
5
4 3 2
2 3 5
4 1 2
*/
»
7 лет назад, скрыть # |
 
Проголосовать: нравится +5 Проголосовать: не нравится

Round was really interesting!) Also it was very successfull for me=)

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

For the Point Ordering problem, the problem states the following about cross product:

Recall that the cross product of vector (xa, ya) and vector (xb, yb) is the integer xa * yb — xb * ya. The sign of a number is 1 it it is positive, and −1 otherwise. It can be proven that the cross product obtained in the above queries can not be 0.

But the example given says: Contestant asks a query with t = 2, i = 1, j = 5, k = 6. Jury answers −1. The cross product of A1A5 (2, 2) and A1A6 (4, 1) is −2. The sign of −2 is −1.

2 * 1 — 4 * 2 = -6, not -2, right? Can someone explain about the cross product definition here?