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:

*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 | _Backl1ght | 30:-2 |

5 | star_xingchen_c | 27:-1 |

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

Problem | Competitor | Penalty |
---|---|---|

A | I_love_Anya_Prokopyeva | 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

century of educational rounds!

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

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

AreEduRoundsEducational :D

Wish all participants high rating ;)

You know that can't be possible that everyone gets +delta.

Well, it is possible only if all unrated participates.

So basically impossible

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

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

Educational rounds are tough but always good for learning

Century of educational round.. Hope a great round:)

but is it rated?

Why not?

I will reach pupil ✌

All the best :)

same to you also

your graph is so inspiring literally how you went up from 300 ... ALL THE BEST !!

Thanks a lot devo_bhai.

Same Brother!

all the best

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

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.

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

Spoiler![ ]()

5-year anniversary of Harbour.Space and 100th of educational rounds!

[Deleted]

I am glad to participate in the fourth educational round

Wish all participants high rating All the best ;)

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?

No.

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

Congratulations to Harbour Space University for their amazing rounds for the past 5 years, and also this is the 100th educational round. I hope to see more educational rounds in the future^^

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

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

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

Congrats programmers! this is our 100th educational programming contest.

100th Educational Codeforces round

the 100th edu round

im ready for it i hope it will be easy

congra for the 100th edu round :D

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.

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

Thank you soo much for clearing my doubt senpai. BTW your profile quote is very encouraging.

Please make Christmas problems!

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

be ready :D

Gentle Reminder

Your face when you including infinity

`∞]`

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

It is too hard :cryingface:

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

I felt same. Need more practice :(

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

lol not gonna lie you got us in the first half

same man A got me scratching my head

even though i came late and tried to solve A and B fast and here we go biggest negative delta

C was easier than usual though.

A destroyed me

You cannot vote twice. You have already voted for this topic before.

It will be a memorable 100th EDU round... xD.

Really Nice Problems!!

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

are there penalty for incorrect submission?

It advances you by 10 minutes... LOL

then i will not submit my b solution lol!!!!

IF it gets accepted then it will count otherwise no.

what do u mean?

if you submit some question and it get accepted, then only the penalty will be considered for all the wrong submission that you made for that particular problem

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

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

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

Please! I asked for observation. How you approached it. do you mind explaining 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$$$.

Nice proof !!

I think you missed out the 2 for Wx & Wy ?

I did the same but failed test 4 test case 10

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

I know I am stupid :/ Thank you

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

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?

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.

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.

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

same here xD lets practice more :)

same bro i went thinking in A then i could not get its code so i went to try in B then i was disappointed so i left the contest and went playing among us :)

I have somewhat of a clue

Find how many times you will have the enhanced bullet and subtract those from all three health and check if it's sum is divisible by 6 but I got it wrong somehow

Bro, please don't comment when the contest is still going on

https://codeforces.com/contest/1463/submission/101514209 You can look at my submission

I believe this contest could be rated for

bothdivisions. ToughEducational Codeforces Round 100 [Rated for

~~Div. 2~~Div 1.5]Woohooho i am cyan now, i remained green for just 1 contest, haha

The worst round I have ever seen.

You need to participate more then.

Even I felt the same

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

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

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

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)

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?

I did the same, seemed logically correct but couldn't prove it and tried my luck but no luck lol

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.

Yes, Got it, thanks. Just looked at your solution, it was easy and excellent.

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.

Yes, I just understood it. Thanks for the info.

Brother you have to minimize the abs(a[i]-b[i]) as much as you can at every step and it should <=s/2 I can explain you my approach. What i have done is I just printed the 1st element of the array as it is. Then for every next index . I have check if b[i-1] is divisible by a[i] or a[i] is divisible by b[i-1] i have printed a[i] as it is. And for else case i have checked whether if a[i]>b[i-1] then in this case i have printed the closest multiple of b[i-1]to a[i] which is less than a[i] to achieve this i have divided a[i] by b[i-1] and multiplied by bi-1*b[i] eg (7/3)*3=6 , (8/3)*3=6 else if a[i]<b[i-1] then I have printed 1. I think it is a bit greedy approach. But it worked. Your approach was also nice but I think the problem came coz you not checked whether the upcoming number is a factor or a multiple of previous number for every case. If my approach is wrong plz do tell me or else check my submission. https://codeforces.com/contest/1463/submission/101571656

How to solve problem D ?

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.

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

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.

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

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

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.

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

How to solve B?

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 .

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

you are right , it's prove is also similar to above since we are subtracting at least half from each index value.

i used the same approach

I got this observation 6 minutes before the contest was over. :( I should not have wasted so much time on A. I rushed to coding instead of being sure about my solution for A and ended up getting tons of penalties. Everything went bad. Still, the problems were interesting to me.

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

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

Wonderful solution! Thanks

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

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

that's clear now.

Thanks!

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.

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

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.

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

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

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

Approach for A:

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 ?

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

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

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

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

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?

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!

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

And I spent almost 2 hours to solve E.

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.

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.

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.

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.

Anyone knows about test case 9 for E?

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

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

need more practice

couldn't solve A in 1 hour 50 minutes , solved B in last 10 minutes lol

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

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

test 18 in E?

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.

My idea to solve A was to first find a+b+c = SUM. In 7 moves, we are decrementing 9(1+1+1+1+1+1+3) from the SUM. So let's consider decrementing 9 as 1 move. We can only get SUM = 0 iff SUM is a multiple of 9 and min(a, b, c) >= no of such moves.

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

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

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

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

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?

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.

consider the testcase : 1 50 1 49

your code will give "YES" but ans is "NO"

Any solution for D?

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

You should find both the minimum and maximum of x.

My code : 101562193

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.

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?

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

Thanks！

thanks

Why is it 00000111111000000

My binary search was just a guess

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 .

Can you explain why this idea works?

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 .

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.

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 !

Yeah that's clear now

Thanks for the help!

Great solution.

I was too using a similar approach and got WA ( due to a silly mistake ) and began to think that there is some issue with my approach and then I found your comment and I got AC after fixing that error .

Thanks .

Here is my code

Why the statement of problem C is so COMPLICATED?

I think i need much more practice

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

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

I've implemented A the same way you have, could you find out what's wrong in that logic?

same for me!couldn't solved even signle problem!

same here but i m newbie for now and you are specialist so i hope this will not happen with me when i would become specialist .

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?

Sire, kindly have a look at my submission for A above. Please tell what's exactly wrong in what I've implemented.

Should you also not unblock in your else part?

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

`INF`

is too small. Made the same mistake during contest. :(edit: Cursing has been removed

Thanks for pointing out! This is the working version, with bigger INF. 101583027

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

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

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

Or maybe Div1.5

Good problem set with some tricky questions!

problems played a mind game with me

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 .

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

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

Could you explain this approach by some number ,cause I didn't get it yet. Thanks in advance.

You could also make alternate elements as 1 .

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

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

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

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

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

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.

A had the shittest problem statement ever.

What was not ok with that statement?

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

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

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.

ok i'll try. thnx bruv

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 - Идеальная команда

i'll def try. thnx bro

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

will my rate change or no

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

Oh my god , i sucked so hard , couldn't even do a single problem . F in the comments please

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

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

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

Is there any benefit in hacking this round?

You mean hacking solution of this round o_O

yes.... ?

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

oh... I understand.. thanks bro.

Is there any penalty for failed hack attempts?

no there is not any penalty in failed hacks and no points in successful hacks

Thanks

But after one unsuccessful hack my rank decreases why it happened?

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

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

Isn't this violation of rules ?

Point 16

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

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

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

Welcome back sir :)

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

How to solve problem F?

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

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.

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

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

You could use plugins like CF-predictor

when will the new rating changes come out.how much time does it take for ratings to come out after contest

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

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

What is the reason for sometimes taking 11 or 12 hours for new rating changes while sometimes it just needs 5 or 6 hours?

Educational rounds have always been educational for us. Teaches a lot. Thanks to

Harbour Space Universityand the contributers.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

I avoided the use of Infinity. Accepted Code

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

I did the same. So the solutions that got hacked were only those who used INF?

Now how do i know what i need to learn from this educational round?

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

where is the editorial of this contest

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.

Ok

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

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.

Nice problems. But my only submission this round got hacked because I missed an '=' sign lol :(

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?

First one runs in O(N) Refer this

Thnx!

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

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

Upd: Got it now :)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 :)

Editorial?

Educational round editorials are always delayed.

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

Auto comment: topic has been updated by awoo (previous revision, new revision, compare).Auto comment: topic has been updated by awoo (previous revision, new revision, compare).Hello Codeforces, I recently gave Educational Codeforces Round 100 (рейтинговый для Див. 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

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.

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.

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.

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