### vovuh's blog

By vovuh, history, 23 months ago, translation,

I am so sorry about very long gaps between the contests but I really don't have enough time to prepare the problems. So...

<copy-pasted-part>

Hello!

Codeforces Round #521 (Div. 3) will start at Nov/16/2018 17:35 (Moscow time). You will be offered 6 or 7 problems with expected difficulties to compose an interesting competition for participants with ratings up to 1600. Probably, participants from the first division will not be at all interested by this problems. And for 1600-1899 the problems will be too easy. However, all of you who wish to take part and have rating 1600 or higher, can register for the round unofficially.

The round will be hosted by rules of educational rounds (extended ACM-ICPC). Thus, during the round, solutions will be judged on preliminary tests, and after the round it will be a 12-hour phase of open hacks. I tried to make strong tests — just like you will be upset if many solutions fail after the contest is over.

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

Note that the penalty for the wrong submission in this round (and the following Div. 3 rounds) is 10 minutes.

Remember that only the trusted participants of the third division will be included in the official standings table. As it is written by link, this is a compulsory measure for combating unsporting behavior. To qualify as a trusted participants of the third division, you must:

• take part in at least two rated rounds (and solve at least one problem in each of them),
• do not have a point of 1900 or higher in the rating.

Regardless of whether you are a trusted participant of the third division or not, if your rating is less than 1600, then the round will be rated for you.

Thanks to MikeMirzayanov for the platform, help with ideas for problems and for coordination of my work. Thanks to my good friends Mikhail PikMike Piklyaev, Maksim Ne0n25 Mescheryakov and Ivan BledDest Androsov for help in round preparation and testing the round.

Good luck!

I also would like to say that participants who will submit wrong solutions on purpose and hack them afterwards (example) will not be shown in the hacking leaders table.

</copy-pasted-part>

UPD1:

Congratulations to the winners:

Rank Competitor Problems Solved Penalty
1 diolG 7 173
2 lyzqs 7 228
3 pvviet001 7 241
3 LVL 7 241

Congratulations to the best hackers:

Rank Competitor Hack Count
1 PikMike 153:-6
2 ______-__________-______ 186:-85
3 knowbody 128:-6
4 Laggay 113:-6
5 Marcosk 66:-6

1359 successful hacks and 755 unsuccessful hacks were made in total!

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

Problem Competitor Penalty
A Laggay 0:01
B Laggay 0:03
C Programmist_111 0:05
D Laggay 0:12
E Programmist_111 0:12
F1 happ1 0:29

UPD2: Editorial is published!

• +138

 » 23 months ago, # |   -43 I am here for reading comments.But i am the fisrt commentor,so read my comment and hit the up button... Wish you all higher rating...
 » 23 months ago, # |   +44 What happen for Div. 3 contests if we haven't Vovuh ?Thanks Vovuh and also thanks creator of copy-paste (Larry Tesler) :))
 » 23 months ago, # |   0 Good luck to all of you, guys! Hope you high ratings. :)
•  » » 23 months ago, # ^ |   -10 coaie cui mortii ma-tii ii pasa ca esti tu nicedu-te inapoi pe pbinfo coae
 » 23 months ago, # |   -34 earlier i used to think that i could solve 4-5 problems in div 3 rounds as it would be easy with div3 tag , but now i knew one thing "dhoka hai ye , ek trah ka jaal, shajis hai hamein nicha dikhane ki, haha div3 tag XXXDDDD", don't take it offensively it's just a joke, i love codeforces.
•  » » 23 months ago, # ^ |   -8 What a nasty comment...
•  » » 23 months ago, # ^ |   +98 haha, same, man
•  » » » 23 months ago, # ^ |   +5 Translation?
•  » » » » 23 months ago, # ^ |   +42 Meh, languages used are part of the joke. You'll have to believe me that it's funny and highly relatable)
•  » » » » 23 months ago, # ^ | ← Rev. 3 →   -23 So i opened the refrigerator, took a tomato, a cucumber,a greenery, wanted to make salad. It is obvious the salad should be made with mayonnaise (else who who would eat it?). I cut all and realized I forgot the mayonnaise. i opened the refrigerator again, took the mayonaise and suddenly realized that there is some lard in front of me. I have never eat the lard, but i suddenly i wanted it. While I filled the salad with the mayonnaise , cut the lard, ate it and suddenly all (*something in Ukrainian)
•  » » » » » 23 months ago, # ^ |   +24 This could be used as a problem statement starter XD
•  » » » 23 months ago, # ^ |   -6 haha classic
 » 23 months ago, # |   +3 Pardon me this is my first rated(hopefully) Div 3 contest. Why is this rule there?I also would like to say that participants who will submit wrong solutions on purpose and hack them afterwards (example) will not be shown in the hacking leaders table.They will be considered in leaderboard table though?
•  » » 23 months ago, # ^ |   0 If they solve problems fairly then yes, they're will be shown in the leaderboard. This rule is there just to exclude the people who want to be top-5 by unfair hacks.
•  » » » 23 months ago, # ^ |   0 what's the benefit of hacking someone's submission ? does it increases rating or points?
•  » » » » 23 months ago, # ^ |   0 I don't know but I'm sure that X3NNY knows (but I think that he was framed and this is just coincidence)
•  » » » » » 23 months ago, # ^ |   0 I just want to lose Rating, no harm.
 » 23 months ago, # |   0 How to get reminder for this type of contest?
•  » » 23 months ago, # ^ |   0 i just set https://clist.by/ as my browser home page
 » 23 months ago, # | ← Rev. 2 →   0 I hope this div3 A will not be harder than div2 A as alwaysedit:finally it's not
 » 23 months ago, # |   0 today I'll become blue. screen it
•  » » 23 months ago, # ^ |   +1 oh！ really ? 乛◡乛）Good luck， I hope u can achieve it.
•  » » 23 months ago, # ^ |   +1 I will become green B) screen it
•  » » » 23 months ago, # ^ |   +2 I too will become green this time :P
•  » » » » 23 months ago, # ^ |   0 Disappointed totally :(
•  » » » 23 months ago, # ^ |   0 You lied. No rating change for you ;)
•  » » » » 23 months ago, # ^ |   0 I will next contest don't worry
•  » » » » » 23 months ago, # ^ |   0 xD
•  » » 23 months ago, # ^ | ← Rev. 2 →   +9 lol, guys, 2 rating units. I got 113 out of 115 needed))))
•  » » » 23 months ago, # ^ | ← Rev. 2 →   +1 so，why u create flag before the contest ? 乛◡乛）
•  » » » » 23 months ago, # ^ |   +4 it was my purpose. I feel like I could turn blue.
•  » » 23 months ago, # ^ |   0 1598 so close XD
 » 23 months ago, # |   -22 After Hacknig xD
•  » » 23 months ago, # ^ |   +3 Don't post these kinds of shitz next time >(
•  » » » 23 months ago, # ^ |   0 this is not shit, this is good for all
•  » » » » 23 months ago, # ^ |   0 Hell stop it -_-
 » 23 months ago, # |   +14 Thanks, Vovuh !!
 » 23 months ago, # | ← Rev. 2 →   0 Can someone please tell me why my submission for F is getting TLE on test 41 ? Used deque and dp.
 » 23 months ago, # | ← Rev. 2 →   0 I can't believe I wasted that time on C that feels incredibly stupid XDedit: and it's WA XD
 » 23 months ago, # |   0 Is E binary search?
•  » » 23 months ago, # ^ |   +1 No, but D is
•  » » » 23 months ago, # ^ |   0 How to solve D?
•  » » » » 23 months ago, # ^ | ← Rev. 2 →   0 Observation: Suppose from an array you can remove a number of value 'v' X number of times, you can also remove it X — 1 number of times, Basic division and function check on this monotonic function gives you AC. Didn't code this because my implementation skills are bad. But pretty sure this approach is correct.
•  » » » » » 23 months ago, # ^ |   +1 I have solved this greedily using priority queue with sorting on the basis on how much more copies of a number we can get if select the current number since we have to maximize the minimum frequency of taken number Code: http://codeforces.com/contest/1077/submission/45823855
•  » » 23 months ago, # ^ |   0 it is.
•  » » 23 months ago, # ^ |   +3 I solve E with lower_bound in c++.I think it's the same as binary search.
•  » » » 23 months ago, # ^ |   0 Can you explain your approach?
•  » » » 23 months ago, # ^ | ← Rev. 2 →   0 is your solution have two logs ? Is it works by using binary search(or lower_bound) in every possible numbers of competitions?
•  » » » » 23 months ago, # ^ |   0 Yes,there are two logs,one is the number of problem ,one is lower_bound
•  » » 23 months ago, # ^ |   0 I solve D and E with binary search，but I am not sure it will not be hack
 » 23 months ago, # |   0 What is the solution for problem C ?
•  » » 23 months ago, # ^ | ← Rev. 3 →   0 Start from left of the array and if there is a zero in between two ones, remove the right one. Let this be ansA, do the same for the reverse array and let the answer of that be ansB. Final answer is min(ansA, ansB). Sorry this is for B
•  » » » 23 months ago, # ^ |   0 This is the solution to problem B Not C
•  » » » » 23 months ago, # ^ | ← Rev. 3 →   0 Sorry,For C: Let sum of whole array be S, then in a vector store pair of sort this in descending fashion, if you are removing first element of this vector, your remaining sum is S — v[0].value. remainingSum — v[1].value should equal to v[1].value. else your remaining sum is S — v[i].value. remainingSum — v[0].value should equal to v[0].value.
•  » » » » » 23 months ago, # ^ |   0 Can you please Illustrate more ?
•  » » » » » » 23 months ago, # ^ | ← Rev. 4 →   +1 essentially there are a couple ways to create a good array, both can occur though.type1: removing the largest value, hence the second largest value will have to be the sum of the remaining digits, excluding the originally biggest number (and the second largest of course).type2: removing a value (that is not the largest), to make the sum of all the other values equal to the largest.you can check for both types, which is what i did.
•  » » » » » » » 23 months ago, # ^ |   0 Actually, This is a good ideaI have wasted my time in this vector for a long time trying to remove only the greatest one Thanks a lot
•  » » » 23 months ago, # ^ |   0 For B, I think ansA will always be equal to ansB, so there's no point in calculating both of them. If I'm wrong, can someone please suggest a test case where ansA  ≠  ansB?
•  » » 23 months ago, # ^ |   0 Observation: We are checking if removing an element from the array can make the max element equal to the sum of other remaining elements. And in case we are removing the max element, we are just checking if we can make the second max element equal to the sum of other remaining elements. (Since there is no element with -ve value) So, we just have to find out the max and semi-max element and then iterate the array removing each element at a time and checking the above criteria.for example, a= [5,2,1,3] Max= 5, Semi Max= 3 Removing 5(Max), a=[_,2,1,3] makes Semi Max, 3= 2+1 Removing 1, a=[5,2,_,3] makes Max, 5= 2+3 These two are only bad indices in this example.
 » 23 months ago, # |   0 How to solve the hard version of problem F ?
•  » » 23 months ago, # ^ |   +13 dp[number added][last added]Naive transitions work in O(n) for a total of O(n^3). If we use sliding window for each layer, we can transition each layer in O(n), for a total of O(n^2).
 » 23 months ago, # |   +3 Did anyone manage to AC E with dp in O(nlog(109)log(n)), something like this?
•  » » 23 months ago, # ^ | ← Rev. 3 →   0 For E: Store the frequency of each topic in array and sort that array. Then let say we fix the no of topics in first contest be i, then binary search on this array to find if there exists a topic with frequency greater than i, if yes then take the leftmost topic and set it as new index (initially index is 0) and then check for 2 * i and repeat the process. If not found, just break at that index. Repeat the process for new i. Code: http://codeforces.com/contest/1077/submission/45834476
 » 23 months ago, # |   +24 Relief :)
 » 23 months ago, # |   0 How to approach D? what i did, first i count the frequency of every number and then i put them on a pair, but then i could not find any way that how to go further!! i could come this much :(
•  » » 23 months ago, # ^ |   0 me too i just store frequency in hash
•  » » 23 months ago, # ^ |   0 I think recursive find() function that continuously divides possible region for k in half might solve the problem in O(nlgn), but I ran out of the time...
•  » » 23 months ago, # ^ |   0 count the frequency of every number and then put them on pair. now try to cut the array x time. if it is possible than it is possible for all number 1 to x if it is not possible it wont possible for any number x to 200000. (Thats mean you can use binary search)
•  » » 23 months ago, # ^ |   0 It's easy to find an array that can by cut out x times. So just do a binary search for the biggest valid x.
 » 23 months ago, # |   0 Excuse me, where is the tutorial of this contest? :-)
 » 23 months ago, # |   0 give some test case to hack
 » 23 months ago, # |   0 Where is the tutorial for this contest?
 » 23 months ago, # |   0 Is it intended in F2 that using segtree gives TLE but other data structure like sparse table gives AC?
•  » » 23 months ago, # ^ |   0
•  » » 23 months ago, # ^ |   0 I think O(n^2) solution with a queue which supports amortized O(1) maximum extraction was intended.
 » 23 months ago, # |   0 Why on problem F the condition if((k*2-1)*x
•  » » 23 months ago, # ^ |   +1 condition is (x*k + k -1 < n) print(-1)
 » 23 months ago, # |   0 Do you get points for Hacking other's solution in this round?
 » 23 months ago, # | ← Rev. 2 →   0 C Wrong answer on test 3, but I got right answer local.... Why?
• »
»
23 months ago, # ^ |
0

# 45826601

•  » » 23 months ago, # ^ |   0 maybe because you need to write bool exist=false; if you don't it will take arbitary value
•  » » » 23 months ago, # ^ |   0 thx
 » 23 months ago, # | ← Rev. 2 →   -21 Mike bhaiya meri rating kyu nahi badh rhi? ye codeforces hi bekaar hai
 » 23 months ago, # |   0 Plz someone explain me, why 45840553 is TL 16 and 45840575 is RE 1 ?
•  » » 23 months ago, # ^ |   0 Your cmp function does not define a "strict weak ordering", which std::sort requires. The short version of the explanation is that your predicate should behave like < and not like <=.Failing to meet this requirement causes undefined behavior, which basically means that the verdict may vary arbitrarily.P.S: there might be other problems with the source, this is just one I have noticed.
•  » » » 23 months ago, # ^ |   0 Thanks a lot
 » 23 months ago, # |   0 What is the hack for C? A lot of C's solutions are getting hacked.
•  » » 23 months ago, # ^ |   0 4 2 7 7 5 Answer: 2 2 3 The reasons for WA are various as for all of the following outputs I found a solution that produces that output: 0  2 2 2  4 2 3 2 3  2 2 3 2 3 
 » 23 months ago, # |   +1 It seems that I was the only one who misunderstood the statement for problem B. Can anyone tell what is it really asking for ??
•  » » 23 months ago, # ^ | ← Rev. 3 →   +1 me too bro :(
•  » » 23 months ago, # ^ |   0 The question asks for the minimum lights you have to turn off for all peoples "sleep well".
•  » » » 23 months ago, # ^ |   +1 If only I had known that before. I thought they were asking how many different pairs of lights I needed to turn off (turning off a single pair), in order for no people to be disturbed.
•  » » 23 months ago, # ^ | ← Rev. 2 →   0 same, the pairwise distinct stuff confusing me, i think that for sample test 1 answer should be 1 because it only need 1 pair to make not disturbed array, wasted so much time understanding this problem >:(
•  » » » 23 months ago, # ^ |   0 All it required was to search for "101" and keep skipping by 2 so as to prevent any extra count of 101 due to overlap. Here is my submission.
 » 23 months ago, # |   +4 What's the benefit of hacking someone's submission in Div 3? Does it helps in increasing rating?
•  » » 23 months ago, # ^ |   0 No, it doesn't help to increase the rating.
•  » » » 23 months ago, # ^ |   0 But you can overtake some peoples and then your rating will be higher
•  » » » » 23 months ago, # ^ |   +8 Their code will fail at main tests anyway :)
•  » » 23 months ago, # ^ |   +4 Some people enjoy this :) And for cf: you don't need to test some solution if it already failed
 » 23 months ago, # | ← Rev. 2 →   0 I tried to hack a solution (It makes 10^12 operations worst case) but I got unsuccessful hacking however the code I tried to hack takes 128s on my machine itself (with T = 100 , it is 1000 in the test case). I want to ask if hacks are only successful if the code gives WA ? EDIT : here is the link https://codeforces.com/contest/1077/submission/45824799, he is looping from 1 to k/2 when a != b.
•  » » 23 months ago, # ^ |   +2 WoW ! Looks like CF is real fassst.
•  » » 23 months ago, # ^ |   0 Can you give the link of solution?
•  » » » 23 months ago, # ^ |   0 added
•  » » 23 months ago, # ^ | ← Rev. 2 →   0 Then you have a different version of the compiler. On my machine with GCC 7.2.0 it runs almost instantly.EDIT: Actually, you need to have -O2 as a tag for the compiler to make the solution fast, compiler version doesn't matter.
•  » » » 23 months ago, # ^ | ← Rev. 2 →   0 Did it run instantly on a case where k ~ 10^9 and T ~ 100/10 and a!= b?
•  » » » » 23 months ago, # ^ |   +1 Yes. Did you add -O2 as a compiler tag?
•  » » » » » 23 months ago, # ^ | ← Rev. 2 →   0 Yes , I added that tag and it took about 10s(for t = 100).
•  » » » » » 23 months ago, # ^ |   0 Though I still dont get that how can it not give TLE since he loops from 1 to k/2 (1e9/2) for every case with a != b.is CF insanely fast or something since I dont see this passing anywhere.
•  » » » » » » 23 months ago, # ^ |   0 See my reply, and learn compiler theory.
•  » » » » » » 23 months ago, # ^ |   +1 -O2(at least on my machine) notices that the program increases a number "sum" by a-b l times, so it replaces that part of the code with increasing "sum" by (a-b)*l.
•  » » » » » » » 23 months ago, # ^ |   0 :O nevermind. Thanks for your help.
•  » » » » » » 23 months ago, # ^ |   0 You can see the optimised assembly here: https://godbolt.org/z/piYeZH
•  » » 23 months ago, # ^ | ← Rev. 2 →   -10 Compiler optimizations. P.S. This is what happens when a person jumps right into the programming, bypassing the CS.
 » 23 months ago, # |   0 I read some code and want to hack them. But now my head are getting hacked...
 » 23 months ago, # |   +25
 » 23 months ago, # |   +6 Can any one tell me why my solution for E is getting TLE on TestCase 51 I think its Nlog(n). http://codeforces.com/contest/1077/submission/45845419[Link to submission].
•  » » 23 months ago, # ^ |   +4 You're using unordered_map; if you replace it with map, you should get AC. unordered_map can sometimes be slow, you can read more about it here: http://codeforces.com/blog/entry/62393
•  » » » 23 months ago, # ^ |   0 Thanks a lot.
 » 23 months ago, # |   +1 why sometimes there's 3600 participants and sometimes 5000 :/ that's not the first time this happens
 » 23 months ago, # |   0 In problem E: why is this approach is wrong?
•  » » 23 months ago, # ^ |   0 please tell me that why this 45850644 passed and this 45850660 failed ..they are almost please help!!
 » 23 months ago, # |   -22 Problems like Dick
 » 23 months ago, # |   0 What's wrong with std::list? I used sliding window algorithm for F2 and I used std::list to implement it but I got MLE. So I tried to cut down memory by making D[2][5000] instead of D[5000][5000] and I got accepted. But when I changed std::list to std::deque, it was accepted and even faster! In another OJ sites I usually use, std::list is faster than std::deque so I thought it would be same here. Can anybody tell me why?
•  » » 23 months ago, # ^ |   0 MLE code : 45823888 AC code : 45852635 Here is my code.
•  » » 23 months ago, # ^ |   0 Maybe list need some extra space to save pointer？
•  » » » 23 months ago, # ^ | ← Rev. 2 →   0 I think so. According to my short experiment using both std::list and std::deque, std::list is faster than std::deque but drains tons of memory. std::deque, on the other hand, uses less memory but slightly slower. There might be something wrong, so if somebody finds anything new, please let me know.
•  » » » » 23 months ago, # ^ |   +8 Well... std::list is a doubly-linked list, so for every element in it of type T is uses two pointers and one field of type T.std::deque on the other hand is basically a linked list of increasingly large vectors and uses (more or less) the same space as a vector.As a very rough approximation, if T has the same size as a pointer, std::list will use more or less 3 times more memory than std::deque. Nothing wrong with it, it's just the way the structures are implemented.P.S: Bjarne Stroustrup (the creator of C++) has a very interesting talk on why you should avoid using linked lists. They have their uses (mostly when deletion in the middle is involved), but you should avoid them whenever you can use pretty much anything else.
 » 23 months ago, # | ← Rev. 2 →   0 If there is any one want to hack somebody, you can try to hack HunTer's problem C solution, he didn't use long long instead int lol
 » 23 months ago, # |   0 Is it true that SysTest of Educational/div3 round goes this long or is it only this contest? I just realised it today.
 » 23 months ago, # |   0 I did 42 successful hacks but didn't get increase in my rank....how it'll be beneficiary for me?
•  » » 23 months ago, # ^ |   0 in div1/2/1+2
•  » » 23 months ago, # ^ |   +4 this is education mode, you can't get any beneficiary from successful hack
 » 23 months ago, # | ← Rev. 2 →   -6 Comment not applicable
•  » » 23 months ago, # ^ |   0 in few hour i guess
•  » » 23 months ago, # ^ |   0 it seems it is already release
 » 23 months ago, # |   0 I was solving the 3rd problem of round 521 div 3. Problem Link: http://codeforces.com/contest/1077/problem/C As mentioned in question's description that a[i] <= 10^6 but test cases don't follow so. I used frequency array and got runtime error. On the other hand, using map got me AC. Please clarify if I am wrong. Diagnostics: https://imagebin.ca/v/4MtAcprEnUbw RE sol: http://codeforces.com/contest/1077/submission/45860663 AC sol: http://codeforces.com/contest/1077/submission/45862293
•  » » 23 months ago, # ^ |   +3 Even though a[i] <= 10^6, sum can be greater than that, so your line 42 where you tried to access pre[(sum-a[i])/2] would make you RTE
•  » » » 23 months ago, # ^ |   0 faced the same issue.. thanks a lot :)
•  » » » 23 months ago, # ^ |   0 Thank you so much. :) Couldn't think upto that point. :(
 » 23 months ago, # | ← Rev. 2 →   0 I was solving the 3rd problem of round 521 div 3. Problem Link: Problem C I don't know why I'm getting wrong for test case 86. But getting right on my local machine here is the code link Solution.ThankYou.
•  » » 23 months ago, # ^ |   0 Magic has been hided after the dots, last number of the input is 532704.
•  » » » 23 months ago, # ^ |   0 ThankYou
•  » » » 23 months ago, # ^ |   0 But still getting right on my machine.
•  » » » » 23 months ago, # ^ |   0 Then it isnt that testcase, but you're wrong because m is mapping from int, m[temp/2] will be truncated to m[int(temp/2)].
•  » » » » » 23 months ago, # ^ |   0 Thankyou The map is taking some random key with 0 value. Just handled and got ac.
•  » » » » » » 23 months ago, # ^ |   0 But why it will take random key instead of taking only the int part(maximum bits that can hold by int type)
•  » » » » » » » 23 months ago, # ^ |   0 For his code the error is int overflow only, just change m's type to and that will AC.
•  » » » » » » » » 23 months ago, # ^ |   0 the constrain allow to 10^6 why change this give AC?
•  » » » » » » » » » 23 months ago, # ^ |   0 individual element is is under 10^6 but theirs sum may be not.
•  » » » 23 months ago, # ^ |   0 Nope, It still gives the correct output in the cf custom test section also
 » 23 months ago, # | ← Rev. 3 →   0 this 45822434 gives me correct answer for question D in my IDE but this is wrong answer.can any body say why?
 » 23 months ago, # | ← Rev. 2 →   +6 Huge difference between cf-predictor & actual rating change!! What's wrong today?
•  » » 23 months ago, # ^ |   0 if you "hack" someone by sending inputs that are meant to fail the code you get 100 points if that attempt was successful, likewise the person that was "hacked" will loose their points for the question, as their attempt will be considered a failure. I got hacked and dropped a rank because of it i feel.
•  » » » 23 months ago, # ^ |   0 Any of my solutions wasn't hacked here...
•  » » 23 months ago, # ^ | ← Rev. 2 →   0 I think it's because the predictor is considering non-trusted participants on the calculus
 » 23 months ago, # |   0 MikeMirzayanov in predictor, my increment was +98 but i was increased by +77 in change rate why ??
•  » » 23 months ago, # ^ |   +1 Same for mine too...it was showing +61 but actual increase is +39
 » 23 months ago, # |   +1 In this round CF predictor shows my rating would be +103 but actual rating increased by +73 :( :( can anyone please tell me the reason why it happens ???
 » 23 months ago, # | ← Rev. 3 →   0 Vovuh I get WA on problem C with solution 45813685 , but get AC with 45865201. The map might taking some random key with 0 value as I declared map and the data can be long long. But why it will take random key instead of taking only the int part(maximum bits that can hold by int type)??? I have checked in the Codeforces custom test section with that test case. It gives same answer as jury's
•  » » 23 months ago, # ^ |   0 Because when all the values of array are 1e6, value of s will 2*1e5*1e6 which exceeds int datatype. so when you are performing the check at  if(mp[(s-a[i])/2]>0) ,  s — a[i]  has already exceeded int's limit. That is why it wraps up again to lower values and gives incorrect result.
•  » » » 23 months ago, # ^ |   -6 It gives the correct answer in CF's custom test section for the same input -_-
•  » » » 23 months ago, # ^ |   -6 But still it shoudn't give WA for that test case. Cause, when overflow occurs it should some value till limit of int instead of taking random key
•  » » » » 23 months ago, # ^ |   0 It is not taking random key. It is wrapping up to the lower values again when exceeds it's limit.
•  » » » » » 23 months ago, # ^ | ← Rev. 2 →   -6 Then it should be Accepted as it runs well for test case 86 in CF's custom test also :/
•  » » 23 months ago, # ^ |   0 same with my solution 45813690 why this fail, and when change map to ll get AC?
 » 23 months ago, # | ← Rev. 2 →   0 can any one tell me why my solution for E is getting TLE on testcase 54? complexity O(n log^2) http://codeforces.com/contest/1077/submission/45868358
•  » » 23 months ago, # ^ |   0 http://codeforces.com/contest/1077/submission/45868135 Accepted used multiset.lower_bound instead of lower_bound can anyone help why lower_bound is slower in the documentation both function complexity is O(log).
•  » » » 23 months ago, # ^ |   0
•  » » » 23 months ago, # ^ |   +10 No, you are wrong. For non-random access iterators lower_bound is O(N) in complexity so lower_bound on set/multiset will be O(N) while set/multiset::lower_bound would be O(log N). Read Complexity section of the cpp reference http://www.cplusplus.com/reference/algorithm/lower_bound/
 » 23 months ago, # |   0 Why i am getting wrong answer for the problem C foe the test case 86 , its output should be 0 but it is showing something else in my case, but i have seen other codes and their submissions, for them the output for the test case 86 is 0.
 » 23 months ago, # | ← Rev. 2 →   0 Where can I find the editorial/tutorial for this contest?
•  » » 23 months ago, # ^ |   +1 as for now not released yet
•  » » » 23 months ago, # ^ |   0 when will it be released?
•  » » » » 23 months ago, # ^ |   0 In a few minutes, bro, just wait a bit :)
 » 23 months ago, # |   +6 Can somebody explain O(n^2) solution for F? I've seen solutions with sliding windows using deque but I don't quite understand logic behind it.
•  » » 23 months ago, # ^ |   0 I explained it some time ago on stackoverflow: https://stackoverflow.com/questions/12054415/get-min-max-in-o1-time-from-a-queue
 » 23 months ago, # |   0 I don't see the tutorial.Can you give me ?
 » 23 months ago, # | ← Rev. 2 →   +3 My solution to D without binary search passed — https://codeforces.com/contest/1077/submission/45884322 Are the hacks not included in the final test cases when the problem goes into practice section?
•  » » 23 months ago, # ^ | ← Rev. 2 →   +3 Hmm, it is really weird. I will add the test on which your solution will got TLE. It is very strange that nobody do it during the hacks phase. (And even more strange that I don't do it before the round start. Sorry about that.)UPD: Woops, this solution got TLE now.
•  » » » 23 months ago, # ^ | ← Rev. 2 →   0 Weird :p Does this mean that this solution would have gotten Accepted in the main contest?
•  » » » » 23 months ago, # ^ |   +1 Yes, it was accepted in the main contest, unfortunately. I have nothing to hide. Sorry :(
 » 23 months ago, # | ← Rev. 2 →   0 HI in the last two contests thst i've taken a problem that i solved correctly got hacked.does anyone know why?45824931
 » 23 months ago, # |   0 i think div 3 and div 2 contests are same in quality except problem A
 » 23 months ago, # |   0 Whats wrong with my logic for A here: t = int(input()) for cas in range(t): a, b, k = map(int, input().split(" ")) if k%2==0: print(int(k*(a-b)/2)) else: print(int((k+1)*a/2 - (k-1)*b/2)) 
•  » » 23 months ago, # ^ |   0 You have to use integer division (//) instead of float division(/)