Closed shreygupta2101 closed 2 years ago
@shreygupta2101, This PR will be marked as invalid and be closed by 13/10/2021(6PM). Kindly respond by either closing it or making the required changes.
I'll do it by tomorrow 6 pm.
On Wed, 13 Oct 2021, 02:03 SarthakKeshari, @.***> wrote:
@shreygupta2101 https://github.com/shreygupta2101, This PR will be marked as invalid and be closed by 13/10/2021(6PM). Kindly respond by either closing it or making the required changes.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/SarthakKeshari/CPP-Questions-and-Solutions/pull/377#issuecomment-941499754, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOJC2A5P4YZBCKRGJCV326TUGSLQZANCNFSM5FTZBAEA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
I'll do it by tomorrow 6 pm. … On Wed, 13 Oct 2021, 02:03 SarthakKeshari, @.***> wrote: @shreygupta2101 https://github.com/shreygupta2101, This PR will be marked as invalid and be closed by 13/10/2021(6PM). Kindly respond by either closing it or making the required changes. — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#377 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOJC2A5P4YZBCKRGJCV326TUGSLQZANCNFSM5FTZBAEA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
@shreygupta2101, Ok I will wait
Issue Id you have worked upon -
359
Briefly explain your program logic -
So, let’s compute S = (6a-4b+4) for all ordered pairs (a, b) of values where a≥b. Now, for each pair (a, b) where 4a-4b+1 is a perfect square, subtract 6a-4b+4 and add (2a+1 + sqrt(4a - 4b +1))/2 +1 to S. now, After sorting array C, we can compute the first part in O(N) time. For each a, let’s iterate over odd d such that 4a-dd+1 ≥0. Each value b = (4a-d*d+1)/4 gives a perfect square and we can adjust their contribution accordingly.
Since the original array, C can contain duplicates, we can build the count array B where Bi denotes the number of occurrences of i. Pair (a, b) can be chosen in Ba * Bb ways.
Screenshots(Attach 2 screenshots of your own input and output) -
Checklist:
Eg - If your code follow the below guidelines. Kindly change [] to [x]
All the conditions should be fulfilled for considering your code for merging -
[x] I have mentioned the question as comment in my solution file.
[x] My code follows the guidelines of this project.
[x] I have performed a self-review of my own code.
[x] I have commented my code.
[x] My code gives the correct output.
[x] I confirm that I have not copied the code from anywhere. In case its found that I have copied even after successful merge then I can be banned from the repository and hacktoberfest.
[x] I affirm that I strictly follow contributing guidelines and code of conduct.