随笔分类 - 动态规划
摘要:并查集 + 01背包 点击查看代码 #include<bits/stdc++.h> using namespace std; typedef long long LL; const int N = 1e5 + 10; int n, m, k; int p[N]; int v[N], w[N]; in
阅读全文
摘要:点击查看代码 #include<iostream> #include<cstring> using namespace std; typedef long long LL; const int N = 1e6 + 10; int n; int h[N], e[N], ne[N], w[N], idx
阅读全文
摘要:点击查看代码 #include<iostream> #include<cstring> #include<cmath> using namespace std; typedef long long LL; const int N = 10, M = 20; const double INF = 1e
阅读全文
摘要:点击查看代码 #include<iostream> #include<cstring> using namespace std; typedef long long LL; const int N = 60, M = 50; int n; int w[N]; LL f[N][N][M]; void
阅读全文
摘要:点击查看代码 #include<iostream> #include<cstring> using namespace std; typedef long long LL; const int N = 50; int n; int w[N]; int f[N][N], g[N][N]; void d
阅读全文
摘要:点击查看代码 #include<iostream> #include<cstring> using namespace std; typedef long long LL; const int N = 210; const int INF = 0x3f3f3f3f; int n; int w[N];
阅读全文
摘要:点击查看代码 #include<iostream> #include<cstring> using namespace std; const int N = 410; const int INF = 0x3f3f3f3f; int n; int w[N], s[N]; int f[N][N], g[
阅读全文
摘要:点击查看代码 #include<iostream> #include<cstring> #include<vector> #include<cmath> using namespace std; const int N = 18, M = 1 << N; int n, m; int path[N][
阅读全文
摘要:点击查看代码 #include<iostream> #include<cstring> #include<vector> using namespace std; typedef long long LL; const int N = 110, M = 1 << 10; int n, m; int
阅读全文
摘要:点击查看代码 #include<iostream> #include<cstring> #include<vector> using namespace std; typedef long long LL; const int N = 14, M = 1 << 12; const int mod =
阅读全文
摘要:点击查看代码 #include<iostream> #include<cstring> #include<vector> using namespace std; typedef long long LL; const int N = 12, M = 1 << 10, K = 110; int n,
阅读全文
摘要:KMP + 状态机 点击查看代码 #include<iostream> #include<vector> #include<cstring> #include<algorithm> using namespace std; const int N = 60; const int mod = 1e9
阅读全文
摘要:点击查看代码 #include<iostream> #include<cstring> #include<algorithm> using namespace std; const int N = 1e5 + 10; int n; int a[N]; int f[N][3]; int main()
阅读全文
摘要:点击查看代码 #include<iostream> #include<cstring> using namespace std; const int N = 100010, M = 110; int n, m; int w[N]; int f[N][M][2]; int main() { cin >
阅读全文
摘要:点击查看代码 #include<iostream> using namespace std; const int N = 100010; const int INF = 0x3f3f3f3f; int n, w; int f[N][2]; int main() { int T; cin >> T;
阅读全文
摘要:点击查看代码 #include<iostream> #include<vector> #define fi first #define se second using namespace std; typedef pair<int,int> PII; const int N = 70, M = 32
阅读全文
摘要:贪心 + 01背包模型 点击查看代码 #include<iostream> #include<cstring> #include<algorithm> using namespace std; const int N = 10010; int n; int f[N]; struct Stone {
阅读全文
摘要:点击查看代码 #include<iostream> #include<vector> using namespace std; const int N = 1010; int n, m; int v[N], w[N]; int f[N][N]; int main() { cin >> n >> m;
阅读全文
摘要:点击查看代码 #include<iostream> #include<cstring> using namespace std; const int N = 1010, mod = 1e9 + 7; int n, m; int f[N], g[N]; int main() { cin >> n >>
阅读全文
摘要:点击查看代码 #include<iostream> #include<cstring> using namespace std; const int N = 110; int n, m; int h[N], e[N], ne[N], idx; int v[N], w[N], f[N][N]; voi
阅读全文