摘要: https://codeforces.com/contest/1579/problem/E1 算法的本质思路是贪心 第一点看到n特别大,又是求最优解问题,多手玩几个数字就好了 在实现上要会写小根堆, 赛场上a了,赛后被卡在test 14 #include<bits/stdc++.h> using n 阅读全文
posted @ 2021-09-30 09:22 liyishui 阅读(167) 评论(0) 推荐(0) 编辑
摘要: 永远也不退役,无论有多少人比我强都不退役,关我屁事 活着就不退役 我永远肝 #include<bits/stdc++.h> using namespace std; const int maxn=1e6; int cnt=0,n,m,s,dis[maxn],vis[maxn],head[maxn]; 阅读全文
posted @ 2021-09-30 09:17 liyishui 阅读(40) 评论(0) 推荐(0) 编辑
摘要: 在做https://codeforces.com/contest/1579/problem/D时 思路出了不会写 赛后看b站解说 你就开个优先队列每次取两个top出来--; 我: 这就去学。 struct node{ int id,val; bool operator < (const node t 阅读全文
posted @ 2021-09-30 00:07 liyishui 阅读(96) 评论(0) 推荐(0) 编辑
摘要: 是getsum(a[i]-1) 不是getsum(i-1); 20210920 #include<bits/stdc++.h> using namespace std; const int maxn=1e5; int a[maxn],n,c[maxn],ans[maxn]; int lowbit(i 阅读全文
posted @ 2021-09-29 21:57 liyishui 阅读(45) 评论(0) 推荐(0) 编辑
摘要: 跑两遍dij 其中第二遍把所有边反向 问题在于如何把各类边和dis清干净 2021 09 29 待补 2021 10 05 #include <iostream> #include <math.h> #include <string.h> #include <vector> #include <ma 阅读全文
posted @ 2021-09-29 19:08 liyishui 阅读(37) 评论(0) 推荐(0) 编辑
摘要: //可是spfa会被卡得很惨很惨wa//待补充dij#include <iostream> #include <math.h> #include <string.h> #include <vector> #include <map> #include <queue> #include <stdio. 阅读全文
posted @ 2021-09-29 18:00 liyishui 阅读(19) 评论(0) 推荐(0) 编辑
摘要: 我的思路是二分出答案,然后跑n3的弗洛伊德判断当以这个答案作为最大值时,能不能到目的 但是t了,一想, 200*200*200=800,0000; 极限情况是32 32个八百万,爆炸了。 错误代码: (t了但是理论上可行 #include <iostream> #include <math.h> # 阅读全文
posted @ 2021-09-29 17:59 liyishui 阅读(20) 评论(0) 推荐(0) 编辑
摘要: #如果update写成了边界为l==r,那跟没建树有什么区别 #没写pushdown的话就直接回溯sum,会出大锅,会存在大区间的ans和lazy都改了,但小区间的还是保持原样 当这个区间又被查询的时候,会出现大区间=小区间+小区间(tree i=tree i*2+tree i*2+1),相当于没改 阅读全文
posted @ 2021-09-26 10:12 liyishui 阅读(39) 评论(0) 推荐(0) 编辑
摘要: #我大爷的读入被卡了 #对于ADD,END什么的处理,开个char,然后判断s[0],嘛 自己调的代码~ #include <iostream> #include <math.h> #include <string.h> #include <vector> #include <map> #inclu 阅读全文
posted @ 2021-09-25 11:30 liyishui 阅读(20) 评论(0) 推荐(0) 编辑
摘要: 网上给出的题解是一片的记录与父亲的关系。 昨天看到以前打的监狱罪犯打架的事情,做法是记录敌人的敌人,对a和b,合并的时候合并b和a的敌人,这里要挂到敌人的敌人老大那边。 好像可以搬过来写在这里。 很微妙,并查集给出的是同一个元素在一个群里,题目给出的是不能在一起的,我们加个数组他们就在一起了.. 第 阅读全文
posted @ 2021-09-24 09:46 liyishui 阅读(28) 评论(0) 推荐(0) 编辑