How was your CodeVita 2019?

I was able to solve 2questions completely (question 2,3)with presentation error. Passed sample test case of other two (question 1,4) and passed 1 out of 2 sample test case of question 5

When it says Accepted, does it mean it has passed only the sample TCs?

I was able to solve 2 questions but Their interface was really bad.
I was facing problems in logging in and then in submission. I made more than 3 submissions and it was only showing 1 submission. Everything seemed to be broken. But still I managed to solve 2 questions completely.

Also questions were not explained properly with only 1 test case and explanation.

I mean, after getting used to competitions on codeforces and codechef, I was expecting a good Interface but my experience in codevita was really bad.

9 Likes

It depends on the context.if you compiled and got accepted then it means you have passed all the sample test cases. If you get accepted status after final submission then it means you have solved all the sample as well as hidden test cases and then your status to that problem will be updated to solved like in most platforms.

Felt somewhat the same. This problem would have been resolved if we would have participated in MockVita.

1 Like

What does this mean, I used codeblocks to write my code and to test the given TCs. Then I submitted the .cpp file and It said it got accepted.

He’s referring to when you compile and submit in the online editor which was available in the CodeVita platform.

1 Like

oh… I never opened the online editor…

Here by compiling I mean compiling in CodeVita and by final submission I mean the submit that you make after passing sample test cases.

1 Like

Great bro, I also got the partially accepted solutions in five problems. It would have been nice if they clearly showed us how many of actual test cases are paseed during final submission.

1 Like

I was able to solve 5 questions Some had presentation errors.
About my experience, it is true that some questions had ambiguities.
There were constraints missing in the question salary paid. There might be a reason why they were missing but you would never ever expect that in a contest of websites like codechef, codeforces, etc. Also there was some other information missing like what would happen if the tax is 0. Are we supposed to take the maximum salary for which the tax can be 0? Cause it will be 0 for all salaries below a certain range. Also I faced some weird problems in this question, after I implemented the code in C++, I was getting right answer when I was running it, at least for public test cases, but it was showing wrong answer. I think it had something to do with inputting and outputting stuff. I don’t have any relevant knowledge about how these IO streams work and what’s the difference between different IO functions. I really should learn it. So when I submitted the code with same logic in python, it got accepted.
In the question Dole out Cadbury, I had a confusion that whether a chocolate of 4x1 dimension is same as that of 1x4 dimension.
In the pattern printing question, I think there could have been multiple ways people could have recognized the pattern based on the given 2 test cases. One was very easy, the correct one. But I found a really complicated one when I tried it first. The answers would of course be different based on the way you recognized the pattern. So that’s not fair. Everyone’s mind does not work the same way.
I found the question uncertain steps to be quite good. It was a DP question of easy level. But since the constraints were too huge for the recursive solution to work, we had to write a bottom up solution. For me it was a little tricky to observe the topological order for bottom up.
Overall, the problems did have some (or many) ambiguities. The questions were not very hard but there were small things which we had the catch in most questions.

3 Likes

I targetted to solve 5 questions (bcz I didn’t like the 6th problem :smile:).
But unfortunately I could solve only 4.
The 5th which I thought easiest of all at first, became a nightmare for me (It was “divine divisor” problem).
The only problem that I found interestring was “Uncertain steps” . It was a modification of a classical dp problem. Rest others were just understanding the problem statements (hard part) and simple implementation.

1 Like

After reading your comments I think I was lucky to get easy questions that didn’t require much expertise.

Can you explain me the dp stairs problems solution?

badly I have 2 of these in my set…salary one and the work life balance…I thought they put wrong value of K in work life so I take it as 100 only but got WA badly…

Moreover I don’t know how many partial test cases were passed by my solution on public test cases…Is that work for ranking??

here you go, https://www.geeksforgeeks.org/count-ways-reach-nth-stair-using-step-1-2-3/

This is different. Question said 3 can be used only once.

oh,is that so! Actually I didn’t get this problem,my friend got this. So I had ignored reading this one

Sure. as I mentioned the bottom up solution was a bit more tricky.
Note: I am assuming that 0 is the top and I have to get to N where N is the ground floor.
So, we have two dp arrays, or 1 dp matrix of Nx2 size. Let the first row’s column j denote the number of ways to get to j th step if we have not used the 3 step yet.
similarly, let the second row’s j th column denote the number of ways to get to j th step if we have used the 3 step.

Base cases
for both used and unused rows, dp[0] = 1, dp[1] = 1, d[2] = 2. Hope the base cases are clear or will be clear after reading the rest of the solution. If not then let me know.
Topological order


The order for the elements of first row is simple since only two possibilities are allowed in this (come here from step i-1 or i-2)
For the second row, it was the tricky part, the number of ways to get to i th step if we have used the 3 step ability is the number of ways to get to (i-1) and (i-2) if we have already used the 3 step ability before + the number of ways to get to (i-3) if we haven’t used the 3 step ability at (i-3) step (means that we use the 3 step ability to get to the i th step), which is the step (i-3) of first row.

Code
Using these we can write this

long long steps(int n){

    dp[0] = 1; dp[1] = 1; dp[2] = 2;
    dpused[0] = 1; dpused[1] = 1; dpused[2] = 2;

    int i;
    for(i=3; i<=n; i++){
        dp[i] = (dp[i-1] + dp[i-2]) % PRIME;
        dpused[i] = (dpused[i-1] + dpused[i-2] + dp[i-3]) % PRIME;
    }
    return dpused[n];
}
5 Likes

Great explanation! Thanks!

Got It!

1 Like