随笔分类 - 之前的比赛题目
摘要:$DP$真的太难了啊!! 首先考虑到$f(i, s)$表示,从前$i$个数中选,最后一个数为$a_i$,且$MEX(a_1,....,a_i) = \left{ \begin{aligned} a_{i} - 1 (s = 0) \ a_{i} + 1(s = 1)\end{aligned} \ri
阅读全文
摘要:折磨了我三天的$DP$,终于看懂啦。 首先,如果想要有题目要求的效果,那么最短的边一定都是与$1$相连的,就是一个菊花图,生成树里的边就是最短的边。 $f[i][j]$表示已经有$i$个点与$1$相连,且最大权值不超过$j$的方案。 那么我们考虑如何从$j$转移到$j + 1$,看下图,已经连接了$
阅读全文
摘要:设$f[v]$是以结点$v$为根的方案数,设左子树的根为$x$,右子树的根为$y$,那么如果左右子树完全相同,那么我们交换左右子树对方案没有任何影响,都是: \[ f[v] = f[x] * f[y] \] 如果左右子树不相同,那么则多出$f[x] * f[y]$的贡献,所以方案数为$f[v] =
阅读全文
摘要:初速度:\(v = \sqrt{\cfrac{2 * E}{m}};\) 竖直速度:\(v_y = v \,sin(ans) = g * t\) 水平距离:\(s = v_x * 2t = v \, cos(ans) * 2t = \cfrac{2Esin(2ans)}{mg}\) #include
阅读全文
摘要:#include <bits/stdc++.h> using namespace std; const int N = 100; int tr[N]; int main() { int n; cin >> n; memset(tr, -1, sizeof(tr)); for (int i = 1;
阅读全文
摘要:#include<bits/stdc++.h> using namespace std; using pii = pair<int, int>; const int N = 300; vector<pair<int, int>> g[N]; int have[N]; int pre[N]; int
阅读全文
摘要:#include <bits/stdc++.h> using namespace std; using pii = pair<int, int>; using ll = long long; const int N = 1E5 + 10; ll stk[N]; ll top; ll x[N], y[
阅读全文
摘要:#include <bits/stdc++.h> using namespace std; using pii = pair<int, int>; const int N = 10010; vector<int> G[N]; bool st[N]; int dist[N]; int res = 1e
阅读全文
摘要:#include <bits/stdc++.h> using namespace std; const int N = 550; using pii = pair<int, int>; struct Node{ int v, length, time; }; vector<Node> g[N]; i
阅读全文
摘要:#include <bits/stdc++.h> using namespace std; using pii = pair<int, int>; const int N = 1210, M = 15; int n, m, k, ds; unordered_map<string, int> var;
阅读全文
摘要:#include <bits/stdc++.h> using namespace std; const int N = 1010; bool vis[1300][130][70]; int dx[5] = {-1, 0, 1, 0, 0}, dy[5] = {0, 1, 0, -1, 0}; int
阅读全文
摘要:#include <bits/stdc++.h> using namespace std; const int N = 1010; int f[N]; bool havef[N]; int Size[N]; int find(int x) { if (x != f[x]) f[x] = find(f
阅读全文
摘要:#include <bits/stdc++.h> using namespace std; const int N = 1E5 + 10; int tr[N]; stack<int> stk; int lowbit(int x) { return x & -x; } void add(int x,
阅读全文
摘要:#include <bits/stdc++.h> using namespace std; using pii = pair<int, int>; const int N = 10010, M = 110; int f[M]; int n, m; int w[N]; int pre[N]; bool
阅读全文
摘要:这题读懂题目之后就发现它很呆 #include <bits/stdc++.h> using namespace std; const int N = 100010, M = 110; vector<int> g[N]; int main() { ios::sync_with_stdio(false)
阅读全文
摘要:#include <bits/stdc++.h> using namespace std; const int N = 10010, M = 110; int main() { int n, m; cin >> n >> m; vector<vector<int>> v(n, vector<int>
阅读全文
摘要:#include <bits/stdc++.h> using namespace std; const int N = 10010; vector<int> g[N]; bool st[N]; int cnt = 0; vector<int> res; vector<int> temp; int d
阅读全文
摘要:#include <bits/stdc++.h> using namespace std; const int N = 110; stack<char> stk[N]; int main() { int n, m, S; cin >> n >> m >> S; for (int i = 1; i <
阅读全文
摘要:#include <bits/stdc++.h> using namespace std; const int N = 210; int w[N][N]; int main() { int n, m; cin >> n >> m; memset(w, -1, sizeof w); while (m-
阅读全文
摘要:#include <bits/stdc++.h> using namespace std; const int N = 50; int tr[N]; int n; void dfs(int cnt) { if (cnt > n) return; dfs(cnt * 2); dfs(cnt * 2 +
阅读全文

浙公网安备 33010602011771号