For Q5, I was trying to ask a different question, maybe my phrasing was bad. The thing I wanted to test was, how many different K_is can there be with value greater than sqrt(10^5) and the answer would simply be at most sqrt(10^5). Because if one has more than sqrt(10^5) K_i’s each with value >= sqrt(10^5), then the sum of these K_i’s > sqrt(10^5) * sqrt(10^5) = 10^5, which contradicts the fact that sum of all K_i’s = 10^5
Yes then N should be sqrt(10^5). Also since u asked k> sqrt(10^5) and not equal to. So even if one of the value is sqrt (10^5)+1 ,then all rest of them must be
less than sqrt(10^5).
I have a doubt in Multiple of three problem . For the test case :-
1
2 3 4
The correct answer should be NO because the number should be 34 and it’s sum is 7 so, it should not be divisible by 3 . But most of the correct solutions to this problem are showing YES . can anyone explain why ?
here’s my solution:- https://www.codechef.com/viewsolution/31303740
A great effort by the CodeChef Team.
I joined the contest a little late.
Could you please give me access to the youtube video of the Contest 1-Part1 Discussions.
@sidhant007
In question 3,
the no. of numbers with last digit as 0 are 2^(p-1);
the no. of numbers with last digits as 01 are 2^(p-2);
but the thing is the no of operations required for the numbers with last digits 01 is 2.
So the overall complexity should be 1*(2^(p-1))+2*(2^(p-2))+3*(2^(p-3))…
The complexity will be Big_SIgma(N) and will be greater than O(N).
Please correct me if wrong.
@sidhant007
I have a doubt in the solution of question MULTHREE.
The below is my implementation of calculatiing the left part of the total.
Here the variable left_over is calculating the total left over part to be added and the variable left_over_count has calculated the number of digits left over after the first three digits and cycles.
I dont understand what’s wrong in my implementation. After copying your in place of that my solution came right. I tried to print the digits given by it and matched with the two test cases it were same.
Ummm @elon_musk10 your analysis is partially correct, I have fixed and put it in the comments on the youtube channel.
Copy pasting that comment here:
Fix: The analysis is actually \sum_{i = 1}^{P} 2^{P - i} * i (Notice you need to multiply with i, because the increment function takes i steps for those x’s)
Let S = \sum_{i = 1}^{P} 2^{P - i} * i = (2^{P - 1})*1 + (2^{P - 2})*2 + \dots + (2^1)*(P - 1) + (2^0)*P