By awoo, history, 4 years ago, translation, In English

Hello Codeforces!

On Dec/17/2020 17:35 (Moscow time) Educational Codeforces Round 100 (Rated for Div. 2) will start.

Series of Educational Rounds continue being held as Harbour.Space University initiative! You can read the details about the cooperation between Harbour.Space University and Codeforces in the blog post.

This round will be rated for the participants with rating lower than 2100. It will be held on extended ICPC rules. The penalty for each incorrect submission until the submission with a full solution is 10 minutes. After the end of the contest you will have 12 hours to hack any solution you want. You will have access to copy any solution and test it locally.

You will be given 6 or 7 problems and 2 hours to solve them.

The problems were invented and prepared by Roman Roms Glazov, Adilbek adedalic Dalabaev, Vladimir vovuh Petrov, Ivan BledDest Androsov, Maksim Neon Mescheryakov and me. Also huge thanks to Mike MikeMirzayanov Mirzayanov for great systems Polygon and Codeforces.

Also thanks to Nikolay KAN Kalinin for one of the problems' ideas.

Good luck to all the participants!

Our friends at Harbour.Space also have a message for you:

Codeforces and Harbour.Space

Hey Codeforces!

It’s almost the Holiday season, and this year, we have an extra reason to celebrate — this December marks Harbour.Space’s 5-year anniversary!

Looking back, we’re especially thankful for the wonderful partnerships that have made our university what it is today.

Codeforces has been one of our key partners since the beginning, and we would like to thank the community for growing with us for the past 5 years.

You guys are rock stars, and we’re excited to see where the future takes us both.

Best,
Harbour.Space University

Congratulations to the winners:

Rank Competitor Problems Solved Penalty
1 heno239 6 174
2 Geothermal 6 178
3 stevenkplus 6 238
4 hank55663 5 87
5 neal 5 121

Congratulations to the best hackers:

Rank Competitor Hack Count
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 successful hacks and 1034 unsuccessful hacks were made in total!

And finally people who were the first to solve each problem:

Problem Competitor Penalty
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: Editorial is out

  • Vote: I like it
  • +422
  • Vote: I do not like it

| Write comment?
»
4 years ago, # |
  Vote: I like it +79 Vote: I do not like it

century of educational rounds!

»
4 years ago, # |
  Vote: I like it +46 Vote: I do not like it

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

»
4 years ago, # |
  Vote: I like it +48 Vote: I do not like it

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

»
4 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Wish all participants high rating ;)

»
4 years ago, # |
  Vote: I like it +46 Vote: I do not like it

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

»
4 years ago, # |
  Vote: I like it +59 Vote: I do not like it

»
4 years ago, # |
  Vote: I like it +107 Vote: I do not like it

$$$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$$$...

»
4 years ago, # |
Rev. 2   Vote: I like it -26 Vote: I do not like it

Educational rounds are tough but always good for learning

»
4 years ago, # |
  Vote: I like it -42 Vote: I do not like it

but is it rated?

»
4 years ago, # |
  Vote: I like it +14 Vote: I do not like it

I will reach pupil ✌

»
4 years ago, # |
  Vote: I like it +17 Vote: I do not like it

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

»
4 years ago, # |
  Vote: I like it +3 Vote: I do not like it

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.

»
4 years ago, # |
Rev. 2   Vote: I like it +97 Vote: I do not like it

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

Spoiler
»
4 years ago, # |
Rev. 2   Vote: I like it -23 Vote: I do not like it

[Deleted]

»
4 years ago, # |
  Vote: I like it +76 Vote: I do not like it

I am glad to participate in the fourth educational round

»
4 years ago, # |
  Vote: I like it +22 Vote: I do not like it

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?

»
4 years ago, # |
  Vote: I like it +1 Vote: I do not like it

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

»
4 years ago, # |
  Vote: I like it +4 Vote: I do not like it

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

»
4 years ago, # |
  Vote: I like it +1 Vote: I do not like it

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

»
4 years ago, # |
Rev. 4   Vote: I like it +23 Vote: I do not like it

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

»
4 years ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

the 100th edu round

im ready for it i hope it will be easy

congra for the 100th edu round :D

»
4 years ago, # |
  Vote: I like it 0 Vote: I do not like it

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.

  • »
    »
    4 years ago, # ^ |
      Vote: I like it +3 Vote: I do not like it

    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).

»
4 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Please make Christmas problems!

»
4 years ago, # |
  Vote: I like it +27 Vote: I do not like it

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

»
4 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Your face when you including infinity

∞]

»
4 years ago, # |
Rev. 2   Vote: I like it +3 Vote: I do not like it

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

»
4 years ago, # |
  Vote: I like it +5 Vote: I do not like it

It is too hard :cryingface:

»
4 years ago, # |
Rev. 2   Vote: I like it -10 Vote: I do not like it

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

»
4 years ago, # |
  Vote: I like it +48 Vote: I do not like it

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 :/

»
4 years ago, # |
Rev. 2   Vote: I like it -9 Vote: I do not like it

.

»
4 years ago, # |
  Vote: I like it +1 Vote: I do not like it

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...

  • »
    »
    4 years ago, # ^ |
      Vote: I like it -10 Vote: I do not like it

    are there penalty for incorrect submission?

»
4 years ago, # |
Rev. 2   Vote: I like it -11 Vote: I do not like it

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

  • »
    »
    4 years ago, # ^ |
      Vote: I like it +29 Vote: I do not like it

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

  • »
    »
    4 years ago, # ^ |
    Rev. 2   Vote: I like it +9 Vote: I do not like it

    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$$$.

    • »
      »
      »
      4 years ago, # ^ |
        Vote: I like it -13 Vote: I do not like it

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

      • »
        »
        »
        »
        4 years ago, # ^ |
          Vote: I like it +27 Vote: I do not like it

        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$$$.

    • »
      »
      »
      4 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      I did the same but failed test 4 test case 10

      • »
        »
        »
        »
        4 years ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        You got overflow of integer type. $$$diff1$$$ and $$$diff2$$$ have to be $$$long \; long$$$ type.

  • »
    »
    4 years ago, # ^ |
      Vote: I like it +14 Vote: I do not like it

    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].

    • »
      »
      »
      4 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      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?

      • »
        »
        »
        »
        4 years ago, # ^ |
          Vote: I like it +1 Vote: I do not like it

        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.

  • »
    »
    4 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    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.

»
4 years ago, # |
  Vote: I like it +2 Vote: I do not like it

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

»
4 years ago, # |
Rev. 2   Vote: I like it +5 Vote: I do not like it

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

»
4 years ago, # |
  Vote: I like it -31 Vote: I do not like it

The worst round I have ever seen.

  • »
    »
    4 years ago, # ^ |
      Vote: I like it +54 Vote: I do not like it

    You need to participate more then.

  • »
    »
    4 years ago, # ^ |
      Vote: I like it +7 Vote: I do not like it

    Even I felt the same

  • »
    »
    4 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    mmm Nice, problem C was hacked. Awesome round and great tests.

»
4 years ago, # |
  Vote: I like it +13 Vote: I do not like it

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 :|

  • »
    »
    4 years ago, # ^ |
      Vote: I like it +3 Vote: I do not like it

    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...

    • »
      »
      »
      4 years ago, # ^ |
        Vote: I like it +1 Vote: I do not like it

      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)

»
4 years ago, # |
  Vote: I like it 0 Vote: I do not like it

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?

  • »
    »
    4 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    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.

  • »
    »
    4 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    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.

»
4 years ago, # |
  Vote: I like it 0 Vote: I do not like it

How to solve problem D ?

  • »
    »
    4 years ago, # ^ |
      Vote: I like it +15 Vote: I do not like it

    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.

    • »
      »
      »
      4 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

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

      • »
        »
        »
        »
        4 years ago, # ^ |
          Vote: I like it +5 Vote: I do not like it

        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.

  • »
    »
    4 years ago, # ^ |
    Rev. 2   Vote: I like it +6 Vote: I do not like it

    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

    • »
      »
      »
      4 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      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.-:)

      • »
        »
        »
        »
        4 years ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        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.

  • »
    »
    4 years ago, # ^ |
    Rev. 7   Vote: I like it 0 Vote: I do not like it

    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

»
4 years ago, # |
  Vote: I like it -7 Vote: I do not like it

How to solve B?

  • »
    »
    4 years ago, # ^ |
      Vote: I like it +5 Vote: I do not like it

    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 .

    • »
      »
      »
      4 years ago, # ^ |
        Vote: I like it +24 Vote: I do not like it

      I believe for each ai, if we find bi = highest 2^k such that 2^k<=ai, that should also give the answer

  • »
    »
    4 years ago, # ^ |
      Vote: I like it +1 Vote: I do not like it

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

  • »
    »
    4 years ago, # ^ |
    Rev. 3   Vote: I like it +4 Vote: I do not like it

    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

    • »
      »
      »
      4 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Wonderful solution! Thanks

    • »
      »
      »
      4 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      why did u add |a[i]-f[i]| and |a[i]-g[i]|

      • »
        »
        »
        »
        4 years ago, # ^ |
          Vote: I like it +1 Vote: I do not like it

        if a+b<=s then either of a or b has to be <=(s/2) Here a=|a[i]-f[i]| b=|a[i]-g[i]| To prove one of these is correct

        • »
          »
          »
          »
          »
          4 years ago, # ^ |
            Vote: I like it 0 Vote: I do not like it

          that's clear now.

          Thanks!

    • »
      »
      »
      4 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      can u please explain how the 2*(a1+a3+a5-3) <= sum(a) OR 2*(a2+a4-2) <= sum(a)

      I m not able to understand.

      • »
        »
        »
        »
        4 years ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        A= a1+a3+a5-3 B= a2+a4-2

        A+B= a1+a2+a3+a4+a5-5 = S-5

        A+B<=S

        At A=B: A=S/2

        If u increased A you have to decrease B and vice versa to keep the state A+B<=S

  • »
    »
    4 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    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.

  • »
    »
    4 years ago, # ^ |
      Vote: I like it +3 Vote: I do not like it

    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$$$

»
4 years ago, # |
  Vote: I like it 0 Vote: I do not like it

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

  • »
    »
    4 years ago, # ^ |
    Rev. 4   Vote: I like it +1 Vote: I do not like it

    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."

  • »
    »
    4 years ago, # ^ |
      Vote: I like it +3 Vote: I do not like it

    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".
    
    • »
      »
      »
      4 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      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 ?

      • »
        »
        »
        »
        4 years ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        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).

»
4 years ago, # |
  Vote: I like it +43 Vote: I do not like it

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

  • »
    »
    4 years ago, # ^ |
      Vote: I like it +4 Vote: I do not like it

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

  • »
    »
    4 years ago, # ^ |
      Vote: I like it +9 Vote: I do not like it

    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

    • »
      »
      »
      4 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      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?

      • »
        »
        »
        »
        4 years ago, # ^ |
        Rev. 2   Vote: I like it 0 Vote: I do not like it

        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!

»
4 years ago, # |
  Vote: I like it +16 Vote: I do not like it

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).

  • »
    »
    4 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    And I spent almost 2 hours to solve E.

    • »
      »
      »
      4 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      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.

      • »
        »
        »
        »
        4 years ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        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.

»
4 years ago, # |
Rev. 2   Vote: I like it +3 Vote: I do not like it

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.

»
4 years ago, # |
  Vote: I like it +24 Vote: I do not like it

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.

»
4 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Anyone knows about test case 9 for E?

  • »
    »
    4 years ago, # ^ |
      Vote: I like it -11 Vote: I do not like it

    you have to start the topological sort DFS from the head of each unvisited node.

    • »
      »
      »
      4 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      nvm messed up topological sort, should have used kahn's TS

»
4 years ago, # |
  Vote: I like it 0 Vote: I do not like it

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

  • »
    »
    4 years ago, # ^ |
      Vote: I like it +3 Vote: I do not like it

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

»
4 years ago, # |
  Vote: I like it 0 Vote: I do not like it

test 18 in E?

  • »
    »
    4 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    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.

»
4 years ago, # |
  Vote: I like it 0 Vote: I do not like it

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

Spoiler
  • »
    »
    4 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

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

    • »
      »
      »
      4 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

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

      • »
        »
        »
        »
        4 years ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        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

        • »
          »
          »
          »
          »
          4 years ago, # ^ |
            Vote: I like it 0 Vote: I do not like it

          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?

          • »
            »
            »
            »
            »
            »
            4 years ago, # ^ |
              Vote: I like it 0 Vote: I do not like it

            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.

»
4 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Any solution for D?

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

  • »
    »
    4 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    You should find both the minimum and maximum of x.

    My code : 101562193

    • »
      »
      »
      4 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      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.

      • »
        »
        »
        »
        4 years ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        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?

        • »
          »
          »
          »
          »
          4 years ago, # ^ |
            Vote: I like it +14 Vote: I do not like it

          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)$$$.

        • »
          »
          »
          »
          »
          4 years ago, # ^ |
            Vote: I like it 0 Vote: I do not like it

          Why is it 00000111111000000

          My binary search was just a guess

  • »
    »
    4 years ago, # ^ |
    Rev. 4   Vote: I like it +3 Vote: I do not like it

    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 .

    • »
      »
      »
      4 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Can you explain why this idea works?

      • »
        »
        »
        »
        4 years ago, # ^ |
        Rev. 2   Vote: I like it +3 Vote: I do not like it

        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 .

        • »
          »
          »
          »
          »
          4 years ago, # ^ |
            Vote: I like it 0 Vote: I do not like it

          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.

          • »
            »
            »
            »
            »
            »
            4 years ago, # ^ |
              Vote: I like it +3 Vote: I do not like it

            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 !

            • »
              »
              »
              »
              »
              »
              »
              4 years ago, # ^ |
                Vote: I like it 0 Vote: I do not like it

              Yeah that's clear now

              Thanks for the help!

              Great solution.

»
4 years ago, # |
  Vote: I like it +7 Vote: I do not like it

Why the statement of problem C is so COMPLICATED?

»
4 years ago, # |
  Vote: I like it 0 Vote: I do not like it

I think i need much more practice

  • »
    »
    4 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    can anyone suggest whether ladders help us to get better in rounds? Thanks in advance :)

»
4 years ago, # |
  Vote: I like it 0 Vote: I do not like it

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

»
4 years ago, # |
Rev. 2   Vote: I like it +1 Vote: I do not like it

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?

  • »
    »
    4 years ago, # ^ |
      Vote: I like it +4 Vote: I do not like it

    Should you also not unblock in your else part?

    • »
      »
      »
      4 years ago, # ^ |
        Vote: I like it +1 Vote: I do not like it

      The idea is that it "unblocks" automagic, since at some t[i] simply t[i]>blocked. That is the i when the next command is executed, so blocked is set to a new value (in the future).

  • »
    »
    4 years ago, # ^ |
      Vote: I like it +4 Vote: I do not like it

    INF is too small. Made the same mistake during contest. :(

»
4 years ago, # |
  Vote: I like it +18 Vote: I do not like it

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

»
4 years ago, # |
  Vote: I like it +3 Vote: I do not like it

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

»
4 years ago, # |
Rev. 2   Vote: I like it -6 Vote: I do not like it

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

»
4 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Good problem set with some tricky questions!

»
4 years ago, # |
  Vote: I like it 0 Vote: I do not like it

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 .

»
4 years ago, # |
  Vote: I like it 0 Vote: I do not like it

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

  • »
    »
    4 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Nearest power of 2 of X can't be more than two times bigger or more than two times lower than X

  • »
    »
    4 years ago, # ^ |
      Vote: I like it +6 Vote: I do not like it

    You could also make alternate elements as 1 .

»
4 years ago, # |
  Vote: I like it 0 Vote: I do not like it

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

  • »
    »
    4 years ago, # ^ |
      Vote: I like it +18 Vote: I do not like it

    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 ).

  • »
    »
    4 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

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

    • »
      »
      »
      4 years ago, # ^ |
        Vote: I like it +3 Vote: I do not like it

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

      • »
        »
        »
        »
        4 years ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        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

        • »
          »
          »
          »
          »
          4 years ago, # ^ |
            Vote: I like it +1 Vote: I do not like it

          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.

»
4 years ago, # |
  Vote: I like it -38 Vote: I do not like it

A had the shittest problem statement ever.

»
4 years ago, # |
  Vote: I like it 0 Vote: I do not like it

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

»
4 years ago, # |
  Vote: I like it +1 Vote: I do not like it

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

  • »
    »
    4 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    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.

  • »
    »
    4 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    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

»
4 years ago, # |
  Vote: I like it +3 Vote: I do not like it

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

will my rate change or no

  • »
    »
    4 years ago, # ^ |
      Vote: I like it +3 Vote: I do not like it

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

»
4 years ago, # |
Rev. 3   Vote: I like it +5 Vote: I do not like it

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

»
4 years ago, # |
  Vote: I like it 0 Vote: I do not like it

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

  • »
    »
    4 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Then same goes for many contestants who got hacked on A. They just forgot to add "=".

»
4 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Is there any benefit in hacking this round?

  • »
    »
    4 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    You mean hacking solution of this round o_O

    • »
      »
      »
      4 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      yes.... ?

      • »
        »
        »
        »
        4 years ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        You won't get bonus points like that in regular rounds. But your test case will be added to system test. So if you hack successfully you may can let some people before you fail the system test :)

        • »
          »
          »
          »
          »
          4 years ago, # ^ |
            Vote: I like it 0 Vote: I do not like it

          oh... I understand.. thanks bro.

»
4 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Is there any penalty for failed hack attempts?

»
4 years ago, # |
  Vote: I like it 0 Vote: I do not like it

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

https://codeforces.me/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

  • »
    »
    4 years ago, # ^ |
      Vote: I like it +3 Vote: I do not like it

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

    • »
      »
      »
      4 years ago, # ^ |
        Vote: I like it +21 Vote: I do not like it

      Isn't this violation of rules ?

      Point 16

      PS: I know above attached post is 10 years old.

    • »
      »
      »
      4 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      I think he added this, so that the code becomes unreadable and no one can hack him.

»
4 years ago, # |
  Vote: I like it +13 Vote: I do not like it

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 :)

  • »
    »
    4 years ago, # ^ |
      Vote: I like it +3 Vote: I do not like it

    7 years is good hell of a time. Back then, how did you guys even practice?

»
4 years ago, # |
  Vote: I like it 0 Vote: I do not like it

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

»
4 years ago, # |
  Vote: I like it +2 Vote: I do not like it

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.

»
4 years ago, # |
  Vote: I like it 0 Vote: I do not like it

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

»
4 years ago, # |
  Vote: I like it +8 Vote: I do not like it

»
4 years ago, # |
  Vote: I like it 0 Vote: I do not like it

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

»
4 years ago, # |
  Vote: I like it +5 Vote: I do not like it

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

»
4 years ago, # |
  Vote: I like it +16 Vote: I do not like it

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 :)

»
4 years ago, # |
  Vote: I like it 0 Vote: I do not like it

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

»
4 years ago, # |
  Vote: I like it 0 Vote: I do not like it

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

  • »
    »
    4 years ago, # ^ |
      Vote: I like it +1 Vote: I do not like it

    I avoided the use of Infinity. Accepted Code

    • »
      »
      »
      4 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Yep that's a good idea to deal with the last case separately which is the safest way. I totally regretted that I just tried to submit the fastest possible so I didn't check thoroughly

»
4 years ago, # |
  Vote: I like it +2 Vote: I do not like it

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

»
4 years ago, # |
  Vote: I like it 0 Vote: I do not like it

where is the editorial of this contest

  • »
    »
    4 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    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.

»
4 years ago, # |
  Vote: I like it 0 Vote: I do not like it

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.me/contest/1463/submission/101529653

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

Q3)

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

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

  • »
    »
    4 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    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.

»
4 years ago, # |
  Vote: I like it 0 Vote: I do not like it

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?

»
4 years ago, # |
  Vote: I like it -14 Vote: I do not like it

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 :)

»
4 years ago, # |
Rev. 3   Vote: I like it 0 Vote: I do not like it

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

Upd : Got it now :)

»
4 years ago, # |
  Vote: I like it -20 Vote: I do not like it

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 :)

»
4 years ago, # |
  Vote: I like it +18 Vote: I do not like it

Editorial?

»
4 years ago, # |
  Vote: I like it +1 Vote: I do not like it

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

»
4 years ago, # |
  Vote: I like it 0 Vote: I do not like it

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

»
4 years ago, # |
  Vote: I like it 0 Vote: I do not like it

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

»
4 years ago, # |
Rev. 2   Vote: I like it +2 Vote: I do not like it

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

  • »
    »
    4 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    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.

    • »
      »
      »
      4 years ago, # ^ |
        Vote: I like it +6 Vote: I do not like it

      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.

»
4 years ago, # |
  Vote: I like it +3 Vote: I do not like it

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.

»
4 years ago, # |
  Vote: I like it 0 Vote: I do not like it

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