### silentScream's blog

By silentScream, 2 months ago,

In every hiring challenge/cp contest we see some issues with that platform.

Today, in Codeagon, 1 problem had incorrect testcases. Is this what we should be expecting from one of the biggest cp/hiring contest of India?

• +70

 » 2 months ago, # |   +37 FYI, this is a competitive programming related platform not a hiring one.Post this somewhere else.
•  » » 2 months ago, # ^ |   +32 Codeagon is also one of the biggest competitive progamming contest of India.
 » 2 months ago, # |   +29 I don't know why these hiring platforms are so adamant on having us use their ides. They have 0 debugging functionality, no autocompletion. Hackerrank atleast has these features.
•  » » 2 months ago, # ^ |   +6 They don't support pbds No auto correction Zero Debugging support
•  » » » 2 months ago, # ^ | ← Rev. 2 →   0 Although I agree with all other points , but InterviewBit support PBDS . I used it in 3rd and it compiled.
•  » » » » 2 months ago, # ^ |   0 I was also trying to use that but it was showing compilation error. Although same code was running in my system. After that I switched to segment tree.
•  » » » » » 2 months ago, # ^ |   0 Maybe you would have made a typo .
 » 2 months ago, # |   +9 Also they changed test cases in the middle of the contest XD
•  » » 2 months ago, # ^ |   +5 *near the end of the contest. Also, they don't even bother to change the "trivial testcases" so that the participants get confused XD
•  » » » 2 months ago, # ^ | ← Rev. 2 →   +3 Also expected was also giving 2.
•  » » » » 2 months ago, # ^ |   0 Exactly XD
•  » » » » 2 months ago, # ^ | ← Rev. 2 →   +8 It had me stumped. For second problem, expected output was 2 for 0 0. I just ignored and submitted, got AC.
•  » » » » » 2 months ago, # ^ |   +5 I too just made ans=max(ans,2) and got AC.
 » 2 months ago, # |   +28 I think testcases for the Jeff/ELon problem were also wrong. For the planet 6, if we manually calculate, I think the answer should be 6 and not 7.This overcounting is happening due to planet 4 segments i,e ([5,6]U[6,8]). Can anyone verify this?
•  » » 2 months ago, # ^ |   +5 Yes exactly, but overcounting passed.
•  » » » 2 months ago, # ^ |   +36 I had to "think like the setter" to make it pass. XD Shit man, I was looking forward to this contest since 1 year. Now it's ruined. :)
•  » » 2 months ago, # ^ |   0 yes, considering the overlapping indexes twice got accepted
•  » » 2 months ago, # ^ |   0 Yes exactly,won't they rejudge? because I was damn sure that the tcs are incorrect so I didn't change my solution and submitted the same:(
•  » » 2 months ago, # ^ |   0 XD I wasted alot of time on this question thinking that I am not understanding this question properly.Read this question 5-6 times.Later on gave up and went for the next question,same started happening for the next question ( question related to groups).I gave up and went to sleep
•  » » » 2 months ago, # ^ |   +3 same I thought that I am not understanding the question
 » 2 months ago, # |   +3 I hope they rejudge the submissions for Swap it harder problem post-contest. I will have 1 extra AC. :)
•  » » 2 months ago, # ^ | ← Rev. 2 →   +13 Btw it will be unfair for those who has to do if(a==0 && b==0) return(2) to make it pass. XD, which I did initially.
•  » » » 2 months ago, # ^ |   0 Everyone who got AC initially did that XD
•  » » » 2 months ago, # ^ |   0 Was that the problem "DP integers"? My first submission was correct (A=0,B=0 gave 0). Then I had to put condition to pass it.I just want to see the ranklist now. Who is rank 1 in this contest XD?
•  » » » 2 months ago, # ^ |   0 I also did the same but didn't know about change in testcases and didn't resubmitand now it will fail :(
•  » » 2 months ago, # ^ |   0 Sorry, I thought you are talking of "DP and integer". Why will they rejudge swap it harder? It was alright right?
•  » » » 2 months ago, # ^ |   +8 That grouping + lexicographically problem had incorrect tests.For the array = [ 8,7,6,6,5,3,0,6,0], it gave answer = 3. But the answer is 0.
•  » » » » 2 months ago, # ^ | ← Rev. 2 →   0 The groups are [8,7,6,5,3,0],[6],[6,0]If you mergeFinal array will be 8,7,6,5,3,0,6,6,0Which will give answer 3
•  » » » » » 2 months ago, # ^ |   +3 But you can get a lexicographically greater sequence if your groups are [8,7.6] [6,5,3,0] and [6,0]
•  » » » » » 2 months ago, # ^ |   0 If you bring that 0 from first group to 2nd group. It'll be larger lexicographically.The array i gave as input is already optimal [8,7,6],[6,5,3,0],[6,0]. Notice my array also has 3 groups, and is larger lexicographically.
•  » » » » » » 2 months ago, # ^ | ← Rev. 2 →   +6 Turns out many people had wrong solution which got full AC, and people who had optimal solution had to scratch their hairs for 2 hours to realize that the test cases are wrong and most likely setters solution as well. XD XD
•  » » » » » » » 2 months ago, # ^ |   0 If they rejudge.. it'll drastically change the ranklist.
•  » » » » » » » » 2 months ago, # ^ |   0 Yeah but what about the wasted time.
•  » » » » » » » » » 2 months ago, # ^ |   +11 I don't care about the pentalty time anymore. I wasted FOUR HOURS ..that too.. FROM A SUNDAY on this contest. :)
•  » » » » » » 2 months ago, # ^ |   0 Yes, you are correct. Setter thought the same way as me.. XXDD. But What's the optimal solution?
•  » » » » » 2 months ago, # ^ |   0 You need to pivot your groups around the smallest most frequent element.
•  » » » » » » 2 months ago, # ^ |   0 Can you explain how to do this ?
•  » » » » » » » 2 months ago, # ^ |   0 Read this comment.
 » 2 months ago, # |   +21 Were testcases wrong for problem 3?
•  » » 2 months ago, # ^ |   0 I think It was for 2nd question, don't know the order were same for all users or not.
 » 2 months ago, # |   0 How many of you did all 6?
 » 2 months ago, # |   +54 Request to companies to stop using InterviewBit for contests.(GCJ/FHC/Yandex/VK Cup are fine, I mean only the ones that are specifically a step in their selection process. It's not an issue where I'm from but I do see the problems that stem from it.)
•  » » 2 months ago, # ^ |   +3 Do you think companies hire directly from the contest results?
•  » » » 2 months ago, # ^ |   0 people with top ranks from kickstart are called for interview if they have opted for it
•  » » » » 2 months ago, # ^ |   +3 Yes, so it is just a step in getting the interview, right? There will be 4 to 5 rounds of interviews and they will hire the deserving ones anyways. I may be wrong but it sounded like -is-this-fft- thinks they hire directly from the contests.
•  » » » 2 months ago, # ^ | ← Rev. 3 →   +3 No. That'a not the issue.
 » 2 months ago, # |   0 What do you guys think should be no. of correct submissions to get shortlisted(basically under rank 150) ?
 » 2 months ago, # |   +26 The question Swap it Harder had wrong tests, the array which they are forming is not always lexicographically largest. The question with Elon Musk also had wrong logic ,overlapping segments was working I wasted almost 30 mins only to realise the setter has screwed up.
•  » » 2 months ago, # ^ | ← Rev. 2 →   +17 This contest felt more like April fool contest where we have to guess what the setter actually want rather than what the correct solution should be. Loved this new idea of contests. XD XD.
•  » » 2 months ago, # ^ |   +16 Your profile pic is the depicition of feelings of most coders who participated in this contest.
•  » » » 2 months ago, # ^ |   +9 How about my profile pic?
•  » » » » 2 months ago, # ^ |   +5 XD better.
•  » » 2 months ago, # ^ |   0 I actually wasted half of the contest time to debug my solutions for these two problems xD
•  » » 2 months ago, # ^ |   +24 One of the problem(i don't remember name) gave TLE for just declaring Fenwick tree of size 2e5.
 » 2 months ago, # |   +25 Well played InterviewBit. They changed the test cases in the middle of the contest and what did they do to nofity the contestants? They only send an email stating that participants should resubmit as test cases were changed. Now tell me one thing, who would constantly check for upcoming emails in the middle of a hiring test? They could have simply notified on the website via a notification. Now rejudging with new test cases looks unfair for those who did not check their emails in the middle of a contest. And why does Trilogy Innovations take their test in InterviewBit who simply doesn't support notifications? :(
•  » » 2 months ago, # ^ |   +17 I received my email after I ended the contest :)
•  » » » 2 months ago, # ^ |   +23 Same, I also received mail at 11:03.
•  » » » » 2 months ago, # ^ |   +6 I haven't received the mail yet xD.
•  » » » 2 months ago, # ^ |   +6 That's even awesome.
•  » » 2 months ago, # ^ | ← Rev. 2 →   +9 I got the mail at 11:03. They think I am capable of time travelling, so generous of them.
•  » » 2 months ago, # ^ |   +12 How was one supposed to check the mail? They didn't want us to change tabs and proctoring was also on. So, can't use mobile phone as well. And what about people who already submitted the contest before the mail arrived?
•  » » 2 months ago, # ^ |   +3 Seems like the contest is completely ruined, so no question of rejudge.
•  » » 2 months ago, # ^ |   0 Means I will not receive any point for the testcase (A=0,B=0) since I made answer 2 for this testcase.
 » 2 months ago, # |   0 I don't know why but Two Summation was passing only for 270 pts . My time Complexity was Nlogn I used fenwick trees
•  » » 2 months ago, # ^ |   0 How to solve Two summation with fenwick tree ? I solved using binary search and modifying the summation formula given.
•  » » » 2 months ago, # ^ |   0 I used Fenwick to find out how many elements are actual less or equal to a[i]. Basically to use operations which are present in ordered set.
•  » » » » 2 months ago, # ^ |   0 you have to compare on the basis of a[i]-b[i] not only on the basis of a[i]
•  » » » » » 2 months ago, # ^ | ← Rev. 2 →   0 Yes i did that only first i calculated all a[i] — b[i] then did coordidnate compression then inserted in Fenwick
•  » » » 2 months ago, # ^ | ← Rev. 4 →   0 You don't need fenwick/seg tree. Assuming a[i] + b[j] >= a[j] + b[i], a[i] - b[i] >= a[j] - b[j] (This contributes 2 * (a[i] + b[j]) in total). Sort according to a[i] — b[i] and then a traversal is enough. Assuming you are at index i, it will contribute i * a[i] + summation of all b till i. Now reverse the array and repeat but add i * b[i] + summation of all a till i (reversing because this time we are looking at elements greater than a[i] — b[i], although you can do it without reversal using suffix sum).
 » 2 months ago, # |   +14 I think this contest was testing our "How to think like a problem-setter?" skill. 1. DP Integers: For A=0 B=0, they gave ans = 2 2. Swap It Harder: Their logic was incorrect. For [9,8,7,8], the answer was given by considering [9,8,7], [8] grouping. But the grouping [9,8], [8,7] was giving a better answer with same number of groups. 3. Jeff/Elon: They didn't consider double counting. PS: They changed the test case for DP integers in the end of the contest. What about people who already submitted considering, if(A==0 and B==0) return 2; and exited the contest?
•  » » 2 months ago, # ^ |   0 Now that I think about the test case of Swap it harder, their logic is incorrect. Anyone knows how to solve Swap It Harder ?
•  » » » 2 months ago, # ^ | ← Rev. 2 →   0 I maybe wrong. But consider the smallest most frequent element (say it occurs x times) as pivot.You will have atmost x groups.Then for every number (0-9) if it is greater than the pivot add it to the front groups, if it is less than pivot add to the rear groups. Write a custom comparator function to lexicographically compare these groups. Now you know your final array. Use segment tree/ordered set to count swaps.
•  » » » » 2 months ago, # ^ |   +3 Hard to prove the optimal partitioning into groups, but counting swaps part was so easier, using BIT/Segment Tree.
•  » » » » » 2 months ago, # ^ |   0 How do you calculate swaps? Lets say we have initial and final array and we need to calculate adjacent sways to make them equal. PS : What i did in contest was to maintain 10 bit tree for each number storing their positions and then did some complicated shit over that
•  » » » » » » 2 months ago, # ^ |   0
•  » » » » » » » 2 months ago, # ^ |   0 this blogs deals with array with distinct elements. But it is not the case with our problem
•  » » » » » » » » 2 months ago, # ^ |   0 The first problem itself has duplicate elements. We just have to make them distinct. We number duplicate elements in increasing order so that unnecessary swaps are not performed to sort them. Codelong long inversions(vector &v) { map> q; int n = v.size(); for(int i = 0; i < n; i++) q[v[i]].push(i); sort(v.begin(), v.end()); int p[n] = {}; for(int i = 0; i < n; i++) { p[q[v[i]].front()] = i + 1; q[v[i]].pop(); } // return inversions of permutation p return inversions(p, n); } `
•  » » » » » » » » » 2 months ago, # ^ | ← Rev. 2 →   0 got it ThanksBTW, do you know how to solve 6th one of contest (one with weight and priority)
•  » » » » » » » » » 2 months ago, # ^ |   0 no i could only solve first four
•  » » » » 2 months ago, # ^ |   0 If we partition like:minimum number of groups will be the max(count[digit]) .. and once we fill these groups, we can get lexicographically maximum by joining group[0]+group[1]..group[max-1]To do this, firstly we can partition the max digit to count[max_digit] groups starting from group 0.Now we'd like to keep the group[0]'s last element as big as possible and then from group[1] and so on..For this, traversing digit from high to low, we can check what is the leftmost starting group position for which these can be partitioned, but there can be case when a number lesser than current digit will have starting group position < this starting group position, so for each position we will skip, there should be no digit < current for which we "have" to start from this position.After that we can just combine group0...group(max), then minimum no of swaps can be check by segtree.Will there be any counter case for approach? I keep getting WA on a testcase
•  » » 2 months ago, # ^ |   0 congrats! you got that.
 » 2 months ago, # |   +14 How to solve 6th?
•  » » 2 months ago, # ^ |   0 What is the name of the question?
•  » » » 2 months ago, # ^ | ← Rev. 2 →   0 i dont remember the name. It was related to priorities and weights.
•  » » 2 months ago, # ^ |   0 Anyone ?
 » 2 months ago, # | ← Rev. 2 →   +19 Wasted complete 4 hours just thinking why my correct code is not giving the output which they desire...Could've given Div2 instead :(
 » 2 months ago, # |   +8 I don't know what type of developers are there in Interviewbit, I have a phobia to enter the website! In one company's online interview, the sample test cases were depicting 1-based indexing in arrays but when I submitted in that way it kept giving me a run time error! It took the whole time of the test for me to debug to figure out where I was wrong and still failed. The main function is hidden in an actual contest is not fair if the problem is not set correctly! Hackerrank is much better.
 » 2 months ago, # |   +5 Meanwhile interviewbit
 » 2 months ago, # |   0 They all should use CF
 » 2 months ago, # |   0 Guys, Can you tell, how many questions have you done so that we can make a rough figure if there is some chance for shortlisting. Starting: Without changed tc: 3 questions With changed tc: 2 questions
•  » » 2 months ago, # ^ |   +12 I am pretty sure, the contest will get cancelled. Maybe again it will be conducted later. So no question of shortlisting now.
 » 2 months ago, # | ← Rev. 2 →   +6 biggest cp/hiring contest-is-this-fft- triggered.Edit:: See, was right
•  » » 2 months ago, # ^ |   +18 thanks for the link, upvoted him
 » 2 months ago, # |   +32 Even though my expectations from such a contest were not high, thanks to the platform, wrong test cases, and not-so-good problems, the expectations are -inf now.
 » 2 months ago, # |   0 can someone paint Codeagon for me?
 » 6 weeks ago, # |   +9 How many did you guys solve today in Codeagon2.0?
•  » » 6 weeks ago, # ^ |   0 2
•  » » 6 weeks ago, # ^ |   0 3