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

Привет, Codeforces!

В 17.12.2020 17:35 (Московское время) состоится Educational Codeforces Round 100 (рейтинговый для Див. 2).

Продолжается серия образовательных раундов в рамках инициативы Harbour.Space University! Подробности о сотрудничестве Harbour.Space University и Codeforces можно прочитать в посте.

Этот раунд будет рейтинговым для участников с рейтингом менее 2100. Соревнование будет проводиться по немного расширенным правилам ICPC. Штраф за каждую неверную посылку до посылки, являющейся полным решением, равен 10 минутам. После окончания раунда будет период времени длительностью в 12 часов, в течение которого вы можете попробовать взломать абсолютно любое решение (в том числе свое). Причем исходный код будет предоставлен не только для чтения, но и для копирования.

Вам будет предложено 6 или 7 задач на 2 часа. Мы надеемся, что вам они покажутся интересными.

Задачи вместе со мной придумывали и готовили Роман Roms Глазов, Адилбек adedalic Далабаев, Владимир vovuh Петров, Иван BledDest Андросов и Максим Neon Мещеряков. Также большое спасибо Михаилу MikeMirzayanov Мирзаянову за системы Polygon и Codeforces.

Также выражаем благодарность Николаю KAN Калинину за идею одной из задач.

Удачи в раунде! Успешных решений!

Также от наших друзей и партнёров из Harbour.Space есть сообщение для вас:

Codeforces and Harbour.Space

Привет, Codeforces!

Не за горами новогодние праздники, и в этом году у нас есть еще одна причина для празднования — в этом декабре отмечается 5-летняя годовщина Harbour.Space!

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

Codeforces был одним из наших ключевых партнеров с самого начала, и мы хотели бы поблагодарить сообщество за то, что оно росло вместе с нами в течение последних пяти лет.

Вы, ребята, крутые, и мы рады увидеть, куда нас приведет будущее.

С наилучшими пожеланиями,
Harbour.Space University

Поздравляем победителей:

Место Участник Задач решено Штраф
1 heno239 6 174
2 Geothermal 6 178
3 stevenkplus 6 238
4 hank55663 5 87
5 neal 5 121

Поздравляем лучших взломщиков:

Место Участник Число взломов
1 3.141592653 49:-3
2 sheaf 48:-17
3 adnan_toky 32:-2
4 qqwrwwv 30:-2
5 star_xingchen_c 27:-1
Было сделано 1083 успешных и 1034 неудачных взломов.

И, наконец, поздравляем людей, отправивших первое полное решение по задаче:

Задача Участник Штраф
A XAXAEBATb 0:01
B MikMirzoyanov 0:03
C Geothermal 0:11
D peti1234 0:06
E CoderAnshu 0:23
F heno239 1:13

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

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

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

century of educational rounds!

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

And the 100th Educational.Thanks to the entire team for such an great effort...

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

I have been learning the most from Educational rounds. A big thanks to Harbour Space University and the coordination. Thank you.

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

Wish all participants high rating ;)

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

Great work, Great initiative, Great Problem-sets. Kudos to all the setters for this achievement(100th educational round) awoo,vovuh,Roms,adedalic,BledDest,Neon.

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

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

$$$2015.11.3 - 2020.12.17$$$

Five years, more than $$$600$$$ problems have been made.

From the $$$1st$$$ to the $$$100th$$$, Educational rounds have developed greatly.

Waiting for the next milestone:$$$200$$$...

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

Educational rounds are tough but always good for learning

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

but is it rated?

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

I will reach pupil ✌

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

Thanks to the entire team of codeforces for 100th educational round.Hope this contest will be always special for everyone.

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

Such a great achievement for CP community. I started competing on Codeforces few months back, and now here we witness this milestone. Thank you Mike and team for such a great community platform for CP. You people have truly revolutionized CP.

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

congrats the edu. team for making the number 100 !!! <3

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

[Deleted]

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

I am glad to participate in the fourth educational round

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

A historic event. 100 Educational rounds. Congratulations to all involved.

Question about scoring: if wrong answers are submitted on a problem that isn't solved during the competition, is the 10 minutes penalty applied?

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

It's the century round.. Reminding us the contribution of all Edu members and mostly to the codeforces author

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

The century round..!! Hope so, this round will be historic and memorable

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

Kudos to the entire team of codeforces for completing 100 educational rounds!!

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

My submission is in queue from 30 mins, is the system down??

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

Why is Codeforces Round always open for anyone? Cause it's round. Ha

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

Just a doubt. Does it matter in score/points in educational rounds whether I submit early or late for the same problem?? I mean I don't really understand how the 10 min penalty works.

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

    It does matter whether you submit it early or late. And an additional 10 min penalty will be added for every wrong answer given you solve it later on. For ex. Look at Rank 1 in educational find 99. The accumulate time for all his solutions is 213 but he Made a wrong submission before solving the last problem so, 213+10 = 223(total penalty).

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

Please make Christmas problems!

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

100th, A symbolistic number! I hope your rating increased by 100.

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

Your face when you including infinity

∞]

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

seems hard contest to me , may be need to learn and practise more :( :(
UPD : B is too interesting to me after know the solution :D

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

It is too hard :cryingface:

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

The contest is hard for all of you guys also if yes, please upvote !!

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

Damn this was the toughest A I've ever seen!

I'm happy Today I got my biggest absolute delta. Sad that it's negative lol Cant do no more :/

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

.

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

Submission time doesnt hurt that much... instead the no of penalties (and seeing people solving problem later, and going higher than you)

MORAL- take your time but click submit when you are full sure...

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

Anyone tell how to approach(or some basic observation) B after the contest. adedalic is author for B(almost sure)

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

    Nice try, but it's not me this time.

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

    Output either array $$$[1, a[2], 1, a[4], \dots]$$$, or array $$$[a[1], 1, a[3], 1 \dots]$$$. At least one of them will satisfy condition $$$2\sum\limits_{i=1}^{n}|a_{i}-b_{i}| \le S$$$.

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

      Please! I asked for observation. How you approached it. do you mind explaining it?

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

        Assume $$$n$$$ is even. Let $$$X=[1, a[2], 1, a[4], \dots]$$$, $$$Y=[a[1], 1, a[3], 1, \dots]$$$. Then for $$$X$$$ we have $$$W_{X}=2\sum\limits_{i=1}^{n}|a_{i}-X_{i}|=a_{1}+a_{3}+ \dots - \frac{n}{2}$$$, for $$$Y$$$ we have $$$W_{Y}=2\sum\limits_{i=1}^{n}|a_{i}-Y_{i}|=a_{2}+a_{4}+ \dots - \frac{n}{2}$$$. Then sum for this expressions is $$$a_{1}+a_{2}+ \dots +a_{n}-n=S-n$$$. But $$$S-n=W_{X}+W_{Y}$$$. Hence at least one of numbers $$$W_{X}$$$ and $$$W_{Y}$$$ is less or equal than $$$\frac{S-n}{2}$$$. Print this $$$X$$$ or $$$Y$$$.

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

      I did the same but failed test 4 test case 10

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

    I took nearest power of 2 for every number using log. Hence it will satisfy b[i] divisible by b[i+1] or b[i+1] divisible by b[i].

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

      Ur profile is so inspiring for a newbie like me...Don't u get angry after giving so many contests and still being in newbie?

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

        Nah bro. Initially I solved lots of easy questions and used to leave contest if I couldn't solve A in 45 minutes. But then I realized my mistake and now I have started working on good problems. The sooner you realize your mistake and starting working on it more better you become. Sorry for my poor English.

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

    My approach was calculating the summation of odd indices elements and even indices elements. Then check which of these summations is minimum. If odd indices elements summation is minimum then even indices elements summation, print 1 instead of every odd index element and print the corresponding value from the given array for even indices. If even indices elements summation is minimum then do the vice versa.

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

How 8000 people are solving A.I have no clue after thinking nearly 2 hours.

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

I believe this contest could be rated for both divisions. Tough

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

The worst round I have ever seen.

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

worst written C ever. Lost 1 hour to understand why the first and the second test are different. For me the first and the second test are the same but gives different output. Why? have no idea :|

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

    I just wanna ask if statement of C makes any sense coz it's the first time I have seen so less submissions to C in 1 and half hours, I am sorry if I am too blunt but I felt that the people who designed the problem C made it clear that most don't even get the question as even the examples and their explanation at the bottom were useless...

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

      I was struggling to understand the problem statement too, but I just asked a question and you can do as well in the dashboard (there is a "ask a question" command)

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

In problem B I picked median of the array a let's call it 'X' and then assigned value of each b[i] depending upon a[i]-
1.) If a[i] is X then b[i] is also X.
2.) otherwise b[i] is either 1 or any multiple of X that minimizes (a[i]-b[i]).

Can anyone explain, what's wrong with it?

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

    Your condition 2 may give a solution where, multiples, say, aX and bX (a>1, b>1), of X, might be adjacent in the resulting array. These adjacent elements may then not divide one another. Consider a=2, b=3.

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

    Consider the array 2,2,2,2,4,6. The median is 2. You will then give the output 2,2,2,2,4,6. But 6 is not a multiple of 4.

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

How to solve problem D ?

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

    Find the maximum and minimal value of x which can obtain the set B(just use two-pointer), and all values between them can also obtain the set B.

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

      How to prove that all value between them can be obtained?

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

        We start from the maximum x. At each step we just find two pairs,and after we swap them,the x will decrease by one. If no such pairs could be found,it is the minimal x which can obtain the set B.

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

    Let the array containing remaining elements be a.Sort both arrays b and a, now for each index either element from array a or b will be greater it will give us a value of x. Now we can handle the cases where elements from array a is greater and vice-versa separately (It can proved that swapping elements from these 2 sets won't affect x) to find the maximum number by which we can increase or decrease x. My Submission

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

      Can you explain how swapping the elements of two sets works? By the way your solution seems nice and more intuitive.But, I can't get how removing elements from the sets and incrementing the ans works. Can you explain. Thanks on advance.-:)

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

        In the 2 cases which we handle separately there is one set where all the elements are less than the other set we try to minimise the number of elements which are less by greedily picking elements from this set. We increment the ans by the number of elements where we can reverse the sign. For x's which are between the extremes we can always swap some the elements back to their original positions.

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

    My solution is, calculate the minimun numbers of min operations and max operations you have to use, note them as $$$needMi$$$ and $$$needMa$$$, then the rest of oprations can be any one of them. So, the answer will be $$$n - needMa - needMi + 1$$$.

    And to calculate $$$needMi$$$,just iterate $$$b$$$ from index 1 to n. let $$$delta$$$ be the number of unused elements. Assume currently we are at index i, $$$max(x, b_i) = b_i$$$ stands for all numbers $$$x$$$ in range $$$(b_{i - 1}, b_i)$$$, so let $$$delta = delta + (b_i - b_{i - 1} - 1)$$$. If $$$delta = 0$$$, which means now we have to use min operation to get $$$b_i$$$. Else, just use max operation and comsume one unused numbers.

    $$$needMa$$$ can be calculated out by the similar way.

    accepted code

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

How to solve B?

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

    you can choose alternate 1,a[i] since either in a[1],1,a[2],1.... or in 1,a[1],1,a[2],.... sum of values copied directly will be at least half of the total sum .

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

    Choose the closest power of 2 for every A[i]. Also ensure that it isnt above 1e9.

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

    You can make two arrays depending on array a
    Array a=a1,a2,a3,a4,a5
    first array f=1,a2,1,a4,1
    second array g=a1,1,a3,1,a5
    One of these arrays will surely work
    Proof:
    let us calculate |a[i]-f[i]| =|a1-1|+|a3-1|+|a5-1|=a1+a3+a5-3
    let us calculate |a[i]-g[i]| =a2+a4-2
    Add these take average (a1+a2+a3+a4+a5-5)/2
    This is obiviously less than (a1+a2+a3+a4+a5)/2

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

    My approach was calculating the summation of odd indices elements and even indices elements. Then check which of these summations is minimum. If odd indices elements summation is minimum then even indices elements summation, print 1 instead of every odd index element and print the corresponding value from the given array for even indices. If even indices elements summation is minimum then do the vice versa.

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

    Since $$$\sum\limits_{i=1}^{n}{|ai−bi|}$$$ $$$<=$$$ $$$S/2$$$. One way to achieve this would be to atleast subtract $$$a[i]/2$$$ from every $$$a[i]$$$.
    And from this graph, we can say that
    $$$2^{\operatorname{floor}\left(\log_{2}\left(x\right)\right)}$$$ > $$$\frac{x}{2}$$$
    So the array B will be the $$$2^{\operatorname{floor}\left(\log_{2}\left(a[i]\right)\right)}$$$ for all $$$0<i<n$$$

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

How to solve A ? Can someone give me an intimation?

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

    You have to check (a + b + c) % 9 value, and some other things.

    We have to make the HPs to 1, 1, 1 by exactly 7*k- 1(k is a positive integer) shots. In that 7*k- 1 shots, there are k-1 enhanced shots. So the total HPs that you damages is, 7*k- 1 + 2(k-1) = 9*k- 3. Thus, the total HPs that you should attack will be (9*k- 3) + 1 + 1 + 1 = 9*k.

    So firstly, you need to check that (a + b + c) is divisible by 9.

    I said "other things" at the above. There could be some situations that when you use k enhanced shots, you make all HPs to zero. These situations should have the answer "NO."

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

    Approach for A:

    a, b, c are health points.
    After every 7th shot, total health is decreased by ( 1 + 1 + 1 + 1 + 1 + 1 + 3) = 9.
    So after every 7 nth shot, health gets decreased by 9n.
    So, you have to first check if (a + b + c) is divisible by 9, if it's not then you can in no way print "YES".
    
    If the sum is divisible by 9, the only thing you have to check is min( a, b, c) >= n for "YES". 
    Reason is, every 7 nth shot, each of your health point is compulsorily decreased by 1.
    
    Else print "NO".
    
    • »
      »
      »
      3 года назад, # ^ |
        Проголосовать: нравится 0 Проголосовать: не нравится

      Can u just clear that in enhanced shot whether it is necessary to reduce health of every monster by 1 or is it okay that already health of a monster becomes 0 and then executing enhanced shoot ?

      like a= 2 , b= 0 , c =1 ; can we now shoot an enhanced step or not ?

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

        Third para, first line of the problem clearly states what you want to know:

        You want to pass the dungeon beautifully, i. e., kill all the monsters with the same enhanced shot (i. e. after some enhanced shot, the health points of each of the monsters should become equal to 0 for the first time).

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

I am doing a post-contest stream to talk about all the problems, feel free to tune in at https://www.twitch.tv/stevenkplus.

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

    Please make streams on youtube as well. Is it possible?

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

    Raw notes on problems A-F (taken live during stream): https://gist.github.com/stevenhao/b203645f59218ca59aaa4cbd447f8a61

    Youtube video will be posted on my channel https://www.youtube.com/channel/UCl9IahGhVii0YrjdJvM1XNg

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

      For D, how does greedily flipping work? I mean I understand the flipping part it is like multiplying by -1 and still taking max but how does the greedy solution work? Also, is this type of solution some common pattern of thinking that will come with experience or just a one off?

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

        For x=0, you have a sequence of parentheses that must be balanced.

        You can think of incrementing x as deleting a subsequence )( from the string (delete, not flip; the explanation I gave during the stream wasn't the most clear).

        So you can use this observation to calculate the minimum possible x for which it's possible to obtain a balanced sequence of parentheses after deleting x )(s, as this number is just -min(prefix_sums).

        You reverse the string and do the same thing to compute the max x. Hope this helps!

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

Anyone confused about the difficulty level of this round? To me E is way more easier than B even A (just quite boring implementation). I was thinking many people would solve E easily but got stuck on A, B for a long time. C and E should be B and C while B should be regarded as some tricky C-level problem. (Or I didn't find the correct approach or something).

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

    And I spent almost 2 hours to solve E.

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

      But the idea is quite simple right? just topo-sort based implementation. After I finished reading B I stuck for a while and tried several approach until found the magic trick.

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

        Once you come up with the solution for A and B, it'll take like up to 5 minutes to finish them, however the ideas are hidden because those problems are not any of classic algorithms. I'd say it requires some mathematical observation.

        On the other hand, the idea of E is clear if you are familiar with classic graphic algorithms when it needs more time to code. For me I code too slowly and I couldn't get the points of E even I recognized the method to solve this problem at the first glance.

        The moral of the story is to read every problem, and it's also a good opportunity for us to see different kind of problems.

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

Problem B would have been very easy if the array was sorted. I guess the solution would involve alternate 1's and other numbers, then it could be solved even without checking whether the sum of odd indices' element is greater or even.

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

C was so strange for me. Even though the statement is written fine, for some reason I was still struggling to understand what is exactly going on in this problem.

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

Anyone knows about test case 9 for E?

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

How to solve problem D ? Thank you in advance !!

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

    Find maximum x and minimum x using binary search and subtract them

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

test 18 in E?

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

    Well I got TLE in that test because I had a very stupid bug related to checking if the graph is cyclic. So maybe you have that error too.

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

Can someone please tell what is wrong in this approach (A)? _/_

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

    every 7th round shoots all three of them , you didn't substract them from sum

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

      I've definitely taken that into account when I add 1 to the sum and check if it's divisible by 7 or not

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

        lets say you kill all of them in enhancement in 21th shoot , before 21st shoot you had 7th and 14th shoot , during 7th shoot you shoot all of them once , during 14th shoot you again shoot all of them once , this way you need a way to subtract some shoots ,

        eg : for a,b,c == 1 , 11 , 11 , your solution says YES , buts its clearly not possible in 7th shoot you have to shoot a , it wont be possile then

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

          Ah, yes. I now understand my stupidity. I see some solutions in which they've simply moduloed sum by 9 and divided the sum by 9 too and check with the health powers. Could you please explain this?

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

            Hi, @yours.truly.beginner, the reason to take mod 9 is simple. Consider the 1st 7 shots, there will be 6+3=9 damage. And this would be the same in ALL the subsequent set of 7 shots. So the damage per cycle needs to be calculated using mod9 instead of mod7. Hope this helps.

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

Any solution for D?

I tried Binary search to find maximum x but doesn't work.

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

    You should find both the minimum and maximum of x.

    My code : 101562193

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

      Do you mean that a range of x works? For example x = 2 to x = 5 in n = 10?
      More like a ternary search?
      Sorry if it's a noob doubt.

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

        How can you apply binary search if possible value of something is like 0000111100000. Binary search is only possible in case of possible value of something like 00011111 or 11110000,i.e upto some point it is 1, and after that 0. Should it be ternary search?

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

          Consider two arrays $$$v_1,v_2$$$. $$$v_1$$$ contains numbers in $$$b$$$, and $$$v_2$$$ contains numbers not in $$$b$$$. Both arrays are sorted in increasing order.

          Define $$$cmp(l_1,r_1,l_2,r_2)$$$ as follows :

          If it is possible to redistribute the numbers $$$v_1[l_1...r_1]$$$ and $$$v_2[l_2...r_2]$$$ (inclusive) into $$$(r_1-l_1+1)$$$ pairs, such that for every pair, the number from $$$v_1$$$ is less than the number from $$$v_2$$$, then $$$cmp(l_1,r_1,l_2,r_2)=-1$$$.

          If it is possible to do so, such that for every pair, the number from $$$v_1$$$ is greater than the number from $$$v_2$$$, then $$$cmp(l_1,r_1,l_2,r_2)=1$$$.

          Otherwise, $$$cmp(l_1,r_1,l_2,r_2)=0$$$.

          (For example, if $$$v_1 = [ 1,4,5,9,10 ] , v_2 = [ 2,3,6,7,8 ]$$$, then $$$cmp(0,2,2,4)=-1$$$ and $$$cmp(0,3,1,4)=0$$$.)

          Note that some $$$x$$$ is valid, if and only if $$$cmp(0,x-1,n-x,n-1)=-1$$$ and $$$cmp(x,n-1,0,n-x-1)=1$$$.

          It can be proven that the sequence $$$cmp(0,0,n-1,n-1),cmp(0,1,n-2,n-1),...,cmp(0,n-1,0,n-1)$$$ is non-decreasing. Therefore, the maximum $$$x$$$ that satisfies $$$cmp(0,x-1,n-x,n-1)=-1$$$ can be found with a binary search.

          Similarly, the minimum $$$x$$$ that satisfies $$$cmp(x,n-1,0,n-x-1)=1$$$ can also be found with a binary search.

          The answer is $$$max(x)-min(x)+1$$$.

          The overall time complexity is $$$O(n \log n)$$$.

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

          Why is it 00000111111000000

          My binary search was just a guess

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

    What I think for this problem is that if any every array element can only be a max or min , then we decrease the answer by 1 (initially the answer was n+1) .

    For checking if a number can only be a min , we count how many numbers smaller than the current number does not exist in the array (call it rem). Now we check how many previous elements can only be min (call it vs) . Now we check if rem + vs <= i (where i is the index of that element 0 based ) .

    Now we do similar for checking if a number can only be min . We take the union of these two groups and subtract from answer .

    My implementation for this approach : 101590810 Please give feedback for this solution .

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

      Can you explain why this idea works?

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

        In this 'rem' denotes the number of elements which do not occur in the array smaller than the current element . Now if we want to make the current element as max , then we have to pair it with one of the 'rem' elements . Now , the total rem elements remaining at this point is going to be rem - (i - vs) , because 'vs' number of elements can not be paired with smaller elements . So , (i — vs) out of rem are paired so far .

        So , we simply check if any smaller element is remaining for pairing with current element or not .

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

          i mean this idea * What I think for this problem is that if any every array element can only be a max or min , then we decrease the answer *

          is there a proof or something for that.

          By the way this solution is really cool.

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

            Oh that idea is quite intuitive I guess . Let's take an example such that k1 elements can only be min and k2 elements can only be max . Now , for every k1 elements , the minimum value possible will increase by 1 and for every k2 elements the maximum value possible will decrease by 1 . Hence finally , the answer will be shrinked to that range .

            I think you will got the idea now !

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

              Yeah that's clear now

              Thanks for the help!

              Great solution.

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

Why the statement of problem C is so COMPLICATED?

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

I think i need much more practice

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

One of the worst for me couldn't even solve 1 today, f me

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

Problem C, I dont get it why my submission 101572735 does not work.

It fails in first testcase of test 3. Is this not a more or less simple simulation, how can this fail?

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

Very weak test cases. I solved problem A in 2 minutes but missed an equal to sign. Hacked my own solution. 101512791

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

this contest is rubbish

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

Can anybody tell me the meaning of problem statement of C?

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

It is very good

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

It was a very good game and the title was very good

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

Wow... Questions were really tough(especially A and B). I usually solve at least 1 question in div.2 but I couldn't solve any:( Also, only two people solved F. I think this round is closer to div 1

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

Good problem set with some tricky questions!

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

101562083

This was my submission for problem C . My basic idea was to store all the received command in a vector named path . After that just did what was asked to check the time range for every command . But strangely , this is giving me MLE . Please look into this if you have some time .

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

In problem B , Why using powers of 2 is the right approach ??

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

problem C is not good, it really difficult to understand but too easy to solve.

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

    I would totally disagree with that, I think it's easy to understand and hard to implement. Since solution is quite trivial( I think question itself tells what to do ).

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

    And what's make C more difficult is 100 of hacks with just a small mistake from implementers

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

      Can you mention the mistake ? Maybe by replying or by hacking my solution.

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

        I checked your solution, and it was handling that case.

        I got curious when I saw sheaf hacking too many solutions, then I came up with below test case which helped me in hacking around 10 solutions.

        1

        2

        1 -999999999

        1000000000 1000000000

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

          I believe this has costed a lot of people -deltas from expected +deltas. Like when I completed contest my rank was around 311 and now it's 286. That's around 25 people who got WA on hack cases. The numbers would have increased as we go down the rank list. It's really sad. Pretests should have been strong.

          PS: I know it's not a contest of guesstimation and we are expected to submit a fully proved solution. Still most of us depends heavily on pretests.

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

A had the shittest problem statement ever.

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

Different Solution of B!! Can someone explain me how this solution is working? Is there any hacky case for this solution?

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

where to find ques to practice like A? ive noticed im not very good at ques similar to A

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

    I would suggest to do problems tagged with 'math'. It is not a real math problem, but the observation needed is found by similar thinking like math problems.

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

    As far as I remember, there are some problems (A) of educational rounds itself which are related to distributing things. So I personally learnt solving problems like A from them. Hope you also find them helpful.

    I started with this and I really love the solution 1221C - Perfect Team

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

i did not participate in the contest but i hacked codes after the contest

will my rate change or no

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

    Your rating will be changed if and only if you submitted at least one submission during the contest.

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

Is there any benefit in hacking in this round?

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

For C, i just stored the positions at all the ti's and then checked for the condition. 101587380

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

In problem 3 , By only changing > to < sign my solution works, but i could not find that bug during the contest.

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

Is there any benefit in hacking this round?

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

ну что такое! почему в контесте опять нет задачи на алгоритм двух китайцев??

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

Is there any penalty for failed hack attempts?

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

During the hacking phase, I found a submission and get shocked after seeing it.

https://codeforces.com/contest/1463/submission/101559684

Can anyone tell me, how it gets executed? Is it encrypted or something else? I wanna know, just for curiosity :p

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

    Just remove all "_hCbW6Loj__jiD1iD0Y__ZKcoJTEx_", it was perhaps added by some obufuscator before submission.

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

I am back at CF after 7 years, and I find this round educational indeed ;)

Problem E is especially nice if you read it carefully — my solution does not use toposort. I look for cycles in x->y chains, and then just do BFS over chains :)

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

is there any way to get full test case to debug better?

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

I understand that in hindsight things seem obvious, but the fact that the orginal tests for A didn't contain simple tests like 1 2 6 seems pretty baffling to me.

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

I had been FST or hacked five times including this time When my predict score achieve 2000.That's true there were some bugs in my program, but I hope problem writer can make test data stronger, It's not funny When I suffer a disastrous decline

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

Sad to be hacked on C by not using long long... I think pretty many people will suffer from this

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

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

How to know own ranking after the contest? I couldn't find (like codechef..).

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

When editorials will be released?Curious to learn new concepts involved in the problems:-)

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

Codeforces is Best site ever made. I used it like 10 years starting from childhood. Thanks for all creators of this fantastic Website and to everyone who is reading this now !!Happy New Year!!I Wish all of you to solve problems (lvl higher than 3000) and reach Nutella this coming year :)

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

Educational rounds have always been educational for us. Teaches a lot. Thanks to Harbour Space University and the contributers.

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

I was in a good place until I got hacked for C :(

It seems like so many people made the same mistakes and got hacked. For problem A mind that a,b,c >= sum/9, you'll pass the preliminary test even if you forget the "=". And for problem C, it's necessary to use a big enough number as infinity, I used 2e9 + 10 and got hacked, but changed it to 1e15 after the contest and passed

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

In D the sample test cases gave hint that there is a continuous segment of possible x's

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

where is the editorial of this contest

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

    Not yet released I think. But if you want to know the approach of any of these questions you can search "codeforces educational round 100" on YouTube and will get many videos. Although, can wait for the editorial. Hope it's available soon.

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

Does anyone else also feel that the testing available during the contest(also system testing) were not so diverse(covered all corner cases)? My question 3's solution got hacked, and the mistake I had done was use int instead of 'long long'(causing overflow). And now my question 1 is showing wrong as, I had misplaced equality sign (used greater than or equal to, when it should have been greater than). I know these silly mistake by side are bad but doesn't anyone feel that these simple cases should have been included originally? Or this is all, the part of the game and I should be more careful with my code next time onwards(This I surely will, after this contest). Just attaching my solution, if someone wants to have a look.

Q1)

Wrong (accepted during the test and also in system testing) — https://codeforces.com/contest/1463/submission/101529653

Right (inequality signs changed)- https://codeforces.com/contest/1463/submission/101619142

Q3)

Hacked — https://codeforces.com/contest/1463/submission/101563282

Right (changed int to long long) — https://codeforces.com/contest/1463/submission/101614274

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

    For Question 3, it was not just yours. There were more than 100 hacks just because of same issue. I agree this case should have been there in pretest, but we can't do much, because as a participant we are expected to submit a correct solution rather testing if our solution is correct from pretests.

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

I was doing D problem, and came with a unique error.

For a set 's'

upper_bound(s.begin(),s.end(),num) -> gives TLE (https://codeforces.ml/contest/1463/submission/101617604)

s.upper_bound(num) -> gives AC (https://codeforces.ml/contest/1463/submission/101621369)

You can see difference here (https://www.diffchecker.com/6kdBRnku)

Can anyone please tell why this is happening?

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

Codeforces is Best site ever made. I used it like 10 years starting from childhood. Thanks for all creators of this fantastic Website and to everyone who is reading this now !!Happy New Year!!I Wish all of you to solve problems (lvl higher than 3000) and reach Nutella this coming year :)

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

Can anyone please explain me the problem C statement. I am not even able to understand the statement properly.

Upd : Got it now :)

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

Codeforces is Best site ever made. I used it like 10 years starting from childhood. Thanks for all creators of this fantastic Website and to everyone who is reading this now !!Happy New Year!!I Wish all of you to solve problems (lvl higher than 3000) and reach Nutella this coming year :)

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

Editorial?

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

i'm sorry but i want to ask when you will post the tutorial

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

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

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

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

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

Hello Codeforces, I recently gave Educational Codeforces Round 100 (Rated for Div. 2), it went well for me but surprisingly I have also received a plagiarism warning, even though I haven't done anything like that(ever), nor I have used any public IDEs like ideone.com, which was mentioned in the warning. Also, it is not because of coincidently using a common source, as my solution didn't involve any of that, I feel it is because of the solution itself, as it didn't involve any complex piece of code. Therefore, I request the Codeforces to please take this warning back.

My submission: 101564563, Other's submission: 101576941

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

    I see that solutions are pretty similar. Probably, the solution has been stolen somehow. This warning doesn't affect you, it is just a notification for you to be careful.

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

      I don't think so. The answer for this problem was a bit standard. I've also written a similar code to them. I do think that it might be an error from the plagiarism checker.

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

A message was sent to me from the system as a warning for rules violation. I did nothing intentionally. I used my personal IDE and didn't send my code to anybody. Things happened was nothing but co-incident.

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

Could you tell me what's wrong with this submission? https://codeforces.com/contest/1469/submission/102750136 I can't see what 79 test case is about