-
Notifications
You must be signed in to change notification settings - Fork 586
Do You Know Your Abcs Silver #5787
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Added explanation and implementation for USACO problem 1135.
|
|
||
| Due to the low bounds, we can use a brute-force approach. There are seven labels $A$, $B$, $C$, $A + B$, $B + C$, $A + C$, and $A + B + C$. We need exactly $N$ of them, so we can iterate over all combinations of $N$ labels to decide which labels appear in this test case. | ||
|
|
||
| For a chosen set of labels, we need to decide which number corresponds to which label. We iterate over all permutations of the chosen labels, mapping them to the input array in order. Finally, we need to deduce the unique triple $(A, B, C)$ consistent with the mappings. To do this, we track candidate values for $A$, $B$, and $C$ using sets. If each of $A$, $B$, and $C$ has one consistent value, we record the triple as valid. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should probably explain that we can always deduce a possible value for each variable based on its labels, because each variable (be it A, B, or C) is in 4 of the 7 variables, and we can at most get rid of 3 of them
at least i think that would help make the deduction idea more concrete
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah ill add that it should solidify the logic
Added a link to the official analysis for the problem.
Added explanation and Python implementation
Place an "x" in the corresponding checkbox if it is done or does not apply to this pull request.