Greetings,
Newton School cordially invites you to be a part of our monthly coding challenge. This month, the challenge is going to take place on eve of 23rd December, 2020 at 9PM IST. The duration of the contest is 150 minutes.
Please follow below link to register. Contest page: https://www.newtonschool.co/contest-home
Highlights of contest:
- The Prize Money is ₹20k and candidates can win exciting prizes and goodies
- Newton School goodies and Rs 100 gift vouchers to top 50 participants
- Rs 100 gift vouchers to 50 randomly selected participants between ranks 51-500
- Exclusive Newton School workshop for the top 500 participants
- We receive more than 10K registrations in our contest from all engineering colleges pan India
Registrations for contest is open till start of contest. *Note: Prizes are for Indian Participants only.
I hope you all will participate and enjoy the contest.
Regards, Newton School Team.
whats a Rs
Indian Currency.
Can anyone explain solution of 4th question.
Just do some simple math and you'll get the following formula
number of different ways = $$$\sum_{l=1}^{n-2}\sum_{b=1}^{m-2}\sum_{i=0}^{n-l}\sum_{j=0}^{m-b}i(n-i-l)j(m-j-b)$$$
Bro but in the given constraints, computing this naively wasn't possible
Yeah obviously, by doing some math you can reduce the problem to this:
$$$S=\sum_{l=1}^{n-2}\sum_{b=1}^{m-2}\sum_{i=0}^{n-l}\sum_{j=0}^{m-b}ij(n-i-l)(m-j-b) $$$
$$$S={\sum_{l=1}^{n-2}\frac{(n-l)(n-l-1)(n-l-2)}{6}}*{\sum_{b=1}^{m-2}\frac{(m-b)(m-b-1)(m-b-2)}{6}}$$$
ans this can be easily computed in linear time
Even the last sum can be calculated in $$$O(1)$$$
Yeah you can optimize it even further, but for the sake of time I decided to go with this only as the linear time solution was fitting the time limit
Could you please elaborate how you got to this?
if 4th problem is rectangle one then solution is
C(x+1,4)*C(y+1,4)
where C is Combination
Hey bro, can you please elaborate how you directly came up with this?
given a x * y cell . you need 4 horizontal lines out of x+1 lines and 4 vertical lines out y+1 vertical lines. so that topping is surrounded by rectangular cake in every direction
Wow, this idea is very elegant :o Thanks for sharing
Wow, that's really pretty neat n elegant bro, great!!
Can someone please share their solution idea for the 6th problem?
Is it possible for you to share your ideas for the 5th problem?
Yes bro, I used FFT to solve the 5th problem.
See first create a sort of frequency array of size N to store the frequency of each remainder. Then assuming it to be a polynomial, square it using FFT. And now the question had a condition that X<=Y, but here we'll obtain all possible pairs, to to handle that, separately add the cases where X=Y and then divide the count by 2.
Thanks a lot! it would be great if you can share your code from my submissions section :).
Hey, sorry for late reply bro, here's my code:
Can you tell the exact problem(where you used FFT)?
PROBLEM STATEMENT
PS: Sorry for these huge screenshots, I don't know why spoilers are not working
Thanks, I also think it can be done with FFT only.
Did you get how to solve the 6th problem or any thoughts on how to solve it?
No, not yet bro...
Does anyone have problem statements for the 5th 6th problem, please share
Can anyone share the code of 2-nd problem please.
What was the second problem bro?
PROBLEM STATEMENT
AC_CODE :
P.S: Does anybody know why spoilers are not working?
Heyy this ain't fair!! Why can't we see the problems after the contest ends :(
If you've participated, only then you can see the problems
I did participate, still the problems are locked for me... Also it makes no sense...It was my first time participating and I couldn't see the previous contests problems then how am I supposed to figure out the problem difficulty n all...
Just go to the "My submissions" Section and click edit, you'll be able to see the problems you attempted
I didn't say anything wrong, why downvotes then can someone clarify?