By awoo, history, 5 months ago, translation,

Hello Codeforces!

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
4 _Backl1ght 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 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

• +422

 » 5 months ago, # |   +79 century of educational rounds!
 » 5 months ago, # |   +46 And the 100th Educational.Thanks to the entire team for such an great effort...
 » 5 months ago, # |   +48 I have been learning the most from Educational rounds. A big thanks to Harbour Space University and the coordination. Thank you.
•  » » 5 months ago, # ^ |   0
 » 5 months ago, # |   0 Wish all participants high rating ;)
•  » » 5 months ago, # ^ |   +26 You know that can't be possible that everyone gets +delta.
•  » » » 5 months ago, # ^ |   +13 Well, it is possible only if all unrated participates.
•  » » » » 5 months ago, # ^ |   +13 So basically impossible
 » 5 months ago, # |   +46 Great work, Great initiative, Great Problem-sets. Kudos to all the setters for this achievement(100th educational round) awoo,vovuh,Roms,adedalic,BledDest,Neon.
 » 5 months ago, # |   +59
 » 5 months ago, # |   +107 $2015.11.3 - 2020.12.17$Five years, more than $600$ problems have been made.From the $1st$ to the $100th$, Educational rounds have developed greatly.Waiting for the next milestone:$200$...
 » 5 months ago, # | ← Rev. 2 →   -26 Educational rounds are tough but always good for learning
 » 5 months ago, # |   0 Century of educational round.. Hope a great round:)
 » 5 months ago, # |   -42 but is it rated?
•  » » 5 months ago, # ^ |   +11 Why not?
 » 5 months ago, # |   +14 I will reach pupil ✌
•  » » 5 months ago, # ^ |   0 All the best :)
•  » » » 5 months ago, # ^ |   0 same to you also
•  » » » » 5 months ago, # ^ |   0 your graph is so inspiring literally how you went up from 300 ... ALL THE BEST !!
•  » » » » » 5 months ago, # ^ |   0 Thanks a lot devo_bhai.
•  » » 5 months ago, # ^ |   0 Same Brother!
•  » » » 5 months ago, # ^ |   0 all the best
 » 5 months ago, # |   +17 Thanks to the entire team of codeforces for 100th educational round.Hope this contest will be always special for everyone.
 » 5 months ago, # |   +3 Such a great achievement for CP community. I started competing on Codeforces few months back, and now here we witness this milestone. Thank you Mike and team for such a great community platform for CP. You people have truly revolutionized CP.
 » 5 months ago, # | ← Rev. 2 →   +97 congrats the edu. team for making the number 100 !!! <3 Spoiler![ ]()
 » 5 months ago, # |   0 5-year anniversary of Harbour.Space and 100th of educational rounds!
 » 5 months ago, # | ← Rev. 2 →   -23 [Deleted]
 » 5 months ago, # |   +76 I am glad to participate in the fourth educational round
 » 5 months ago, # |   0 Wish all participants high rating All the best ;)
 » 5 months ago, # |   +22 A historic event. 100 Educational rounds. Congratulations to all involved.Question about scoring: if wrong answers are submitted on a problem that isn't solved during the competition, is the 10 minutes penalty applied?
•  » » 5 months ago, # ^ |   +27 No.
 » 5 months ago, # |   +1 The century round..!! Hope so, this round will be historic and memorable
 » 5 months ago, # | ← Rev. 2 →   0 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^^
 » 5 months ago, # |   +4 Kudos to the entire team of codeforces for completing 100 educational rounds!!
 » 5 months ago, # |   +1 My submission is in queue from 30 mins, is the system down??
 » 5 months ago, # | ← Rev. 4 →   +23 Why is Codeforces Round always open for anyone? Cause it's round. Ha
 » 5 months ago, # |   0 Congrats programmers! this is our 100th educational programming contest.
 » 5 months ago, # |   0 100th Educational Codeforces round
 » 5 months ago, # | ← Rev. 2 →   0 the 100th edu round im ready for it i hope it will be easycongra for the 100th edu round :D
 » 5 months ago, # |   0 Just a doubt. Does it matter in score/points in educational rounds whether I submit early or late for the same problem?? I mean I don't really understand how the 10 min penalty works.
•  » » 5 months ago, # ^ |   +3 It does matter whether you submit it early or late. And an additional 10 min penalty will be added for every wrong answer given you solve it later on. For ex. Look at Rank 1 in educational find 99. The accumulate time for all his solutions is 213 but he Made a wrong submission before solving the last problem so, 213+10 = 223(total penalty).
•  » » » 5 months ago, # ^ |   0 Thank you soo much for clearing my doubt senpai. BTW your profile quote is very encouraging.
 » 5 months ago, # |   0 Please make Christmas problems!
 » 5 months ago, # |   +27 100th, A symbolistic number! I hope your rating increased by 100.
 » 5 months ago, # |   0 be ready :D
 » 5 months ago, # |   0 Gentle Reminder
 » 5 months ago, # |   0 Your face when you including infinity∞]
 » 5 months ago, # | ← Rev. 2 →   +3 seems hard contest to me , may be need to learn and practise more :( :(UPD : B is too interesting to me after know the solution :D
 » 5 months ago, # |   +5 It is too hard :cryingface:
 » 5 months ago, # | ← Rev. 2 →   -10 The contest is hard for all of you guys also if yes, please upvote !!
•  » » 5 months ago, # ^ |   +1 I felt same. Need more practice :(
 » 5 months ago, # |   +48 Damn this was the toughest A I've ever seen!I'm happy Today I got my biggest absolute delta. Sad that it's negative lol Cant do no more :/
•  » » 5 months ago, # ^ |   +15 lol not gonna lie you got us in the first half
•  » » 5 months ago, # ^ |   +1 same man A got me scratching my headeven though i came late and tried to solve A and B fast and here we go biggest negative delta
•  » » 5 months ago, # ^ |   -8 C was easier than usual though.
•  » » 5 months ago, # ^ |   0 A destroyed me
 » 5 months ago, # |   -9 You cannot vote twice. You have already voted for this topic before.
 » 5 months ago, # | ← Rev. 2 →   0 It will be a memorable 100th EDU round... xD.
 » 5 months ago, # |   -17 Really Nice Problems!!
 » 5 months ago, # |   +1 Submission time doesnt hurt that much... instead the no of penalties (and seeing people solving problem later, and going higher than you)MORAL- take your time but click submit when you are full sure...
•  » » 5 months ago, # ^ |   -10 are there penalty for incorrect submission?
•  » » » 5 months ago, # ^ | ← Rev. 2 →   0 It advances you by 10 minutes... LOL
•  » » » » 5 months ago, # ^ |   0 then i will not submit my b solution lol!!!!
•  » » » » » 5 months ago, # ^ |   0 IF it gets accepted then it will count otherwise no.
•  » » » » » » 5 months ago, # ^ |   -10 what do u mean?
•  » » » » » » » 5 months ago, # ^ |   0 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
 » 5 months ago, # | ← Rev. 2 →   -11 Anyone tell how to approach(or some basic observation) B after the contest. adedalic is author for B(almost sure)
•  » » 5 months ago, # ^ |   +29 Nice try, but it's not me this time.
•  » » 5 months ago, # ^ | ← Rev. 2 →   +9 Output either array $[1, a[2], 1, a[4], \dots]$, or array $[a[1], 1, a[3], 1 \dots]$. At least one of them will satisfy condition $2\sum\limits_{i=1}^{n}|a_{i}-b_{i}| \le S$.
•  » » » 5 months ago, # ^ |   -13 Please! I asked for observation. How you approached it. do you mind explaining it?
•  » » » » 5 months ago, # ^ |   +27 Assume $n$ is even. Let $X=[1, a[2], 1, a[4], \dots]$, $Y=[a[1], 1, a[3], 1, \dots]$. Then for $X$ we have $W_{X}=2\sum\limits_{i=1}^{n}|a_{i}-X_{i}|=a_{1}+a_{3}+ \dots - \frac{n}{2}$, for $Y$ we have $W_{Y}=2\sum\limits_{i=1}^{n}|a_{i}-Y_{i}|=a_{2}+a_{4}+ \dots - \frac{n}{2}$. Then sum for this expressions is $a_{1}+a_{2}+ \dots +a_{n}-n=S-n$. But $S-n=W_{X}+W_{Y}$. Hence at least one of numbers $W_{X}$ and $W_{Y}$ is less or equal than $\frac{S-n}{2}$. Print this $X$ or $Y$.
•  » » » » » 5 months ago, # ^ |   -10 Nice proof !!
•  » » » » » 5 months ago, # ^ |   0 I think you missed out the 2 for Wx & Wy ?
•  » » » 5 months ago, # ^ |   0 I did the same but failed test 4 test case 10
•  » » » » 5 months ago, # ^ |   0 You got overflow of integer type. $diff1$ and $diff2$ have to be $long \; long$ type.
•  » » » » » 5 months ago, # ^ | ← Rev. 2 →   +1 I know I am stupid :/ Thank you
•  » » 5 months ago, # ^ |   +14 I took nearest power of 2 for every number using log. Hence it will satisfy b[i] divisible by b[i+1] or b[i+1] divisible by b[i].
•  » » » 5 months ago, # ^ |   0 Ur profile is so inspiring for a newbie like me...Don't u get angry after giving so many contests and still being in newbie?
•  » » » » 5 months ago, # ^ |   +1 Nah bro. Initially I solved lots of easy questions and used to leave contest if I couldn't solve A in 45 minutes. But then I realized my mistake and now I have started working on good problems. The sooner you realize your mistake and starting working on it more better you become. Sorry for my poor English.
•  » » 5 months ago, # ^ |   0 My approach was calculating the summation of odd indices elements and even indices elements. Then check which of these summations is minimum. If odd indices elements summation is minimum then even indices elements summation, print 1 instead of every odd index element and print the corresponding value from the given array for even indices. If even indices elements summation is minimum then do the vice versa.
 » 5 months ago, # |   +2 How 8000 people are solving A.I have no clue after thinking nearly 2 hours.
•  » » 5 months ago, # ^ |   0 same here xD lets practice more :)
•  » » 5 months ago, # ^ |   -8 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 :)
•  » » 5 months ago, # ^ | ← Rev. 2 →   -12 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
•  » » » 5 months ago, # ^ |   0 Bro, please don't comment when the contest is still going on
•  » » 5 months ago, # ^ |   +1 https://codeforces.com/contest/1463/submission/101514209 You can look at my submission
 » 5 months ago, # | ← Rev. 2 →   +5 I believe this contest could be rated for both divisions. Tough
•  » » 5 months ago, # ^ |   0 Educational Codeforces Round 100 [Rated for Div. 2 Div 1.5]
 » 5 months ago, # |   0 Woohooho i am cyan now, i remained green for just 1 contest, haha
 » 5 months ago, # |   -31 The worst round I have ever seen.
•  » » 5 months ago, # ^ |   +54 You need to participate more then.
•  » » 5 months ago, # ^ |   +7 Even I felt the same
•  » » 5 months ago, # ^ |   0 mmm Nice, problem C was hacked. Awesome round and great tests.
 » 5 months ago, # |   +13 worst written C ever. Lost 1 hour to understand why the first and the second test are different. For me the first and the second test are the same but gives different output. Why? have no idea :|
•  » » 5 months ago, # ^ |   +3 I just wanna ask if statement of C makes any sense coz it's the first time I have seen so less submissions to C in 1 and half hours, I am sorry if I am too blunt but I felt that the people who designed the problem C made it clear that most don't even get the question as even the examples and their explanation at the bottom were useless...
•  » » » 5 months ago, # ^ |   +1 I was struggling to understand the problem statement too, but I just asked a question and you can do as well in the dashboard (there is a "ask a question" command)
 » 5 months ago, # |   0 In problem B I picked median of the array a let's call it 'X' and then assigned value of each b[i] depending upon a[i]- 1.) If a[i] is X then b[i] is also X. 2.) otherwise b[i] is either 1 or any multiple of X that minimizes (a[i]-b[i]). Can anyone explain, what's wrong with it?
•  » » 5 months ago, # ^ |   0 I did the same, seemed logically correct but couldn't prove it and tried my luck but no luck lol
•  » » 5 months ago, # ^ |   0 Your condition 2 may give a solution where, multiples, say, aX and bX (a>1, b>1), of X, might be adjacent in the resulting array. These adjacent elements may then not divide one another. Consider a=2, b=3.
•  » » » 5 months ago, # ^ |   0 Yes, Got it, thanks. Just looked at your solution, it was easy and excellent.
•  » » 5 months ago, # ^ |   0 Consider the array 2,2,2,2,4,6. The median is 2. You will then give the output 2,2,2,2,4,6. But 6 is not a multiple of 4.
•  » » » 5 months ago, # ^ |   0 Yes, I just understood it. Thanks for the info.
•  » » 5 months ago, # ^ |   0 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]
 » 5 months ago, # |   0 How to solve problem D ?
•  » » 5 months ago, # ^ |   +15 Find the maximum and minimal value of x which can obtain the set B(just use two-pointer), and all values between them can also obtain the set B.
•  » » » 5 months ago, # ^ |   0 How to prove that all value between them can be obtained?
•  » » » » 5 months ago, # ^ |   +5 We start from the maximum x. At each step we just find two pairs，and after we swap them，the x will decrease by one. If no such pairs could be found，it is the minimal x which can obtain the set B.
•  » » 5 months ago, # ^ | ← Rev. 2 →   +6 Let the array containing remaining elements be a.Sort both arrays b and a, now for each index either element from array a or b will be greater it will give us a value of x. Now we can handle the cases where elements from array a is greater and vice-versa separately (It can proved that swapping elements from these 2 sets won't affect x) to find the maximum number by which we can increase or decrease x. My Submission
•  » » » 5 months ago, # ^ |   0 Can you explain how swapping the elements of two sets works? By the way your solution seems nice and more intuitive.But, I can't get how removing elements from the sets and incrementing the ans works. Can you explain. Thanks on advance.-:)
•  » » » » 5 months ago, # ^ |   0 In the 2 cases which we handle separately there is one set where all the elements are less than the other set we try to minimise the number of elements which are less by greedily picking elements from this set. We increment the ans by the number of elements where we can reverse the sign. For x's which are between the extremes we can always swap some the elements back to their original positions.
•  » » 5 months ago, # ^ | ← Rev. 7 →   0 My solution is, calculate the minimun numbers of min operations and max operations you have to use, note them as $needMi$ and $needMa$, then the rest of oprations can be any one of them. So, the answer will be $n - needMa - needMi + 1$.And to calculate $needMi$，just iterate $b$ from index 1 to n. let $delta$ be the number of unused elements. Assume currently we are at index i, $max(x, b_i) = b_i$ stands for all numbers $x$ in range $(b_{i - 1}, b_i)$, so let $delta = delta + (b_i - b_{i - 1} - 1)$. If $delta = 0$, which means now we have to use min operation to get $b_i$. Else, just use max operation and comsume one unused numbers.$needMa$ can be calculated out by the similar way.accepted code
 » 5 months ago, # |   -7 How to solve B?
•  » » 5 months ago, # ^ |   +5 you can choose alternate 1,a[i] since either in a[1],1,a[2],1.... or in 1,a[1],1,a[2],.... sum of values copied directly will be at least half of the total sum .
•  » » » 5 months ago, # ^ |   +24 I believe for each ai, if we find bi = highest 2^k such that 2^k<=ai, that should also give the answer
•  » » » » 5 months ago, # ^ |   0 you are right , it's prove is also similar to above since we are subtracting at least half from each index value.
•  » » » » 5 months ago, # ^ |   0 i used the same approach
•  » » » 5 months ago, # ^ |   0 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.
•  » » 5 months ago, # ^ |   +1 Choose the closest power of 2 for every A[i]. Also ensure that it isnt above 1e9.
•  » » 5 months ago, # ^ | ← Rev. 3 →   +4 You can make two arrays depending on array a Array a=a1,a2,a3,a4,a5 first array f=1,a2,1,a4,1 second array g=a1,1,a3,1,a5 One of these arrays will surely work Proof: let us calculate |a[i]-f[i]| =|a1-1|+|a3-1|+|a5-1|=a1+a3+a5-3 let us calculate |a[i]-g[i]| =a2+a4-2 Add these take average (a1+a2+a3+a4+a5-5)/2 This is obiviously less than (a1+a2+a3+a4+a5)/2
•  » » » 5 months ago, # ^ |   0 Wonderful solution! Thanks
•  » » » 5 months ago, # ^ |   0 why did u add |a[i]-f[i]| and |a[i]-g[i]|
•  » » » » 5 months ago, # ^ |   +1 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
•  » » » » » 5 months ago, # ^ |   0 that's clear now.Thanks!
•  » » » 5 months ago, # ^ |   0 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.
•  » » » » 5 months ago, # ^ |   0 A= a1+a3+a5-3 B= a2+a4-2A+B= a1+a2+a3+a4+a5-5 = S-5A+B<=SAt A=B: A=S/2If u increased A you have to decrease B and vice versa to keep the state A+B<=S
•  » » 5 months ago, # ^ |   0 My approach was calculating the summation of odd indices elements and even indices elements. Then check which of these summations is minimum. If odd indices elements summation is minimum then even indices elements summation, print 1 instead of every odd index element and print the corresponding value from the given array for even indices. If even indices elements summation is minimum then do the vice versa.
•  » » 5 months ago, # ^ |   +3 Since $\sum\limits_{i=1}^{n}{|ai−bi|}$ $<=$ $S/2$. One way to achieve this would be to atleast subtract $a[i]/2$ from every $a[i]$. And from this graph, we can say that $2^{\operatorname{floor}\left(\log_{2}\left(x\right)\right)}$ > $\frac{x}{2}$ So the array B will be the $2^{\operatorname{floor}\left(\log_{2}\left(a[i]\right)\right)}$ for all $0  » 5 months ago, # | 0 How to solve A ? Can someone give me an intimation? •  » » 5 months ago, # ^ | ← Rev. 4 → +1 You have to check (a + b + c) % 9 value, and some other things.We have to make the HPs to 1, 1, 1 by exactly 7*k- 1(k is a positive integer) shots. In that 7*k- 1 shots, there are k-1 enhanced shots. So the total HPs that you damages is, 7*k- 1 + 2(k-1) = 9*k- 3. Thus, the total HPs that you should attack will be (9*k- 3) + 1 + 1 + 1 = 9*k.So firstly, you need to check that (a + b + c) is divisible by 9.I said "other things" at the above. There could be some situations that when you use k enhanced shots, you make all HPs to zero. These situations should have the answer "NO." •  » » 5 months ago, # ^ | +3 Approach for A: a, b, c are health points. After every 7th shot, total health is decreased by ( 1 + 1 + 1 + 1 + 1 + 1 + 3) = 9. So after every 7 nth shot, health gets decreased by 9n. So, you have to first check if (a + b + c) is divisible by 9, if it's not then you can in no way print "YES". If the sum is divisible by 9, the only thing you have to check is min( a, b, c) >= n for "YES". Reason is, every 7 nth shot, each of your health point is compulsorily decreased by 1. Else print "NO".  •  » » » 5 months ago, # ^ | 0 Can u just clear that in enhanced shot whether it is necessary to reduce health of every monster by 1 or is it okay that already health of a monster becomes 0 and then executing enhanced shoot ?like a= 2 , b= 0 , c =1 ; can we now shoot an enhanced step or not ? •  » » » » 5 months ago, # ^ | 0 Third para, first line of the problem clearly states what you want to know:You want to pass the dungeon beautifully, i. e., kill all the monsters with the same enhanced shot (i. e. after some enhanced shot, the health points of each of the monsters should become equal to 0 for the first time).  » 5 months ago, # | +43 I am doing a post-contest stream to talk about all the problems, feel free to tune in at https://www.twitch.tv/stevenkplus. •  » » 5 months ago, # ^ | +4 Please make streams on youtube as well. Is it possible? •  » » 5 months ago, # ^ | +9 Raw notes on problems A-F (taken live during stream): https://gist.github.com/stevenhao/b203645f59218ca59aaa4cbd447f8a61Youtube video will be posted on my channel https://www.youtube.com/channel/UCl9IahGhVii0YrjdJvM1XNg •  » » » 5 months ago, # ^ | 0 For D, how does greedily flipping work? I mean I understand the flipping part it is like multiplying by -1 and still taking max but how does the greedy solution work? Also, is this type of solution some common pattern of thinking that will come with experience or just a one off? •  » » » » 5 months ago, # ^ | ← Rev. 2 → 0 For x=0, you have a sequence of parentheses that must be balanced.You can think of incrementing x as deleting a subsequence )( from the string (delete, not flip; the explanation I gave during the stream wasn't the most clear).So you can use this observation to calculate the minimum possible x for which it's possible to obtain a balanced sequence of parentheses after deleting x )(s, as this number is just -min(prefix_sums).You reverse the string and do the same thing to compute the max x. Hope this helps!  » 5 months ago, # | +16 Anyone confused about the difficulty level of this round? To me E is way more easier than B even A (just quite boring implementation). I was thinking many people would solve E easily but got stuck on A, B for a long time. C and E should be B and C while B should be regarded as some tricky C-level problem. (Or I didn't find the correct approach or something). •  » » 5 months ago, # ^ | 0 And I spent almost 2 hours to solve E. •  » » » 5 months ago, # ^ | 0 But the idea is quite simple right? just topo-sort based implementation. After I finished reading B I stuck for a while and tried several approach until found the magic trick. •  » » » » 5 months ago, # ^ | 0 Once you come up with the solution for A and B, it'll take like up to 5 minutes to finish them, however the ideas are hidden because those problems are not any of classic algorithms. I'd say it requires some mathematical observation.On the other hand, the idea of E is clear if you are familiar with classic graphic algorithms when it needs more time to code. For me I code too slowly and I couldn't get the points of E even I recognized the method to solve this problem at the first glance.The moral of the story is to read every problem, and it's also a good opportunity for us to see different kind of problems.  » 5 months ago, # | ← Rev. 2 → +3 Problem B would have been very easy if the array was sorted. I guess the solution would involve alternate 1's and other numbers, then it could be solved even without checking whether the sum of odd indices' element is greater or even.  » 5 months ago, # | +24 C was so strange for me. Even though the statement is written fine, for some reason I was still struggling to understand what is exactly going on in this problem.  » 5 months ago, # | 0 Anyone knows about test case 9 for E? •  » » 5 months ago, # ^ | -11 you have to start the topological sort DFS from the head of each unvisited node. •  » » » 5 months ago, # ^ | 0 nvm messed up topological sort, should have used kahn's TS  » 5 months ago, # | ← Rev. 2 → -35 need more practice  » 5 months ago, # | 0 couldn't solve A in 1 hour 50 minutes , solved B in last 10 minutes lol  » 5 months ago, # | 0 How to solve problem D ? Thank you in advance !! •  » » 5 months ago, # ^ | +3 Find maximum x and minimum x using binary search and subtract them  » 5 months ago, # | 0 test 18 in E? •  » » 5 months ago, # ^ | 0 Well I got TLE in that test because I had a very stupid bug related to checking if the graph is cyclic. So maybe you have that error too.  » 5 months ago, # | 0 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.  » 5 months ago, # | 0 Can someone please tell what is wrong in this approach (A)? _/_ Spoiler#include using namespace std; #define ll long long int main(){ ios::sync_with_stdio(0); cin.tie(0); int t; cin>>t; while(t--){ ll a, b, c; cin>>a>>b>>c; ll sum=a+b+c-3; if((sum+1)%7==0 && sum>0) cout<<"YES"<<"\n"; else cout<<"NO"<<"\n"; } return 0; }  •  » » 5 months ago, # ^ | 0 every 7th round shoots all three of them , you didn't substract them from sum •  » » » 5 months ago, # ^ | 0 I've definitely taken that into account when I add 1 to the sum and check if it's divisible by 7 or not •  » » » » 5 months ago, # ^ | 0 lets say you kill all of them in enhancement in 21th shoot , before 21st shoot you had 7th and 14th shoot , during 7th shoot you shoot all of them once , during 14th shoot you again shoot all of them once , this way you need a way to subtract some shoots ,eg : for a,b,c == 1 , 11 , 11 , your solution says YES , buts its clearly not possible in 7th shoot you have to shoot a , it wont be possile then •  » » » » » 5 months ago, # ^ | 0 Ah, yes. I now understand my stupidity. I see some solutions in which they've simply moduloed sum by 9 and divided the sum by 9 too and check with the health powers. Could you please explain this? •  » » » » » » 5 months ago, # ^ | 0 Hi, @yours.truly.beginner, the reason to take mod 9 is simple. Consider the 1st 7 shots, there will be 6+3=9 damage. And this would be the same in ALL the subsequent set of 7 shots. So the damage per cycle needs to be calculated using mod9 instead of mod7. Hope this helps. •  » » » 5 months ago, # ^ | 0 consider the testcase : 1 50 1 49your code will give "YES" but ans is "NO"  » 5 months ago, # | 0 Any solution for D?I tried Binary search to find maximum x but doesn't work. •  » » 5 months ago, # ^ | 0 You should find both the minimum and maximum of x.My code : 101562193 •  » » » 5 months ago, # ^ | 0 Do you mean that a range of x works? For example x = 2 to x = 5 in n = 10? More like a ternary search? Sorry if it's a noob doubt. •  » » » » 5 months ago, # ^ | 0 How can you apply binary search if possible value of something is like 0000111100000. Binary search is only possible in case of possible value of something like 00011111 or 11110000,i.e upto some point it is 1, and after that 0. Should it be ternary search? •  » » » » » 5 months ago, # ^ | +14 Consider two arrays$v_1,v_2$.$v_1$contains numbers in$b$, and$v_2$contains numbers not in$b$. Both arrays are sorted in increasing order.Define$cmp(l_1,r_1,l_2,r_2)$as follows : If it is possible to redistribute the numbers$v_1[l_1...r_1]$and$v_2[l_2...r_2]$(inclusive) into$(r_1-l_1+1)$pairs, such that for every pair, the number from$v_1$is less than the number from$v_2$, then$cmp(l_1,r_1,l_2,r_2)=-1$.If it is possible to do so, such that for every pair, the number from$v_1$is greater than the number from$v_2$, then$cmp(l_1,r_1,l_2,r_2)=1$.Otherwise,$cmp(l_1,r_1,l_2,r_2)=0$.(For example, if$v_1 = [ 1,4,5,9,10 ] , v_2 = [ 2,3,6,7,8 ]$, then$cmp(0,2,2,4)=-1$and$cmp(0,3,1,4)=0$.)Note that some$x$is valid, if and only if$cmp(0,x-1,n-x,n-1)=-1$and$cmp(x,n-1,0,n-x-1)=1$.It can be proven that the sequence$cmp(0,0,n-1,n-1),cmp(0,1,n-2,n-1),...,cmp(0,n-1,0,n-1)$is non-decreasing. Therefore, the maximum$x$that satisfies$cmp(0,x-1,n-x,n-1)=-1$can be found with a binary search.Similarly, the minimum$x$that satisfies$cmp(x,n-1,0,n-x-1)=1$can also be found with a binary search.The answer is$max(x)-min(x)+1$.The overall time complexity is$O(n \log n)\$.
•  » » » » » » 5 months ago, # ^ |   0 Thanks！
•  » » » » » » 5 months ago, # ^ |   0 thanks
•  » » » » » 5 months ago, # ^ |   0 Why is it 00000111111000000My binary search was just a guess
•  » » 5 months ago, # ^ | ← Rev. 4 →   +3 What I think for this problem is that if any every array element can only be a max or min , then we decrease the answer by 1 (initially the answer was n+1) . For checking if a number can only be a min , we count how many numbers smaller than the current number does not exist in the array (call it rem). Now we check how many previous elements can only be min (call it vs) . Now we check if rem + vs <= i (where i is the index of that element 0 based ) . Now we do similar for checking if a number can only be min . We take the union of these two groups and subtract from answer . My implementation for this approach : 101590810 Please give feedback for this solution .
•  » » » 5 months ago, # ^ |   0 Can you explain why this idea works?
•  » » » » 5 months ago, # ^ | ← Rev. 2 →   +3 In this 'rem' denotes the number of elements which do not occur in the array smaller than the current element . Now if we want to make the current element as max , then we have to pair it with one of the 'rem' elements . Now , the total rem elements remaining at this point is going to be rem - (i - vs) , because 'vs' number of elements can not be paired with smaller elements . So , (i — vs) out of rem are paired so far .So , we simply check if any smaller element is remaining for pairing with current element or not .
•  » » » » » 5 months ago, # ^ |   0 i mean this idea * What I think for this problem is that if any every array element can only be a max or min , then we decrease the answer *is there a proof or something for that.By the way this solution is really cool.
•  » » » » » » 5 months ago, # ^ |   +3 Oh that idea is quite intuitive I guess . Let's take an example such that k1 elements can only be min and k2 elements can only be max . Now , for every k1 elements , the minimum value possible will increase by 1 and for every k2 elements the maximum value possible will decrease by 1 . Hence finally , the answer will be shrinked to that range . I think you will got the idea now !
•  » » » » » » » 5 months ago, # ^ |   0 Yeah that's clear nowThanks for the help!Great solution.
•  » » » 5 months ago, # ^ |   0 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
 » 5 months ago, # |   +7 Why the statement of problem C is so COMPLICATED?
 » 5 months ago, # |   0 I think i need much more practice
•  » » 5 months ago, # ^ |   0 can anyone suggest whether ladders help us to get better in rounds? Thanks in advance :)
 » 5 months ago, # |   0 One of the worst for me couldn't even solve 1 today, f me
•  » » 5 months ago, # ^ |   0 I've implemented A the same way you have, could you find out what's wrong in that logic?
•  » » 5 months ago, # ^ |   +1 same for me!couldn't solved even signle problem!
•  » » 5 months ago, # ^ |   0 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 .
 » 5 months ago, # | ← Rev. 2 →   +1 Problem C, I dont get it why my submission 101572735 does not work.It fails in first testcase of test 3. Is this not a more or less simple simulation, how can this fail?
•  » » 5 months ago, # ^ |   0 Sire, kindly have a look at my submission for A above. Please tell what's exactly wrong in what I've implemented.
•  » » 5 months ago, # ^ |   +4 Should you also not unblock in your else part?
•  » » » 5 months ago, # ^ |   +1 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).
•  » » 5 months ago, # ^ |   +4 INF is too small. Made the same mistake during contest. :(
•  » » » 5 months ago, # ^ | ← Rev. 2 →   +23 edit: Cursing has been removedThanks for pointing out! This is the working version, with bigger INF. 101583027
 » 5 months ago, # |   +18 Very weak test cases. I solved problem A in 2 minutes but missed an equal to sign. Hacked my own solution. 101512791
 » 5 months ago, # |   +3 Can anybody tell me the meaning of problem statement of C?
 » 5 months ago, # | ← Rev. 2 →   -6 Wow... Questions were really tough(especially A and B). I usually solve at least 1 question in div.2 but I couldn't solve any:( Also, only two people solved F. I think this round is closer to div 1
•  » » 5 months ago, # ^ |   0 Or maybe Div1.5
 » 5 months ago, # |   0 Good problem set with some tricky questions!
•  » » 5 months ago, # ^ |   0 problems played a mind game with me
 » 5 months ago, # |   0 101562083This 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 .
 » 5 months ago, # |   0 In problem B , Why using powers of 2 is the right approach ??
•  » » 5 months ago, # ^ |   0 Nearest power of 2 of X can't be more than two times bigger or more than two times lower than X
•  » » » 5 months ago, # ^ |   0 Could you explain this approach by some number ,cause I didn't get it yet. Thanks in advance.
•  » » 5 months ago, # ^ |   +6 You could also make alternate elements as 1 .
 » 5 months ago, # |   0 problem C is not good, it really difficult to understand but too easy to solve.
•  » » 5 months ago, # ^ |   +18 I would totally disagree with that, I think it's easy to understand and hard to implement. Since solution is quite trivial( I think question itself tells what to do ).
•  » » 5 months ago, # ^ |   0 And what's make C more difficult is 100 of hacks with just a small mistake from implementers
•  » » » 5 months ago, # ^ |   +3 Can you mention the mistake ? Maybe by replying or by hacking my solution.
•  » » » » 5 months ago, # ^ |   0 I checked your solution, and it was handling that case. I got curious when I saw sheaf hacking too many solutions, then I came up with below test case which helped me in hacking around 10 solutions. 121 -9999999991000000000 1000000000
•  » » » » » 5 months ago, # ^ |   +1 I believe this has costed a lot of people -deltas from expected +deltas. Like when I completed contest my rank was around 311 and now it's 286. That's around 25 people who got WA on hack cases. The numbers would have increased as we go down the rank list. It's really sad. Pretests should have been strong.PS: I know it's not a contest of guesstimation and we are expected to submit a fully proved solution. Still most of us depends heavily on pretests.
 » 5 months ago, # |   -38 A had the shittest problem statement ever.
•  » » 5 months ago, # ^ |   +17 What was not ok with that statement?
 » 5 months ago, # |   0 Different Solution of B!! Can someone explain me how this solution is working? Is there any hacky case for this solution?
 » 5 months ago, # |   +1 where to find ques to practice like A? ive noticed im not very good at ques similar to A
•  » » 5 months ago, # ^ |   0 I would suggest to do problems tagged with 'math'. It is not a real math problem, but the observation needed is found by similar thinking like math problems.
•  » » » 5 months ago, # ^ |   0 ok i'll try. thnx bruv
•  » » 5 months ago, # ^ |   0 As far as I remember, there are some problems (A) of educational rounds itself which are related to distributing things. So I personally learnt solving problems like A from them. Hope you also find them helpful.I started with this and I really love the solution 1221C - Perfect Team
•  » » » 5 months ago, # ^ |   0 i'll def try. thnx bro
 » 5 months ago, # |   +3 i did not participate in the contest but i hacked codes after the contest will my rate change or no
•  » » 5 months ago, # ^ |   +3 Your rating will be changed if and only if you submitted at least one submission during the contest.
 » 5 months ago, # |   0 Oh my god , i sucked so hard , couldn't even do a single problem . F in the comments please
 » 5 months ago, # | ← Rev. 3 →   +5 For C, i just stored the positions at all the ti's and then checked for the condition. 101587380
 » 5 months ago, # |   0 In problem 3 , By only changing > to < sign my solution works, but i could not find that bug during the contest.
•  » » 5 months ago, # ^ |   0 Then same goes for many contestants who got hacked on A. They just forgot to add "=".
 » 5 months ago, # |   0 Is there any benefit in hacking this round?
•  » » 5 months ago, # ^ |   0 You mean hacking solution of this round o_O
•  » » » 5 months ago, # ^ |   0 yes.... ?
•  » » » » 5 months ago, # ^ |   0 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 :)
•  » » » » » 5 months ago, # ^ |   0 oh... I understand.. thanks bro.
 » 5 months ago, # |   0 Is there any penalty for failed hack attempts?
•  » » 5 months ago, # ^ |   0 no there is not any penalty in failed hacks and no points in successful hacks
•  » » » 5 months ago, # ^ |   +2 Thanks
•  » » » 5 months ago, # ^ |   0 But after one unsuccessful hack my rank decreases why it happened?
 » 5 months ago, # |   0 During the hacking phase, I found a submission and get shocked after seeing it.https://codeforces.com/contest/1463/submission/101559684Can anyone tell me, how it gets executed? Is it encrypted or something else? I wanna know, just for curiosity :p
•  » » 5 months ago, # ^ |   +3 Just remove all "_hCbW6Loj__jiD1iD0Y__ZKcoJTEx_", it was perhaps added by some obufuscator before submission.
•  » » » 5 months ago, # ^ |   +21 Isn't this violation of rules ?Point 16PS: I know above attached post is 10 years old.
•  » » » 5 months ago, # ^ |   0 I think he added this, so that the code becomes unreadable and no one can hack him.
 » 5 months ago, # |   +13 I am back at CF after 7 years, and I find this round educational indeed ;)Problem E is especially nice if you read it carefully — my solution does not use toposort. I look for cycles in x->y chains, and then just do BFS over chains :)
•  » » 5 months ago, # ^ |   -7 Welcome back sir :)
•  » » 5 months ago, # ^ |   +3 7 years is good hell of a time. Back then, how did you guys even practice?
 » 5 months ago, # |   0 How to solve problem F?
 » 5 months ago, # |   0 is there any way to get full test case to debug better?
 » 5 months ago, # |   +2 I understand that in hindsight things seem obvious, but the fact that the orginal tests for A didn't contain simple tests like 1 2 6 seems pretty baffling to me.
 » 5 months ago, # |   0 I had been FST or hacked five times including this time When my predict score achieve 2000.That's true there were some bugs in my program, but I hope problem writer can make test data stronger, It's not funny When I suffer a disastrous decline
 » 5 months ago, # |   +8
 » 5 months ago, # |   0 How to know own ranking after the contest? I couldn't find (like codechef..).
•  » » 5 months ago, # ^ |   0 You could use plugins like CF-predictor
 » 5 months ago, # |   0 when will the new rating changes come out.how much time does it take for ratings to come out after contest
 » 5 months ago, # |   +5 When editorials will be released?Curious to learn new concepts involved in the problems:-)
 » 5 months ago, # |   +16 Codeforces is Best site ever made. I used it like 10 years starting from childhood. Thanks for all creators of this fantastic Website and to everyone who is reading this now !!Happy New Year!!I Wish all of you to solve problems (lvl higher than 3000) and reach Nutella this coming year :)
 » 5 months ago, # |   0 What is the reason for sometimes taking 11 or 12 hours for new rating changes while sometimes it just needs 5 or 6 hours?
 » 5 months ago, # |   0 Educational rounds have always been educational for us. Teaches a lot. Thanks to Harbour Space University and the contributers.
 » 5 months ago, # |   0 I was in a good place until I got hacked for C :(It seems like so many people made the same mistakes and got hacked. For problem A mind that a,b,c >= sum/9, you'll pass the preliminary test even if you forget the "=". And for problem C, it's necessary to use a big enough number as infinity, I used 2e9 + 10 and got hacked, but changed it to 1e15 after the contest and passed
•  » » 5 months ago, # ^ |   +1 I avoided the use of Infinity. Accepted Code
•  » » » 5 months ago, # ^ |   0 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
•  » » » 5 months ago, # ^ |   0 I did the same. So the solutions that got hacked were only those who used INF?
 » 5 months ago, # |   0 Now how do i know what i need to learn from this educational round?
 » 5 months ago, # |   +2 In D the sample test cases gave hint that there is a continuous segment of possible x's
 » 5 months ago, # |   0 where is the editorial of this contest
•  » » 5 months ago, # ^ |   0 Not yet released I think. But if you want to know the approach of any of these questions you can search "codeforces educational round 100" on YouTube and will get many videos. Although, can wait for the editorial. Hope it's available soon.
•  » » » 5 months ago, # ^ |   0 Ok
 » 5 months ago, # |   0 Does anyone else also feel that the testing available during the contest(also system testing) were not so diverse(covered all corner cases)? My question 3's solution got hacked, and the mistake I had done was use int instead of 'long long'(causing overflow). And now my question 1 is showing wrong as, I had misplaced equality sign (used greater than or equal to, when it should have been greater than). I know these silly mistake by side are bad but doesn't anyone feel that these simple cases should have been included originally? Or this is all, the part of the game and I should be more careful with my code next time onwards(This I surely will, after this contest). Just attaching my solution, if someone wants to have a look.Q1)Wrong (accepted during the test and also in system testing) — https://codeforces.com/contest/1463/submission/101529653Right (inequality signs changed)- https://codeforces.com/contest/1463/submission/101619142Q3)Right (changed int to long long) — https://codeforces.com/contest/1463/submission/101614274
•  » » 5 months ago, # ^ |   0 For Question 3, it was not just yours. There were more than 100 hacks just because of same issue. I agree this case should have been there in pretest, but we can't do much, because as a participant we are expected to submit a correct solution rather testing if our solution is correct from pretests.
 » 5 months ago, # |   0 Nice problems. But my only submission this round got hacked because I missed an '=' sign lol :(
 » 5 months ago, # |   0 I was doing D problem, and came with a unique error.For a set 's' upper_bound(s.begin(),s.end(),num) -> gives TLE (https://codeforces.ml/contest/1463/submission/101617604)s.upper_bound(num) -> gives AC (https://codeforces.ml/contest/1463/submission/101621369)You can see difference here (https://www.diffchecker.com/6kdBRnku)Can anyone please tell why this is happening?
•  » » 5 months ago, # ^ |   +20 First one runs in O(N) Refer this
•  » » » 5 months ago, # ^ |   0 Thnx!
 » 5 months ago, # |   -14 Codeforces is Best site ever made. I used it like 10 years starting from childhood. Thanks for all creators of this fantastic Website and to everyone who is reading this now !!Happy New Year!!I Wish all of you to solve problems (lvl higher than 3000) and reach Nutella this coming year :)
 » 5 months ago, # | ← Rev. 3 →   0 Can anyone please explain me the problem C statement. I am not even able to understand the statement properly.Upd : Got it now :)
 » 5 months ago, # |   -20 Codeforces is Best site ever made. I used it like 10 years starting from childhood. Thanks for all creators of this fantastic Website and to everyone who is reading this now !!Happy New Year!!I Wish all of you to solve problems (lvl higher than 3000) and reach Nutella this coming year :)
 » 5 months ago, # |   +18 Editorial?
•  » » 5 months ago, # ^ |   0 Educational round editorials are always delayed.
 » 5 months ago, # |   +1 i'm sorry but i want to ask when you will post the tutorial
 » 5 months ago, # |   0 Auto comment: topic has been updated by awoo (previous revision, new revision, compare).
 » 5 months ago, # |   0 Auto comment: topic has been updated by awoo (previous revision, new revision, compare).
 » 5 months ago, # | ← Rev. 2 →   +2 Hello Codeforces, I recently gave Educational Codeforces Round 100 (Rated for Div. 2), it went well for me but surprisingly I have also received a plagiarism warning, even though I haven't done anything like that(ever), nor I have used any public IDEs like ideone.com, which was mentioned in the warning. Also, it is not because of coincidently using a common source, as my solution didn't involve any of that, I feel it is because of the solution itself, as it didn't involve any complex piece of code. Therefore, I request the Codeforces to please take this warning back. My submission: 101564563, Other's submission: 101576941
•  » » 5 months ago, # ^ |   0 I see that solutions are pretty similar. Probably, the solution has been stolen somehow. This warning doesn't affect you, it is just a notification for you to be careful.
•  » » » 5 months ago, # ^ |   +6 I don't think so. The answer for this problem was a bit standard. I've also written a similar code to them. I do think that it might be an error from the plagiarism checker.
 » 5 months ago, # |   +3 A message was sent to me from the system as a warning for rules violation. I did nothing intentionally. I used my personal IDE and didn't send my code to anybody. Things happened was nothing but co-incident.
•  » » 5 months ago, # ^ |   0
 » 4 months ago, # |   0 Could you tell me what's wrong with this submission? https://codeforces.com/contest/1469/submission/102750136 I can't see what 79 test case is about