上一页 1 ··· 6 7 8 9 10 11 下一页
摘要: 一共两个操作:合并和查询。 开始是没有并集的,得先合并再查询。 #include<iostream> using namespace std; const int N = 100010; int p[N]; int n, m; //p[x]=find(p[x]),直到找到它的祖宗节点,之后返回祖宗节 阅读全文
posted @ 2024-07-27 16:06 某朝 阅读(15) 评论(0) 推荐(0)
摘要: Trie树 阅读全文
posted @ 2024-07-27 11:41 某朝 阅读(11) 评论(0) 推荐(0)
摘要: 董晓 阅读全文
posted @ 2024-07-26 15:04 某朝 阅读(20) 评论(0) 推荐(0)
摘要: 单调栈 视频连接 #include<iostream> using namespace std; const int N = 100010; int stk[N], tt; int main() { int n; cin >> n; while (n--) { int x; scanf("%d", 阅读全文
posted @ 2024-07-25 19:21 某朝 阅读(20) 评论(0) 推荐(0)
摘要: 题目大意 实现一个单链表,链表初始为空,支持三种操作: (1) 向链表头插入一个数; (2) 删除第k个插入的数后面的数; (3) 在第k个插入的数后插入一个数 现在要对该链表进行M次操作,进行完所有操作后,从头到尾输出整个链表。 注意 : 题目中第k个插入的数并不是指当前链表的第k个数。例如操作过 阅读全文
posted @ 2024-07-25 16:36 某朝 阅读(28) 评论(0) 推荐(0)
摘要: acwing803 我的代码 #include <iostream> #include <vector> #include <algorithm> using namespace std; typedef pair<int, int> PII; void merge(vector<PII>& seg 阅读全文
posted @ 2024-07-25 12:31 某朝 阅读(11) 评论(0) 推荐(0)
摘要: acwing802区间和 注意:find只是在alls里查找 //x->kx //l->kl //r->kr //一个数离散化对应坐标 //求l~r之间的区间和,就是求a[kl~kr] //add: 保存真实的下标和相应的值 //alls : 用来保存真实的下标和想象的下标的映射关系 //query 阅读全文
posted @ 2024-07-23 11:53 某朝 阅读(20) 评论(0) 推荐(0)
摘要: //洛谷p2367语文成绩 一维差分 #include<iostream> using namespace std; const int N = 10000010; int a[N], b[N]; int n; int p; void insert(int l, int r, int c) { b[ 阅读全文
posted @ 2024-07-22 13:25 某朝 阅读(23) 评论(0) 推荐(0)
摘要: //洛谷p8218求区间和 #include<iostream> using namespace std; const int N = 100010; int n; int m; int a[N], s[N]; int main() { cin >> n; for (int i = 1; i <= 阅读全文
posted @ 2024-07-22 13:21 某朝 阅读(32) 评论(0) 推荐(0)
摘要: 加法 #include<iostream> using namespace std; string s1, s2; int a[101], b[101],c[101]; void strtoint(string str,int des[]) { for (int i = 0; i < str.siz 阅读全文
posted @ 2024-07-20 21:35 某朝 阅读(17) 评论(0) 推荐(0)
上一页 1 ··· 6 7 8 9 10 11 下一页