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

Автор vovuh, история, 4 года назад, По-русски

<almost-copy-pasted-part>

Привет! В 24.02.2020 17:35 (Московское время) начнётся Codeforces Round 624 (Div. 3) — очередной Codeforces раунд для третьего дивизиона. В этом раунде будет 6 или 7 задач (или 8), которые подобраны по сложности так, чтобы составить интересное соревнование для участников с рейтингами до 1600. Однако все желающие, чей рейтинг 1600 и выше могут зарегистрироваться на раунд вне конкурса.

Раунд пройдет по правилам образовательных раундов. Таким образом, во время раунда задачи будут тестироваться на предварительных тестах, а после раунда будет 12-ти часовая фаза открытых взломов. Я постарался сделать приличные тесты — так же как и вы буду расстроен, если у многих попадают решения после окончания контеста.

Вам будет предложено 6 или 7 (или 8) задач и 2 часа на их решение.

Штраф за неверную попытку в этом раунде (и последующих Div. 3 раундах) будет равняться 10 минутам.

Напоминаем, что в таблицу официальных результатов попадут только достоверные участники третьего дивизиона. Как написано по ссылке — это вынужденная мера для борьбы с неспортивным поведением. Для квалификации в качестве достоверного участника третьего дивизиона надо:

  • принять участие не менее чем в двух рейтинговых раундах (и решить в каждом из них хотя бы одну задачу),
  • не иметь в рейтинге точку 1900 или выше.

Независимо от того являетесь вы достоверными участниками третьего дивизиона или нет, если ваш рейтинг менее 1600, то раунд для вас будет рейтинговым.

Спасибо MikeMirzayanov за платформы, помощь с идеями для задач и координацию моей работы. Спасибо моим очень хорошим друзьям Дарье nooinenoojno Степановой, Михаилу awoo Пикляеву, Максиму Neon Мещерякову и Ивану BledDest Андросову за помощь в подготовке и тестирование раунда.

Удачи!

</almost-copy-pasted-part>

Спасибо Артему Rox Плоткину и Дмитрию _overrated_ Умнову за помощь с тестированием раунда!

UPD: Оказалось, что в текущей задаче C возможен тест, когда ответ переполняет 32-битный целочисленный тип (int). Так как такого теста не было в наборе тестов, то многие участники совершили такую ошибку. Мы решили запретить такие тесты, дополнительно гарантировав в условии, что ответ помещается в int.

UPD2: Разбор опубликован!

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

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

[DELETED]

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

Finally a good freaking round

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

Can anyone help me how to hack a solution ? With detail's . Thanks in advance.

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

    On the dashboard, click the padlock icon for locking a problem (Note, that you can not send your solution for a problem after locking it). Then go to room results, where you can see roommates codes for the problems you've already locked (you can see a certain solution by double clicking on it in the room results table). After you've opened someone's solution, you can consider it and then hack it. When hacking a code, you're entering some testcase on which that code is most likely going to fail (it may be wrong answer, or running out of time/memory limit). When you want to enter a large testcase, you can send test generator instead of typing it. Test generator must be your program which produces a file with a testcase in it. After hacking a code, you can see hacking results. There are two possible outcomes: "Successful hack" — it means the code failed, and you're rewarded with 100 points for that. Otherwise, it's "Unsuccessful hack" (the code did not fail) and you get minus 50 points for that.

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

    In div.3/educational contests, you can not hack any solutions during the coding phase. In the hacking phase which follows the coding phase and lasts for 12 hours, you can hack any solution. Just double-click somebody to view his/her submissions and then click "hack it!" button.

    there will be no points for successful hacking attempts and no penalties for unsuccessful ones in div3/educational rounds.

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

3 rounds in 2 days is very cool!

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

.

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

.

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

Div3 gives confidence

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

Is it rated?

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

    It's rated for Newbies, Pupils and Specialists. It is also rated for Experts who have taken part in at least two rated rounds (and solve at least one problem in each of them).

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

I don't like only Div.3 contest. Actually most people is more than 1600.

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

    But in last div-3 contest there was 9000+ participants!

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

    But they can take part out of the competition. It won't decrease the happiness of doing a contest. So Div.3 is very nice since it's easier and more people can have fun!

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

If you want more contests so please donate the codeforces 1000$ or more

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

    But I don't have enough money to donate.Actually I am hungry, for I don't have money to eat rice.

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

If i register the contest but will not submit in the contest, will my rating change?

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

Exiting to join the contest <3 Hope that I can solve A-B-C and dont get any stupid mistakes <3

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

Let's Hope Everyone gets a positive change in their ratings :)

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

Smiley face

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

Sorry I am a newbie,I wanted to ask what does it mean "The penalty is 10 minutes".Is it literal that 10 minutes will be deducted from our time,if we have a wrong submission or is it something else?

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

    Short answer:

    No it doesn't, it just is basically something that makes your score for that problem worse.

    Long answer:

    Basically in Div3 (and Educational Rounds or any other rounds that follow ACM-ICPC format), your score is calculated a bit differently from normal CF rounds. Participants are first ranked by the number of problems they solved. After that ties are broken by a so called "penalty".

    This penalty has two parts to it:

    • The sum of times of your submissions.
    • The wrong answer penalty times the number of wrong answers on problems that you solved afterwards. (that is if you get a wrong answer on a problem and don't get accepted till the end you wont be penalized for those wrong submissions)

    A person with a lower penalty is ranked higher.

    Consider for example the following contest with 3 participants — A, B and C and a wrong submission penalty of 10 minutes:

    • A solves 2 problems, the first at 5 minutes and the second at 30 minutes, with no wrong submissions on either.

    • B solves 2 problems, the first at 5 minutes and the second at 25 minutes, but makes a wrong submission on the second problem before submitting the correct solution.

    • C solves 3 problems, the first at 10 minutes, the second at 40 minutes and the third at 1 hour 20 minutes.

    So A has solved 2 and has a time penalty of 5 + 30 = 35 minutes,

    B has solved 2 and has a time penalty of 5 + 25 + 10 = 40 minutes, and

    C has solved 3 and has a time penalty of 10 + 40 + 80 = 130 minutes.

    As we sort them first by number of problems solved then by penalty, so the final standings will be:

    • C (3, 130)
    • A (2, 35)
    • B (2, 40)
»
4 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Schrodinger's Problem Number

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

OMG first time I solve D <3

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

I need editorial ASAP :(

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

How to Solve D? I tried thinking of it in multiple ways, but all my approaches seem to fail.

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

    Fix B.Find A and C greedily.

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

      Does there exist a proof that this approach will always work?

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

        You can simply try all possible solutions in time. code

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

          That's So Cool! I never thought that brute force would pass.

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

            Well, it was hacked. So don't be too sure yet.

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

              How does the hack work?

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

                I'm guessing that it's because you're only going upto $$$10^4$$$ instead of $$$2*10^4$$$

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

                  Ah, I see, the input is limited to 1e4, but not the solution space. Sic shit.

                  So, 10000 100000000 1000000000000 could be a valid answer for some input.

                  Edit: It turns out that a,b,c should be all below 2*1e4, because if not there is a better solution. So, this code uses same algo but works better.

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

                  What should be the output for : 1 481 777 10000?

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

                  How did you decide the size of solution space ? Why 2e4 ?

                • »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  4 года назад, # ^ |
                    Проголосовать: нравится +9 Проголосовать: не нравится
                  113
                  385 770 10010
                  
                • »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  4 года назад, # ^ |
                    Проголосовать: нравится 0 Проголосовать: не нравится

                  One possible sol is allways 10000 10000 10000 for any input where max(a,b,c)==10000.

                  The max diff is 9999*2. So the max value for b and c cannot be more than 20000, whatever a is.

                  Not sure if this counts as a prof ;)

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

                  Why only 2e4 ? How did you come up with that upper bound?

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

                  We only have to show that a goes to A, b goes to B and c goes to C (you can prove this by considering all cases in the number line). Then you can show that B must be less than c+a. This can be proven by contradiction. So actually you only need to test it for 1<=B<=c+a

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

                You need to check values up to 10k + epsilon for test such as

                73 73 10000

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

                  How to decide that epsilon value?

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

                  20k should be more then enough (since if go up to 20k we can achieve all values in [0, 10k] with a smaller cost)

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

                  10.5k is enough. not 20k.

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

                  10^4 + 32 is enough. And no less because of:

                  1
                  176 3344 10000
                  
                • »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  4 года назад, # ^ |
                    Проголосовать: нравится 0 Проголосовать: не нравится

                  tribute_to_Ukraine_2022 can you please explain, how did you concluded +32 would be enough?

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

                  We can slightly modify the model solution to pick out of answers with minimum distance the one with minimal value C.

                  Now for a fixed triple $$$A_0, B_0, C_0$$$ such that $$$B_0$$$ is divisible by $$$A_0$$$, $$$C_0$$$ is divisible by $$$B_0$$$ and $$$C_0 > 10^4$$$ if there is a testcase for which this triple will be the only valid answer, then one of them will be testcase $$$min(A_0, 10^4), min(B_0, 10^4), min(C_0, 10^4)$$$. We can just run the modified solution on this test, if it says the minimum value of $$$C$$$ is $$$C_0$$$ it means that there is a test, which requires checking values of $$$C$$$ up to $$$C_0$$$.

                  Now just run it for larger and larger values of $$$C$$$.

                  Code

                  I ran it for $$$C <= 20000$$$ and found nothing larger than $$$10^4 + 32$$$.

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

          Your solution for D has been hacked but it's still showing in standings

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

      I fixed A and then find B as A*j and then find C as A*j*f.

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

    you find all pair of a and b from 0 to 10^4(maybe more for safety) for every pair of a and b you find suitable third number nearest to original c. it probably cost you about n*log(n) for every test case.

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

    Make all the possible combinations (A, B, C) with for-loops and compare them with the given (a, b, c)s.

    The key is that neither of these three should exceed 10^4. (If they did, they would in itself be not the efficient solution) I have found just a bit fewer than 5X10^5 cases which satisfies (A, B, C). Thus, given that the test cases are 100, 5X10^7 seems like a good deal.

    Brute force, if applied properly, can be a very powerful tool.

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

speedforces

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

I want an editorial ASAP :(

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

why is my code not correct in test2 about problem b?

https://codeforces.com/contest/1311/submission/71794691

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

Idea on F?

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

How does one solve F with a complexity lesser that O(n^2) ? We at least need to consider all the pair of points for the minimum distance between them.

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

    I'm also want to know it :(

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

    The non-integer part is really helpful here — distance between points i and j will be either 0 (if they overlap), or starting distance (if they diverge). You can easily see, that for i < j if vj < vi then distance is 0. So, for each i we can find sum of xj such that vj >= vi (I scaled speeds to fit in a segment tree) in logarithmic time, then we can calculate everything in O(n log n).

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

    Hint:

    Here's how you would find the sum of the differences between all pairs.

    Sort the array. Set sum = 0. Note that for every number, it will be subtracted from the sum a (number of numbers greater that it) of times, and added to the sum a (number of numbers lower than it) of times, so you can solve the problem in O(NlogN).

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

      Can you please elaborate? I don't understand your solution fully.

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

        His code: (https://codeforces.com/contest/1311/submission/71790025)

        He didn't describe his actual solution yet, just an $$$O(N)$$$ way to calculate (xj-xi) for ALL pairs i<j. But then he goes through again in one pass, and removes those (xj-xi) which didn't satisfy (vj>vi).

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

          I think I get the solution now after 2 hours of thinking. Maybe this example can help someone else. Say $$$x=[100,50,75,25]$$$, and the corresponding sorted $$$v=[1,2,3,4]$$$. First we sort $$$x=[25,50,75,100]$$$. Then look at the ways 75 gets added initially according to @golions comment:

          $$$+75, +75, -75$$$

          (from 75-50, 75-25, and 100-75)

          Now let's iterate through $x$ in sorted $$$v$$$ order: when we get to the third element 75, we see that we should only have a single

          $$$+75$$$

          term due to the

          $$$75>50$$$

          . Coincidentally this equals the net sum of the three terms above. The reason is that if $75$ has the same rank in both the sorted $$$x$$$ and the sorted $$$v$$$ versions, then there is a symmetry in how $$$[25,50,75,100]$$$ mutates into $$$[100,50,75,25]$$$: we can let other elements "jump over" 75 to anywhere on the other side, and the symmetry is that the number of jumps going right over 75 equals the number of jumps going left: 100 jumped left, but then 25 jumped right. So the rank of 75 is equal in both cases, and we don't need to correct the $$$+75,+75,-75$$$ in our final answer.

          Another case is $$$25$$$, which is rank 1 with respect to $$$x$$$, but rank 4 with respect to $$$v$$$: Initially we had

          $$$ -25, -25, -25 $$$

          due to 50-25, 75-25, and 100-25. But because the rank changed from 1 (w.r.t $$$x$$$) to 4 (w.r.t $$$v$$$), we must have had 3 jumping overs to the left: and every such jumping over means we shouldn't have included a $$$-25$$$, so we correct with $$$+25$$$ 3 times, and end up with $$$0\cdot 25$$$ in the final answer.

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

        Say you have the numbers 1,2,3,4.

        The sum of differences is 2-1 + 3-1 + 4-1 + 3-2 + 4-2 + 4-3. Note that it's also equal to 1*(-3+0) + 2*(-2+1) + 3*(-1+2) + 4*(0+3). First number in parenthesis (that you subtract by) is the number of numbers that is greater than that number, and the second number in parenthesis (that you add) is the number of numbers that is less than that number.

        This is not the solution to the entire problem, just part of it.

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

    I think NlogN can be achieved with PBDS or compression with segment or fenwick tree, just use contribution technique.

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

Is this comment (https://codeforces.com/blog/entry/11310?#comment-162921) the right strategy for F?

I reduced the problem as follows: first sort by x[i]. Then for every i, sum (x[i]-x[j]) over j<i such that v[j]<=v[i]. Brute force would be $$$O(N^2)$$$.

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

    If for every i, you consider all j<i, won't you do 1+2+3....(n-1) = n(n-1)/2 number of operations which is O(n^2) ?

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

      Yes via brute force, but if you do the sqrt decomposition, you could sort by x[i], then put all pairs into a $$$\sqrt{N}\times \sqrt{N}$$$ grid, and sort each row by v[j]. Then given $$$i$$$, you can compute the number of $$$j$$$ which have both $$$x_j<x_i$$$ and $$$v_j<=v_i$$$, in $$$\sqrt{N} \log N + \sqrt{N}$$$ time. However given the constraints this approach might be around $$$10^7$$$ or $$$10^8$$$ operations. There is a better way given in other comments, so my question is moot.

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

i think d will be hacked most...

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

Perhaps it is psycholigal problem...but again I did not solve B :/

At least somebody tell me what is wrong with this code

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

I am in a great trouble..I don't know when will be the end of newbie era from my life..Really I am depressed..So,what can I do???

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

I'm getting Unexpected verdict while trying to hack a solution for problem C.

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

hey im new in everything, is there a post afterwards with the solutions? if not how to solve problem c? i got runtime error all the time.

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

    Yes there are. it's called editorial

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

    I also got a runtime error once. Mine was because the array size I declared was 10e5 (not sufficient). I changed the array size to 2*10e5 + 5 (according to the constraints), and it got accepted.

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

What is the hack of D?

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

in D I used 4*10000 that gives TLE but 2*10000 was ok. is there any other approach for solving D.

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

задача Е — баян 1098C - Построй дерево

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

    Там сумма размеров поддеревьев, а тут сумма глубин

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

      это ровно одно и тоже

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

        Это не одно и то же, например, в дереве из одной вершины сумма глубин равна 0, а сумма размеров поддеревьев равна 1

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

          тогда одно и то же при добавлении $$$n$$$ к сумме глубин, просто я подумал что у корня глубина $$$1$$$

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

Very strong tests in problem D!

Your WA
Answer is
To hack, use this test
»
4 года назад, # |
  Проголосовать: нравится +1 Проголосовать: не нравится

hey ? No hacking phase?

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

My solution for E : First arrange nodes so as to achieve max depth sum (mis concluded this part for like 20 mins), ie, a linear chain.Now consider the node at the bottom and move it up greedily as much as possible so that the change in answer is less than equal to current answer — required depth sum.(Initial answer is sum of depths of all nodes in the linear chain).If we cannot move a node anymore upward and we do not have the required answer, then it is not possible to form such a tree, otherwise it is.

Could anyone confirm this?

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

    I made the opposite: first construct a balanced binary tree (parent of x is x/2), then on each iteration take two deepest leafs v1 and v2, and attach v2 to v1. On the last iteration, maybe, you should attach v2 not to v1, but to some its parent.

    Each vertex is moved at most once, so it is N^2. Looks like it is possible to do it in NlogN, but we don't have to do it.

    It passed stress test for n, d <= 50, I think it is correct.

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

      Actually thanks for the idea of stress testing, i forgot the input is only n and d so it can be confirmed for all values of d in range vmin to vmax that answer is found by the code or not.

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

Where is hacking phase? Just hacked someone's code and it crashed...

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

How to solve E guys ?

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

    I don't have proof(maybe someone can hack it), and use a random method(pretty fast).

    first prep lower_bound&upper_bound of n. it's easy to note $$$ub[n] = n*(n-1)/2$$$. while $$$lb[n]$$$ can be find recursively, each time you divide $$$n$$$ almost half. i.e. $$$lb[n] = n-1 + lb[x]+lb[n-1-x]$$$, where $$$x=n/2$$$.

    then try divide&conquer, for random $$$x$$$ and valid $$$n_x$$$, and so other son should valid. Since in intuition there should be many valid partition.

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

      Sorry, I am just begin to learn Graph (5 dáys). Can you go in more detail. Thanks <3

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

.

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

Auto comment: topic has been updated by vovuh (previous revision, new revision, compare).

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

why it-my[tst].begin(); isn't giving the expected value that was so weird wasted 1 hour trying to figure it out

here's my submission

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

Is anyone facing issue of illegal contest id while hacking??

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

vovuh Some people are hacked but their submission still apear in scoreboard (such as https://codeforces.com/contest/1311/submission/71798202). Is it what the contest want?

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

    I think that is because of at some moment hacks were disallowed but uphacking was allowed. So, it seems like you hacked this solution during the uphacking phase and it is considered as correct (but uphacked) solution.

    And I don't know what I have to do with it.

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

Why was case of overflow not considered. :rage: . So what if many people fail.Will u add test cases manually everywhere where people fail. Totally unfair.

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

Why is 71783447 accepted, not hacked?

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

Can anyone please hack my B and D? I wrote very bad codes and think they can be hacked

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

Can anyone hack my B and D? I have written bad codes and think they can be hacked

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

Codeforces Hack Round #624 (Div. 3)

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

Problem D should have such test case instead of getting hacked for almost the whole contest

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

This contest is too unfair. You fixed the test case for C while you didn't do anything for problem D. It was a fair mistake done by contestants in problem C. Why did you do this unfair thing?

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

Very good round but unfortunately too weak test cases. I fell from 500 to 2500 after hack. It is unfair that you ignored hacks on C but not for D.

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

The test data of question C in this competition does not exceed the 32-bit integer range, so do you calculate the rating this time?

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

Раз тут раздача халявного рейтинга, то можно мне пожалуйста пересчитать рейтинг в тех раундах, где у меня падали задачи из-за использования неподходящих типов данных, мелких опечаток и прочих ошибок, на которые и рассчитаны претесты/тесты. А если серьезно, насколько адекватным решением было сделать ограничения на ввод постфактум?! И вообще, почему?! Разве формат раундов div3 и educational не предполагает фазу открытых взломов и изначально не всеохватывающий набор тестов, чтобы потом было полное тестирование на успешных взломах?! Чем отличается данный инцидент с int'ами от обычных претестов? Мне кажется, уже были раунды, где на основных тестах падало очень большое количество решений. И ничего, никаких "спасений утопающих" не происходило. И вообще, как такое могло произойти, что после разработки задачи "оказааалооось", что может быть "вот такой" ответ?!

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

    Зачем тебе рейтинг, ты его опять на опечатках уронишь. Будь внимательнее

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

    ну -100 из-за того что ты думал о идейной стороне задачи а не о том, что нужно писать ll вместо int (особенно когда в задаче ограничения вроде как на первый взгляд предполагают, что можно и интом обойтись, как в прошлой бэшке например) это всегда дичайшая дизмораль (и так черная полоса с рейтом, так тебе еще -40 вместо +60 дают блин)

    имхо вообще без разницы как-то, можно и не спасать, а можно и спасать.

    решили спасать, ну и ладно.

    спасли и спасли, так сказать.

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

Why are you ignoring us vovuh? What if high rated guys protested? Would you be so silent like you are now?

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

SPEEDFORCES!!!

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

In fact, both C and D has poor test case and that's not problem. but why you change only C?

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

    We changed only C because we had a bug in author's solution. I didn't have overflow tests (both mistakes in C and D are mine and I'm very sorry about that) and only one of three solutions considered overflow with #define int long long. So we considered to change the constraints in such a way that this issue will not affect participants because I had a problem in my solution.

    The problem D issue is that it has very bad tests and I wonder how I don't have at least one test case (of hundreds test cases) with $$$C > 10^4$$$. It was really surprising for me and I don't even know how to generate such tests in advice (the only way I understand is to write such a wrong solution and stress it).

    Anyway, this is just an excuse and I blame myself for these mistakes. Sorry everyone who was affected by my poor brain work.

    UPD: And for all who think that I'm silent and don't want to accept my mistakes or describe you the situation. I'm so silent because now I just trying to do all I can: write the editorial as soon as possible and I trying to do that right now.

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

      You can easily modify the model solution to minimize first: number of moves, then minimize C. Now iterate through all valid triples $$$A, B, C$$$ such that C lies in range $$$(10^4, 10^4 + 20]$$$, run modified solution for triplet $$$\min(A, 10^4), \min(B, 10^4), \min(C, 10^4)$$$ and if it says, that optimal solution has $$$C > 10^4$$$ we just found a countertest.

      In the same manner you can defeat a solution, that assumes too tight upper bound on $$$B$$$ like 71800958

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

        Okay, I see. Thank you for explanation! But I didn't even think that the issue "$$$C > 10^4$$$ in the answer" will affect and break such amount of solutions.

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

          So just to confirm, submissions that display as Accepted, but are actually hacked, that depend on $$$A,B,C<=10^4$$$ will be judged as WA/Hacked?

          For me the difference is between +149 and -5, so I'm a bit on edge :D

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

            As you saw, the actual bound on $$$C$$$ is a bit larger than $$$10^4$$$, so I think that all solutions that only consider $$$C \le 10^4$$$ will be rejected.

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

what is approach for E and F?

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

    Can u explain D

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

      iterate over value of c(1 to 3*1e4) and for every c make a tuple {a,b,c} which holds property (c%b==0 && b%a==0) where a and b which are factors of c. So, now one of this tuple is answer.

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

      just fix A and B then check that C which lie very close to c and satisfy the condition that $$$A$$$ divides $$$B$$$ and $$$B$$$ divides $$$C$$$ . Now for fixing A and B you can iterate A from 1 to say 10000 and B as a multiple of A from 1 to say 11000 simply like in seive algorithm .

      NOW after fixing A,B and nearby C you have to calculate that this A,B and C deviates how much from original a,b and c . Iterate in the above described value and calculate the minimum value. Simply Cool Algorithm.

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

What is the largest possible answer in problem D? The largest I found is:

Input:
6500 8000 10000
Output:
3500
5000 10000 10000
»
4 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

How long does it take to update my rating after contest??

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

Help me with how you approach Problem D

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

    Just do three loops for three variables, and check for minimum answer Something like this: for(int i=1;i<=10300;i++) for(int j=i;j<=10300;j+=i) for(int k=j;k<=10300;k+=j) if(abs(a-i)+abs(b-j)+abs(c-k)<ans) ans=abs(a-i)+abs(b-j)+abs(c-k),a1=i,a2=j,a3=k;

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

      This will give TLE I think, can you help me with optimized solution.

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

      ok I got it, It is some what like nested loops in Sieve for finding primes. Thanks for the help.

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

So I'm pretty sure this is cheating, right? Submission

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

Is this a hackforces ?

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

I wanna hack someone's code but it told me "Illegal contest ID", and so I could not hack anyone's code.Could someone help me?

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

If at least one problem was solved in Round, should it somehow affect the rating ? I am new on Codeforces and I don't understand rating features here

Если хотя бы одна задача была решена в раунде, это повлияет на рейтинг ? Я только зарегистрировался, и еще не полностью понял как повышать рейтинг (или хотябы получить значение)

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

    Данияр, если ты просто открыл раунд и посмотрел задачи, то ничего не будет, а если отправил хотя бы одну задачу(даже неверная попытка считается), то рейтинг поменяется. Как поменяется рейтинг зависит от количества решений, скорости их решения, количества отправлений решения. Кстати куда поступил?

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

    Поздравляю, теперь ты индус зеленый

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

I'm a rookie. I took part in the game last night, but why didn't my rating change?

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

Hi! I don't see any rating changes for me. Can I understand why? I seem to be fitting all the criteria mentioned above

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

I'm a new user. I want to participate in contest. How I can? anybody help plz

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

    Press the contest bottom and find the conteset which you want to take part in. Then press the red bottom Register to finish your registration.

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

Where is the educational round?

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

I mistakenly thought that in problem F the sum of minimum distances over all pairs of points means that I should determine a moment when each point move to a certain coordinate so that the sum of distances is minimum during all times...

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

Good luck everyone!