随笔分类 -  之前的比赛题目

上一页 1 2 3 4 5 6 7 ··· 10 下一页
摘要:#include <bits/stdc++.h> using namespace std; int main() { int n, k, m; cin >> n >> k >> m; vector<double> all; for (int i = 0; i < n; i++) { vector<i 阅读全文
posted @ 2022-03-17 20:52 Xxaj5 阅读(38) 评论(0) 推荐(0)
摘要:#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> v(n + 1); for (int i = 1; i <= n; i++) { cin >> v[i]; } vector 阅读全文
posted @ 2022-03-17 20:42 Xxaj5 阅读(70) 评论(0) 推荐(0)
摘要:#include <bits/stdc++.h> using namespace std; constexpr int N = 510; vector<int> g[N]; int main() { int n, m; cin >> n >> m; for (int i = 0; i < m; i+ 阅读全文
posted @ 2022-03-17 19:47 Xxaj5 阅读(41) 评论(0) 推荐(0)
摘要:#include <bits/stdc++.h> using namespace std; int main() { int n, q; cin >> n >> q; vector<int> v; make_heap(v.begin(), v.end(), greater<int>()); for 阅读全文
posted @ 2022-03-17 10:27 Xxaj5 阅读(23) 评论(0) 推荐(0)
摘要:#include <bits/stdc++.h> using namespace std; const int N = 10110; struct Tree { int u, l, r; }TNode[N]; int midorder[N], preorder[N]; int main() { in 阅读全文
posted @ 2022-03-17 09:01 Xxaj5 阅读(41) 评论(0) 推荐(0)
摘要:#include <bits/stdc++.h> using namespace std; constexpr int N = 110; int f[N]; int find(int x) { if (x != f[x]) return f[x] = find(f[x]); return f[x]; 阅读全文
posted @ 2022-03-16 20:04 Xxaj5 阅读(66) 评论(0) 推荐(0)
摘要:#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; struct p { int id, money, cnt;}; vector<p> person(n + 1); for (int i = 1; 阅读全文
posted @ 2022-03-16 19:50 Xxaj5 阅读(52) 评论(0) 推荐(0)
摘要:分两种情况枚举中间点 #include <bits/stdc++.h> using namespace std; int main() { string s; getline(cin, s); int n = s.size(); int res = 1; for (int i = 0; i < n; 阅读全文
posted @ 2022-03-16 19:24 Xxaj5 阅读(24) 评论(0) 推荐(0)
摘要://并查集 #include <bits/stdc++.h> using namespace std; constexpr int N = 10010; constexpr double eps = 1e-8; int f[N]; //int Size[N]; //集合的人数 vector<int> 阅读全文
posted @ 2022-03-16 17:25 Xxaj5 阅读(29) 评论(0) 推荐(0)
摘要:先建树,再BFS #include <bits/stdc++.h> using namespace std; vector<int> tree[35]; int main() { ios::sync_with_stdio(false); cin.tie(0); int n; cin >> n; ve 阅读全文
posted @ 2022-03-15 21:35 Xxaj5 阅读(69) 评论(0) 推荐(0)
摘要:#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int n; cin >> n; vector<vector<int>> v; for (int i 阅读全文
posted @ 2022-03-15 20:29 Xxaj5 阅读(43) 评论(0) 推荐(0)
摘要:#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> v(n); for (int i = 0; i < n; i++) { cin >> v[i]; } vector<int> 阅读全文
posted @ 2022-03-15 20:28 Xxaj5 阅读(50) 评论(0) 推荐(0)
摘要:#include <bits/stdc++.h> using namespace std; int main() { int n, need; cin >> n >> need; vector<double> have(n); vector<double> price(n); for (int i 阅读全文
posted @ 2022-03-14 22:43 Xxaj5 阅读(34) 评论(0) 推荐(0)
摘要:#include <bits/stdc++.h> using namespace std; bool st[100010]; int main() { ios::sync_with_stdio(false); cin.tie(0); string init; int n; cin >> init > 阅读全文
posted @ 2022-03-14 22:14 Xxaj5 阅读(38) 评论(0) 推荐(0)
摘要:#include <bits/stdc++.h> using namespace std; using ll = long long; using pii = pair<int, int>; const int N = 510; int val[N]; vector<pii> g[N]; int d 阅读全文
posted @ 2022-03-14 21:28 Xxaj5 阅读(44) 评论(0) 推荐(0)
摘要:### 原题链接[F - Sum Sum Max](https://atcoder.jp/contests/abc240/tasks/abc240_f) 首先令$z_i = \sum\limits_{k = 1}^i y_k$,$z_0 = 0$,$z_i$就是第$i$段相同的个数的前缀和. 对于第 阅读全文
posted @ 2022-02-21 20:38 Xxaj5 阅读(147) 评论(0) 推荐(0)
摘要:主要用于求单峰函数的极值点,例如下图: 设当前函数为$f$,若$f(midl) < f(midr)\(,那么极值点一定在\)[midl, r]$中取到,令$l = midl$继续执行。 反之,若$f(midl) > f(midr)\(,那么极值点一定在\)[l, midr]$中取到,令$r = mi 阅读全文
posted @ 2022-02-21 20:17 Xxaj5 阅读(83) 评论(0) 推荐(1)
摘要:原题链接 G - Range Sort Query 思路: $x$是固定的,所以考虑将排序维护成0 1串,为$p_i < x$为$0$,那么$p_i \geq x$为$1$,那么这样就可以用线段树维护了,我们可以维护每个区间1的个数,设为$cnt$,对于升序来说,设我们需要更新的这个区间$[l, r 阅读全文
posted @ 2022-02-04 08:57 Xxaj5 阅读(153) 评论(0) 推荐(0)
摘要:题目链接 F 全体集合 题目大意 给出$n$个点$m$条边的无向图,给出$k$个点上分别有一个人,每个人一次只能走到一个相邻的节点,问有没有一种可能让这些人都走到一个点。 思路 考虑使用二分图染色: 如果染色成功,说明这个图是二分图,那么对于不同颜色的点永远不可能走到一起,题目也说了这个图是联通的, 阅读全文
posted @ 2022-01-14 13:48 Xxaj5 阅读(46) 评论(0) 推荐(0)

上一页 1 2 3 4 5 6 7 ··· 10 下一页