Skip to content
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

Bitmask DP Merging Bitmasks #5056

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

HaccerKat
Copy link
Contributor

@HaccerKat HaccerKat commented Jan 20, 2025

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

  • I have tested my code.
  • I have added my solution according to the steps here.
  • 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.

This is intended to add new content for the O(3^N) Bitmask DP problems. Some of what is added is in the SOS DP module already, but this strictly targets the problems that cannot be solved using SOS DP. Let me know if even this simplifed content is unsuitable for Gold.

@HaccerKat HaccerKat marked this pull request as ready for review January 25, 2025 03:50
#include "bits/stdc++.h"
using namespace std;
void solve() {
int n, m, inf = 1e9;
Copy link
Contributor

Choose a reason for hiding this comment

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

mention inf as const outside the function

}

int32_t main() {
std::ios::sync_with_stdio(false);
Copy link
Contributor

Choose a reason for hiding this comment

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

remove these and maybe include everything under main() function only.

void solve() {
int n, m, inf = 1e9;
cin >> n >> m;
vector<int> adj(n), dp(1 << n, inf);
Copy link
Contributor

Choose a reason for hiding this comment

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

write it separately

cout << dp[(1 << n) - 1] << "\n";
}

int32_t main() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
int32_t main() {
int main() {

<CPPSection>

```cpp
#include "bits/stdc++.h"
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
#include "bits/stdc++.h"
#include <bits/stdc++.h>

@@ -14,6 +14,20 @@
}
}
],
"sam2": [
{
"uniqueId": "ac-close-group",
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
"uniqueId": "ac-close-group",
"uniqueId": "ac-CloseGroup",

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.

3 participants