随笔分类 - 洛谷
菜鸡的题库
P2014 [CTSC1997] 选课 -树形dp
摘要:#include <bits/stdc++.h> #define debug(x) std::cerr << "[" << __LINE__ << "]: " << #x << " = " << x << "\n" using i64 = long long; const int N = 300 +
阅读全文
数码个数 -数位dp
摘要:#include <bits/stdc++.h> #define debug(x) std::cerr << "Line: " << __LINE__ << ", " << #x << " = " << x << "\n" using i64 = long long; constexpr int N
阅读全文
P2704 [NOI2001] 炮兵阵地 -状态压缩dp -省选
摘要:#include <bits/stdc++.h> #define debug(x) std::cerr << "Line: " << __LINE__ << \ "," << #x << "=" << x << "\n" using ll = long long; constexpr int N =
阅读全文
高斯消元法 -math
摘要:#include <bits/stdc++.h> #define dbg(x) std::cerr << #x << "=" << x << "\n" using i64 = long long; const int N = 105; std::vector<double> f[N]; void o
阅读全文
P3959 [NOIP2017 提高组] 宝藏 --状态压缩dp,dfs
摘要:#include <bits/stdc++.h> #define dbg(x) std::cerr << #x << "=" << x << "\n" using i64 = long long; constexpr int N = 15; int n, m, lim, ans = 2e9, G[N
阅读全文
P2024食物链 - 种类并查集datastructure
摘要:#include <bits/stdc++.h> #define dbg(x) std::cerr << #x << "=" << x << "\n" using i64 = long long; constexpr int N = 100005; int fa[N * 3]; int find(i
阅读全文
P1892团伙 -- 并查集datastructure
摘要:#include <bits/stdc++.h> using i64 = long long; int fa[1000005],b[1000005]; int find(int x){ return (fa[x] == x ? x : (fa[x] = find(fa[x]))); } void m
阅读全文
数独填充 -- dfs,bitmasks
摘要:#include <bits/stdc++.h> using i64 = long long; struct node { int x,y,row,col,grid,vis[3]; node():x(0),y(0),row(0),col(0),grid(0){ memset(vis,0,sizeof
阅读全文
P1025 数的划分 --dp,dfs
摘要:1 #include <bits/stdc++.h> 2 using i64 = long long; 3 using namespace std; 4 #define repk(i,s,t,k) for(int i = s; i <= t; i += k) 5 #define rep(i,s,t)
阅读全文