摘要: 简简单单的一个并查集 #include<bits/stdc++.h>using namespace std;const int N = 1e6 + 7;int u[N], v[N], f[1010];int find (int x) { return f[x] == x ? x : f[x] = f 阅读全文
posted @ 2022-10-31 09:38 feuerwerk 阅读(36) 评论(0) 推荐(0)
摘要: 哎呦喂!!看错题目啦!!还以为要用最短路, 就写了个dijkstra,呜呜呜,我就说怎么不对, 呜呜呜QAQ!!! #include<bits/stdc++.h>using namespace std; const int N = 1e4 + 7; int f[N];struct Edge{ int 阅读全文
posted @ 2022-10-30 22:24 feuerwerk 阅读(18) 评论(0) 推荐(0)
摘要: 最小生成树的板子; 使得连通块的数量减小到k即可! 数据有点水(printf("No Answer");根本没用到QAQ)。 #include<bits/stdc++.h>using namespace std;const int N = 1e3 + 7;const int M = 1e4 + 7; 阅读全文
posted @ 2022-10-30 15:04 feuerwerk 阅读(28) 评论(0) 推荐(0)
摘要: #include<bits/stdc++.h>using namespace std;const int N = 1e5 + 7;struct Node{ int bn, ed, t;}a[N];int f[N];int find(int x){ return x == f[x] ? x : f[x 阅读全文
posted @ 2022-10-30 14:01 feuerwerk 阅读(20) 评论(0) 推荐(0)
摘要: 区间查询加单点修改 这个题目写了很久,然后写了一遍后是错的,但是我感觉我的逻辑是没有问题的; 后来又写了一遍,发现还是错了;就放在那儿了; 今天写的时候,终于把错误找出来了: change_tree中的return条件有问题(l == p); 是错的,应改为:(l == r)!!! #include 阅读全文
posted @ 2022-10-30 10:37 feuerwerk 阅读(11) 评论(0) 推荐(0)
摘要: 搞不懂为啥这样写有问题 不就是线段树的板子吗!!! 为啥会有问题啊QAQ!!! #include<bits/stdc++.h>using namespace std; typedef long long ll; const int N = 2e5 + 7; ll a[N]; struct Tree{ 阅读全文
posted @ 2022-10-29 20:53 feuerwerk 阅读(43) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2022-10-29 19:34 feuerwerk 阅读(22) 评论(0) 推荐(0)
摘要: 水题,线段树板子(单点修改和区间和) #include<bits/stdc++.h>using namespace std; typedef unsigned long long ull; const int N = 1e5 + 7; ull a[N], tree[N * 4]; void chan 阅读全文
posted @ 2022-10-29 16:14 feuerwerk 阅读(37) 评论(0) 推荐(0)
摘要: 我靠,居然忘记怎么写单调队列了,废了废了QAQ #include<bits/stdc++.h>using namespace std; const int N = 1e6 + 7; int a[N], q[N]; int main(){ int n, k; scanf("%d%d", &n, &k) 阅读全文
posted @ 2022-10-29 15:40 feuerwerk 阅读(30) 评论(0) 推荐(0)
摘要: 线段树板子题(水题) #include<bits/stdc++.h>using namespace std; const int N = 1e5 + 7; int a[N], tree[N * 4]; void build_tree(int l, int r, int i){ if(l == r){ 阅读全文
posted @ 2022-10-29 13:36 feuerwerk 阅读(28) 评论(0) 推荐(0)