Skip to content

Update cf-1808B.mdx#6089

Open
dikshitudbhav wants to merge 10 commits intocpinitiative:masterfrom
dikshitudbhav:patch-2
Open

Update cf-1808B.mdx#6089
dikshitudbhav wants to merge 10 commits intocpinitiative:masterfrom
dikshitudbhav:patch-2

Conversation

@dikshitudbhav
Copy link
Copy Markdown

@dikshitudbhav dikshitudbhav commented Mar 31, 2026

Place an "x" in the corresponding checkbox if it is done or does not apply to this pull request.

  • [ x] I have tested my code.
  • [ x] I have added my solution according to the steps here.
  • [ x] I have followed the code conventions mentioned here.
    • I understand that if it is clear that I have not attempted to follow these conventions, my PR will be closed.
    • If changes are requested, I will re-request a review after addressing them.
  • I have linked this PR to any issues that it closes.

The given solution is unnecessarily complicated.

Copy link
Copy Markdown
Contributor

@eysbutno eysbutno left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is your solution different than the existing solution? Because, at least at a glance, they appear to be equivalent.

If they are essentially the same, then I think it would be more useful to improve the current solution (which is valid).

Copy link
Copy Markdown

@apex-kevin-s apex-kevin-s left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reviewing from my corpo account LOOOL

#include <bits/stdc++.h>
using namespace std;
#include <algorithm>
#include <stdio.h>
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

honestly i'd prefer you use cin and cout

@eysbutno
Copy link
Copy Markdown
Contributor

eysbutno commented Apr 1, 2026

is there any particular reason for replacing the existing solution code? since they appear identical in terms of functionality, and the original code is closer to the usual standards for guide code (though your code is more concise)

I do think that rewriting the current explanation is worthwhile though

@dikshitudbhav
Copy link
Copy Markdown
Author

dikshitudbhav commented Apr 2, 2026

is there any particular reason for replacing the existing solution code? since they appear identical in terms of functionality, and the original code is closer to the usual standards for guide code (though your code is more concise)

The previous code used a prefix sum to calculate suffix differences, which is not required when contribution of each element could be found directly.

@eysbutno
Copy link
Copy Markdown
Contributor

eysbutno commented Apr 3, 2026

is there any particular reason for replacing the existing solution code? since they appear identical in terms of functionality, and the original code is closer to the usual standards for guide code (though your code is more concise)

The previous code used a prefix sum to calculate suffix differences, which is not required when contribution of each element could be found directly.

good point, it'd be nice if you kept the code style the same tho (e.g. use cin/cout over scanf/printf, spacing, etc)

explanation looks good

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants