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

Автор Brovko, 19 месяцев назад, перевод, По-русски

Привет, Codeforces!

Мы приглашаем вас на Codeforces Round 823 (Div. 2), который состоится в 25.09.2022 17:35 (Московское время). У вас будет 2 часа на решение 6 задач.

Задачи вместе со мной придумывали и готовили shnirelman и Lankin.

Мы хотим поблагодарить:

Желаем удачи и высокого рейтинга!

Разбалловка будет опубликована ближе к началу раунда.

UPD: Разбалловка: 500 — 1000 — 1500 — 2250 — 2250 — 3000.

UPD2: Разбор: https://codeforces.com/blog/entry/107293.

UPD3: Победители.

Div1:

  1. heno239
  2. Um_nik
  3. maspy
  4. jiangly
  5. ksun48

Div2:

  1. billieeyelash
  2. PokerCareer
  3. simiao1986
  4. i_will_be_less_than_blue
  5. Timonnable
  • Проголосовать: нравится
  • +144
  • Проголосовать: не нравится

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

What happened to Pinely Codeforces Round 1 ?

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

Brovko The announcement says it will be 2 hrs, but in contests page it shows 2.30 hrs. What is the right one lol

upd.: fixed

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

As a participant,I'm hoping for a great round OvO!

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

isn't this contest's previous name Pinely Codeforces Round 1 ?

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

Hope to beat my previous best! Everyone wants the same right? Good luck!!

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

Lol i got pinged

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

hoping for more than +2 delta

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

Brovko round! Will be pleasant to partake!

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

I want to be a pupil❤
Why even I don't reach pupil and continue to get negative rating!(⊙_⊙)?

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

Why was this changed from a combined round to D2?

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

Is this Round be rated or unrated?

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

When will the score distribution be announced?

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

Something strange has happened to me.

Days ago I found I'm unregistered and I couldn't register this round, a black message block appeared at the bottom right corner telling me that my rating should be between 0 and 2099. And I could only find people who are under 2100 in the namelist.

But this kind of black block just appeared in rounds like #814 before.

Yesterday I found I've already registered it. I can find my name in the last page of namelist. It may mean I'm among the first ones who registered.

Is it a bug?

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

lucky

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

Cool Scoring distribution. Will try to solve 5/6.

upd: failed

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

    can you please tell me whats is the meaning of rollback what is the meaning of this line " Rating changes for last rounds are temporarily rolled back. They will be returned soon."

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

it is said that good luck is hiding in the problems !!!

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

I will become specialist after this round

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

My first contest in like 3 weeks.

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

tough

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

The best B problen I've seen.(Joke)

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

Unbalanced Round. -_-

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

How unbalanced do you want the contest to be?
Authors: YES!

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

Unbalanced Round :(

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

B and C need to be swapped LOL twice as many C solves as B

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

Even I like the idea of B it was too hard to be B

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

Am I the only one who still does not understand Problem B?

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

190 years for getting dressed :-| !!

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

Oh my god! I cannot even imagine that I could officially be top 20 in a div2 contest.

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

B > D and this is not even a joke. If D stood instead of B and people believed that it was easy, then many times more people would solve it

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

    it requires absolutely no algorithmic skills and even worse, it is easy to pass with an intuitive solution without proof

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

    I have no idea how to solve D, though spent a lot of time on it

    But for B it was a clear ternary search from the start

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

      also used ternary search, but have another idea:

      smth like go from left to right, remember worst person to the left and to the right, only a new one can become worse than the left worst, because with each movement a constant is added to all The worst on the right can be tracked, for example, by initially calculating the time for each to reach 0 and sorting them by it

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

      Binary search works too

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

      I don't think ternary search is needed for B Please look at my submission 173464664

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

        I did use a similar logic, but during contest I did not sort the final results before taking the average of the first and last element of the array.

        Only got AC after contest ended.

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

      Huh. Was buffering output really the only difference between your TLE/AC submissions for B? Is that depressing or weird? I can't even tell anymore :P

      But otherwise, usual gripes: how hard is it to just ask "when and where can everyone meet at the earliest?" (grumble wtf is even summary in the clarification?)

      edit: oh, changed epsilon, duh (also 'summary' meant for 'summation'... uhgh)

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

        Yeah, buffering shouldn't have affected so much for t=1000

        Also I only intended to change eps as constant factor optimization But apparently it lead to some kind of infinite loop because of precision issues

        I didn't think about it during the contest but for big numbers step of 1e-10 does not exist, so while loop becomes infinite

        1e8 + 1e-12 == 1e8
        True
        
»
19 месяцев назад, # |
  Проголосовать: нравится +14 Проголосовать: не нравится

The problem B is good example why Codeforces EDU section is helpful

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

I'm wondering what B's pretest 3 is. Got many WAs on that pretest.

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

    cout<<123456789.5<<endl; and you will get 1.23457e+08 in the output I believe this is the reason

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

      Should the test system consider both as correct? I think the problem statement didn't say "scientific notation is not allowed".

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

        scientific notation losses the accuracy by only reserving certain number of digits

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

          Oh, OK, but such issues aren't related to algorithms / problem solving. I wasn't even aware of this thing before.

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

      It got me too :( Could have solved ABCD otherwise :(

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

      i had no idea about this:))

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

    I think you made the same mistake I kept on making for an hour. Basically, (a+b)/c, where c is a double and a, b are ints, returns a double in scientific notation. You need to convert that scientific notation to a decimal.

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

How to solve D?

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

    The idea is simple first of all, imagine two strings, Reverse of $$$s_1$$$ and orginal $$$s_2$$$. Now everytime you perform an operation, you select a suffix of length $$$k$$$ from both the strings, reverse them and swap them. It simplifies the problem (makes it easier to visualize).

    So, first reverse $$$s_1$$$. i.e $$$s_1 <= reverse(s_1)$$$ Now, with a bit of playing around you can prove that you can

    1. Swap any letters at position $$$i$$$, $$$s_1[i]$$$ and $$$s_2[i]$$$. (i.e exchange the letters at position $$$i$$$ of both the strings. Note that $$$s_1$$$ is not the original $$$s_1$$$, it is the reversed string).
    2. Swap any pairs $$$(s_1[i] , s_2[i])$$$ and $$$(s_1[j] , s_2[j])$$$, for any index $$$i$$$ and $$$j$$$.

    Now its easy to solve!

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

      Swap any pairs (s1[i],s2[i]) and (s1[j],s2[j]), for any index i and j

      How?

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

        It's sufficient to prove that I can swap any adjacent pairs $$$(s_1[i],s_2[i])$$$ , $$$(s_1[i+1],s_2[i+1])$$$ without affecting the rest of the strings.

        Another observation: You can cyclic shift the pairs right by $$$1$$$ unit $$$(s_1[i],s_2[i])$$$ , $$$(s_1[i+1],s_2[i+1])$$$ , $$$(s_1[i+2],s_2[i+2])$$$ ..... $$$(s_1[n],s_2[n])$$$ thus getting $$$(s_1[i+1],s_2[i+1])$$$ , $$$(s_1[i+2],s_2[i+2])$$$ , $$$(s_1[i+3],s_2[i+3])$$$ ..... $$$(s_1[1],s_2[1])$$$

        By performing operation $$$k=1$$$ , $$$k=n-i+1$$$, $$$k=n-i$$$ in order. (I will denote it by $$$(1,n-i+1,n-i)$$$ from now on).

        Now to swap $$$(s_1[i],s_2[i])$$$ , $$$(s_1[i+1],s_2[i+1])$$$. You should keep shifting the portion $$$[i+1,n]$$$ to the right until $$$(s_1[i+1],s_2[i+1])$$$ reaches the end of the array. More formally, shift right $$$n-i-1$$$ times on the portion $$$[i+1,n]$$$.

        Then, perform one right cyclic shift in the portion $$$[i,n]$$$. Voila! You swapped the adjacent pairs! (Rest of the strings remain unchanged!).

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

was B binary search?

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

    no. it requires ternary search!

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

      Binary search also works here

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

      There is a simpler solution: (min(a[i]-t[i])+max(a[i]+t[i]))/2

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

        Can you please describe your intuition behind it?

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

          Draw straight lines (rays up) at an angle of 45 (with coordinate axes) with centers at points (x_i, t_i). Then you need to understand that these lines are this place-time where a person from a point (X_i, T_I) can get. Further, it becomes clear how to look for the optimal place of the meeting — the intersection of the "most left" min(a[i]-t[i]) straight and "right" max(a[i]+t[i]) straight line.

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

      I solved it with binary search. Just search for time and for each time and each person look the range of coordinates he can visit. If the intersection of all persons is not empty — this time is good and you can decrease it

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

    ternary search, but what was testcase 3 :((

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

    yep

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

    You could binary search, yes.

    But you could also just calculate the minimum $$$x - t$$$ and the maximum $$$x + t$$$ and take the midpoint as the answer.

    Proof: If the same person has both the minimum $$$x - t$$$ AND the maximum $$$x + t$$$, then this person is taking a crapton of time to get dressed, and everybody else can reach this location by the time this person is done.

    Otherwise, suppose person $$$P$$$ has the minimum $$$x - t$$$ and person $$$Q$$$ has the maximum $$$x + t$$$. Since $$$P \neq Q$$$, this means $$$x_P < x_Q$$$ (otherwise, whoever has the higher $$$t$$$ would have claimed the other's rank). The claim is that the ideal midpoint is $$$\frac{x_p - t_p + x_q + t_q}{2}$$$. It's easy to see that $$$P$$$ and $$$Q$$$ will spend the longest time to reach this point, compared to everyone else, since anyone who spends longer time will either have a lower $$$x - t$$$ than $$$P$$$ (if they were moving right) or a higher $$$x + t$$$ than $$$Q$$$ (if they were moving left). Here, $$$P$$$ and $$$Q$$$ take the same amount of time, and it's the optimal time, because changing the position in any direction will cause one of $$$P$$$ or $$$Q$$$ to spend more time to get there.

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

      well however if the mid point<xmin then xmin is the answer. Same for xmax. I missed the point and solved the problem in hard way

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

        There are no further cases to consider if you just choose the midpoint of the minimum $$$x_i - t_i$$$ and the maximum $$$x_i + t_i$$$. 173500218.

        If there was some case you missed that caused your submission to fail, I would guess that you used a different (and likely more complicated) approach than this simple min/max and midpoint calculation.

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

          I didn't use setprecision in double . thats why I got wa — _ -

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

    I used binary search,but got TLE at point 4.

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

This is the worst round I've ever participated in.

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

u regret wasting time on B and not trying C dont u?

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

In contest : swap(Problem B, Problem C) :(

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

Wasted about 30 minutes thinking of $$$B$$$ and solved $$$C$$$ in like 15 minutes

why didn't you swap $$$B$$$ and $$$C$$$ :(

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

What happened to problem B, whick I have been thinking about 2 hours? (I know that I'm stupid, but I'm not the only one who failed the task)

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

Someone give me a hint for B so I can feel stupid.

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

    Find the minimum value of $$$x_i - t_i$$$ and the maximum value of $$$x_i + t_i$$$ (they can overlap). The answer is the midpoint of these two values.

    You shouldn't feel stupid though, because even though it's actually not that hard to prove this result, I think it's very difficult to actually come up with this idea with enough confidence that it might work, before one can consider trying to prove it.

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

How do you solve B? I tried a ton of different things but none of them worked :(

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

    use ternary search

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

    An alternative solution to binary/ternary search:

    For each person, we create two new locations, the location that is t[i] units to the left of the person and the location that is t[i] units to the right of the person. Now we find the location among these locations that is furthest to the right and then the location among the locations that is furthest to the left and pick the location exactly in the middle between them.

    However, I did not prove this solution and it might not work after the system tests, but it just felt right. The main reason for this idea is that in an optimal solution there will be a latest person that comes from the left (and arrives at the same time as if he was t[i] units to the left of where he originally started), and there will be a latest person from the right. If these people do not arrive at the same time it is probably not the optimal location because you can move the location closer to the person that comes later.

    A cool thing about this solution though is that it can run in O(n) and not O(nlogn) like most other solutions.

    Edit: This solution does in fact work since it passed system tests

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

Video Solution for Problem B,Problem C.

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

Today's round was GeometryForces brought to you by: B

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

    "Mom, can we have subtractions in absolute value?"

    "No, we have subtractions in absolute value at home"

    Subtractions in absolute value at home:

    Geometry

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

      ok but I interpreted it as intersection of straight lines (or the graph precisely) on a x-y plane tho

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

I think B is more difficult than C even D.Is this order a joke?I spend so much time on B and any solve three problems finally.I feel so sad.

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

Problem D solution was leaked on youtube :(

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

any hint or the solution of B ?

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

Although B > C, I enjoyed solving problem B.

My idea
»
19 месяцев назад, # |
  Проголосовать: нравится +44 Проголосовать: не нравится

I think this is too hard for a Div. 2 round

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

I honestly think B is too hard for a Div2B. It was only after room scanning that I learned that taking the midpoint between the minimum $$$x - t$$$ and the maximum $$$x + t$$$ yields the correct answer, but despite this leading to an extremely simple solution, the reasoning to arrive at such a conclusion is extremely difficult to achieve, imo. Most approaches seemed to involve binary searching instead, which I don't think should be a necessity for a Div2B.

I also hate floating point numbers and kept getting wrong answers because I didn't know how to set the precision until I looked it up. I really don't think it's justified for a Div2B to punish those who don't know how to deal with floating point precision. EDIT: Yes, I confirmed that the issue was floating point precision. Although the answer only requires one decimal place, the use of a floating point type (I used long double, in particular) limits the default number of significant figures to be displayed, so you need to set the precision to pass.

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

    Was it really about floating point precision??? I did a solution where I sorted the $$$x[i]$$$, could obtain the minimum time assuming the meeting point is in between each segment($$$x[i]$$$ and $$$x[i+1]$$$) in $$$O(1)$$$, checked the time taken if meeting was at each $$$x[i]$$$, and still got it wrong... I am extremely demoralized, normally I'd walk away from a contest thinking I'd learn something but that was just terrible, the difficult D and E didn't help either

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

Why is the standings frozen?

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

My approach for B: Let idx be the index of the person with the maximum dressing time. Now, until this person gets dressed, move all other people "towards" person with index idx(only for the remaining time). Finally, just output (min + max)/2.

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

    Oh nice, very creative idea!

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

    What if there are many person with same max_dressing time?

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

      You can actually pick any of them. Consider a case where you only have 2 of them. Let x1 and x2 be their coordinates (x1 < x2).

      All people to the right of x2 move towards x2, and all people to the left of x1 move towards x1. The middle ones can move in any direction, but that doesn't matter because they aren't the extremes.

      You can easily generalize this notion by induction for >2 people with same dressing time.

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

Hey Brovko!!! In the problem D (prefixes and suffixes) , the ans will be "YES" for this input, 6 abadaa adaaba BUT YOUR OUTPUT IS SHOWING "NO".

Initially s1=abadaa, s2=adaaba. Operation with k=5, after the operation s1=bbadaa, s2=adaaaa. Operation with k=2, after the operation s1=dbadaa, s2=abaaaa. Operation with k=4, after the operation s1=abadaa, s2=abadaa.

now both strings became equal. if anyone see my fault, then please correct me ... Thankyou

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

Solution for A was leaked (https://www.youtube.com/watch?v=gHxV9jwwJyk). Solution for C was leaked (https://www.youtube.com/watch?v=VhZytayYfhk). Solution for D was leaked (https://www.youtube.com/watch?v=QWYxr-IEwE0).

Somebody ban SecondPractice who posted solutions and others who cheated.

Brovko shnirelman Lankin MikeMirzayanov

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

    Yea seems like a lot of people copied C, because C wasn't that easy, these incidents keep ruining the performances of those who participate fairly.

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

Although (scoring distribution) vs (# of AC) is not good as a result, I guess it's hard to estimate the difficulty of this kind of B, and I like the problems itself. Thanks for the writers' work!

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

Only solved 1 problem in Hacker Cup. Only solved 1 problem in CF-823. Can't even all kill LeetCode Weekly.

What a wonderful weekends!

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

    It's ok. We all have some bad times, look at my plot for example

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

      Well (my delta for this round is -47 as well)

      Guess I'm saving my luck for my school's TST in 2 weeks

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

problem B, if we consider n function yi = ti + |xi — x0|, then the answer will be the x value of their "intersection point".

to get the intersection, one can refer to editorial code of this problem

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

Why are standings frozen?

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

And here i thought i would solve the first 2 questions this time....

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

what is "standing frozen"?

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

С таким количеством слитых задач, не удивлюсь если опять анранкед раунд будет

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

Not sure why my B is wrong what's important is the maximum xi+ti value to meet the minimum xi-ti value right? And taking care the values don't cross the maximum and minimum xi but i got WA on 3

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

Was not even aware of the C++ scientific notation / std::set precision things before. Got WAs on B for this single stupid reason.

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

    You got to be kidding me, I just edited my contest solution, adding "set_precision" and got AC, I assumed that just defining all variables with long double will work, I have never felt worse after a CP contest ever

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

      Same. My ranking would've been halved if I just put setpercision on my first attempt.

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

-10 social rating for authors

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

Can anyone explain me, how removing cin.tie and ios_base from my code made it correct(without using scanf/printf and cin/cout at the same time)? Proofs:

173471466 and 173471909 in C(somehow gives empty strings with them )

173456777 and 173466682 in B(mystical ML with them)

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

    You should put them first in main().

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

      Thank you, I have already understood. It's funny that it works with some compilers/arguments and not with others

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

How to find cheaters?

Spoiler
  • »
    »
    19 месяцев назад, # ^ |
    Rev. 2   Проголосовать: нравится -16 Проголосовать: не нравится

    [deleted]

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

      I'm talking about low rank people who solved D.. sure not all who solved it are cheaters

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

    actually he's right. just skip (but better ban) those whose solution looks like:

    I understand, that a lot of people pings you in comments, or you might already know about this situation, but MikeMirzayanov, geranazavr555, can you, please take this into account, while searching for cheaters? If needed, I can personally provide handles of few people with solutions like the one from above

    p.s. link for video if needed:

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

    By the way, I found 150+ cheaters using my submission parser. It looks for weird chars like '10' or '20'.

    UPD. Thanks to Codeforces team for removing these cheaters!

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

How should I know that I need to put cout<<fixed<<setprecision(6) at the end? I wrote fricking segment tree to solve B and this is my only mistake.

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

Will this round be unrated due to solution leaking? It seems hard to prevent someone posting solution on YT during contest though:(

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

On what topic the second question was based on?

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

For B: The difference between during contest and after contest

cout << fixed << setprecision(10);

CRY !! CRY !! CRY

https://codeforces.com/contest/1730/submission/173497432 (after contest) https://codeforces.com/contest/1730/submission/173477171 (during contest)

My logic was to find the max dressing time and make others go towards the lazy dresser till he/she finishes. Then take the mean of the farthest 2 person's position

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

WOW!!
Ones who solved C is more than ones who solved B XD

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

I solved problem B easily but couldn't solve C. Don't know whether to feel sad or happy about this.

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

Problem B

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

Solution for D:

Note pairs:$$$(a[0],b[n-1]),(a[1],b[n-2]),...,(a[n-1],b[0]).$$$

In pair $$$(a[i],b[j])$$$,if the final position of $$$a[i]$$$ is determined,then $$$b[j]$$$'s position is also determined.

For example,$$$a[i]$$$'s final position is $$$x$$$ in the $$$2^{rd}$$$ string,we can get $$$b[j]$$$'s position is $$$(n-x-1)$$$ in the $$$1^{st}$$$ string.

Now let's check the answer.

If $$$n$$$ is even,

check if we can match each two pairs $$$(a[i_1],b[i_1])$$$,$$$(a[i_2],b[i_2])$$$ ,such that $$$a[i_1]==b[i_2],b[i_1]==a[i_2]$$$ or $$$a[i_1]==a[i_2],b[i_1]==b[i_2]$$$.

In other words,each number of occurrences of pair $$$(min(a[i],b[i]),max(a[i],b[i]))$$$ must be even.

If n is odd,

Similiar to the method above but a bit different.

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

    If you've shown that such pairs are invariants to the operation it would prove the necessity of this condition. For complete proof of the solution sufficiency also should be proven

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

    Shouldn't it be $$$a[i_1] == b[i_1], a[i_2] == b[i_2]$$$ or $$$a[i_1] == a[i_2], b[i_1] == b[i_2]$$$?

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

      It should be $$$a[i_1]==b[i_2],b[i_1]==a[i_2]$$$ or $$$a[i_1]==a[i_2],b[i_1]==b[i_2]$$$.

      Assume $$$a[i_1]$$$ is in the $$$1^{st}$$$ string,the two(equal)strings look like:

      $$$... a[i_1] ... a[i_2] ...$$$

      $$$... b[i_2] ... b[i_1] ...$$$

      or

      $$$... a[i_1] ... b[i_2] ...$$$

      $$$... a[i_2] ... b[i_1] ...$$$

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

173499940 why I am getting tle though the solution is O(n) for question b

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

    Didn't dive in the specific testcase, but you are doing ans=d under some condition, while looping until d<=ans+1, so this might happen quite a lot and cause TLE.

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

Solved B right after the contest sadge

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

Wtfffff double may not catch 0.5 without setprecision for numbers under 10^9 this is really sad my rating would have greatly increased

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

The winner list is nothing similar as the correct one. What happened?

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

For problem B, how does one know they need to use cout << fixed during the contest? Or is it purely from experience? I have never had a situation like this before and I think it would be impossible for me to solve this question.

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

    I had experienced it once before. From next time you will be aware of it, take it positively :)

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

I found my solution to B after visualizing it in a coordinate system.

For each ($$$i$$$-th) person, I plot the piecewise function $$$y=f_i(x)=|x-x_i|+t_i$$$ in a coordinate plane. ($$$f_i(x)$$$ is the total amount of time required for $$$i$$$-th person to get dressed and get to the meeting located at $$$x$$$)

Then, I plot the piecewise function $$$y=f(x)=\max_{i=1}^n{f_i(x)}$$$ in the same coordinate plane. (The curve of this function is made up of segments, which actually compose the upper bound of curves plotted in the previous step)

And then, I can see the answer, which is the x coordinate of the lowest point of the curve $$$y=f(x)$$$.

What remains is an elementary mathematics problem, which is not too hard. (Just find the two segments with highest intercepts, one of which has a slope of 1, the other has a slope of -1. Then compute their intersection point)

So, that's how I solved it.

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

    This solution is intuitive & it reduces to the "classic" solution on the editorial once you note that the two segments with the highest intercepts correspond to the minimum and maximum (x_i — t_i) and (x_i + t_i).

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

My idea for B:

We know the answer is bounded by the max and min position of people. We only need to worry about the latest person arrived, so at each position we only care about the one with the longest prep time.

Define left[i] as the time it takes for everyone left of i (included i) takes to arrive at i Define right[i] as the time it takes for everyone right of i (included i) takes to arrive at i

Obviously if the meeting point is at i then it'd be max of left[i], right[i] If the meeting point is between i and i + 1, then we can find the difference between left[i] and right[i], take whatever left of that segment divided by 2.

This problem is heavy implementation imo. Very hard for Div2B, at least a 1700-1800 rating

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

WA Submission AC Submission

Welcome to life, where you get penalised for stupid little compiler problems ;-;

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

In problem B , will the graph between X(meeting point) and the time be a parabola?

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

B

Binary_search solution
Ternary_search solution

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

https://codeforces.com/problemset/problem/782/B

Just go through this problem, i find this problem very similar to todays Round 823 Problem B

Please look into it, Mike.

Thanks in advance

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

    Nahh, it's not copied it just has similar way to observe the solution but not completely the same. As supposin' that both of them are the same we can also confirm that B782 has absolutely the same approach as in Edu_binary search step3A.

    Having the same algorithm to solve or nearly same observation doesn't mean they are completely similar!!

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

Hello would you please review my code for problem B? 173484519

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

    Failed 6 times during contest...

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

      you've just had to add "cout << setprecision(15) << fixed"

      here is an accepted solution with your code:173541867

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

        Thank you very much!!! I add you to my friend list ^_^.

        I have been stuck so many times because of a lack of my basic skills. I have to improve it. With this line, I might become blue because I finish this code in a very short time, but finally, my score dropped a lot. This issue makes me very frustrated and upset.

        By the way, I am still confused: Why does my submission fail to work without the setprecision line?

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

          I understand you, last three contests have really been destroying for me..

          And what about setprecision: as far as I know, cout doesn't work well with doubles at all.. Though we can think that double provides really good precision, when we try to output it, we can actually get into trouble because we didn't tell to cin we do really want this precision. So, if I have to work with doubles i just add this line to my code immediately. I'm really sorry if my explanation is not so clear, but i'm really sure that you can find more information in different codeforces blog, if you didn't get it :)

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

            I remember next time that cout for double is crazily buggy and next time I will avoid it~. My code looks very weird because I "finetune" a lot of "hyperparameters" (eg. 3e-7). I was very desperate yesterday. Anyway, I never think of the setprecision line so I deserve losing the score...

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

Thank this round for reducing my rating by 98 points, I mean I have no mental load any more, I will focus on the knowledge and the problem itself rather than the rating

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

There is a BIG gap between C and D! C's rating is 1200 while D's rating is 2200.

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

E and F are both 2700 ranking. clist.by gives E 2945, which is even higher than F's 2896. But E only has 2250 points. This is not balanced. Considering B is also somehow harder than C (1572 vs 1214 by clist.by), The balance of this contest is not good.

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

I got rk3 in this contest and appear in the winner list, which is best of myself, and become IM first time. And when I solved E, I found I'm the first one in rated list. Really a big breakthrough of myself.

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

Nice contest, now i think D is harder than C not a little.

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

B

The horrible problem B

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

I am trying to implement B by the Binary Search Method given in the Editorial. I am not able to get why it is not passed if we use long double instead of long int in the calculation of diff in the following code. Can anyone help? Brovko shnirelman

Link

If we replace ld by ll in diff then it passes the TC. Link: https://codeforces.com/contest/1730/submission/185451105

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

    You need more than $$$30$$$ iterations for non-integer binary search.