摘要: 题目传送门 用优先队列瞎搞... 想着在每个地方 先算上一个点到这一个点要花费多少钱 这个用小根堆算就好 然后在这个地方加油 把油钱比自己多的替代掉 这个用大根堆维护一下 然后两个堆之间信息要保持互通 这个有点麻烦 我用的f数组维护 这样就好了 中间懒得改全部开了long long 不要介意 #in 阅读全文
posted @ 2017-06-21 13:07 友人Aqwq 阅读(189) 评论(0) 推荐(0) 编辑
摘要: 题目传送门 这道题一开始想了很久...还想着写网络流 发现根本不可能.... 然后就想着线段树维护然后二分什么的 最后发现优先队列就可以了 代码还是很简洁的啦 233 就是把兔子按血量从大到小排序一下然后➹箭按伤害从大到小也排序一下 然后每次找一只兔子 把能杀死他的箭全部丢到优先队列里 队首就是代价 阅读全文
posted @ 2017-06-20 19:09 友人Aqwq 阅读(300) 评论(0) 推荐(0) 编辑
摘要: 这道题维护一下前缀最大值然后二分答案就好了哇 233 #include<cstdio> #include<cstring> #include<algorithm> using namespace std; const int M=50007,inf=2000007; int read(){ int 阅读全文
posted @ 2017-06-20 14:22 友人Aqwq 阅读(124) 评论(0) 推荐(0) 编辑
摘要: 题目传送门 这道题只要证明最佳解一定在相邻两个点之间的好啦 这个自己证一证就okay啦 而且我发现n方的算法可以过耶... #include<cstdio> #include<cstring> #include<algorithm> using namespace std; const int M= 阅读全文
posted @ 2017-06-19 21:47 友人Aqwq 阅读(188) 评论(0) 推荐(0) 编辑
摘要: 题目传送门 这道题一开始写了n方的算法 果不其然 它T了 所以就想想o(n)的算法 写不出来 就像sbzhq学习了一下 这道题啊 要维护一下从深度1到n每一段的最小值以及他的位置 然后就暴力搞一搞就okay 啦!!! #include<cstdio> #include<cstring> #inclu 阅读全文
posted @ 2017-06-19 20:55 友人Aqwq 阅读(150) 评论(0) 推荐(0) 编辑
摘要: 这道题瞎jbyy了很久 方法可能很奇怪... #include<cstdio> #include<cstring> #include<algorithm> #include<cmath> #define LL long long using namespace std; int n,ans; int 阅读全文
posted @ 2017-06-19 19:04 友人Aqwq 阅读(160) 评论(0) 推荐(0) 编辑
摘要: 先上题目 bzoj3669: [Noi2014]魔法森林 这道题首先每一条边都有一个a,b 我们按a从小到大排序 每次将一条路劲入队 当然这道题权在边上 所以我们将边化为点去连接他的两个端点 当然某两个点我用的是并查集维护 其实也可以在树上直接查询 但是这样比较方便 同时我们维护某个点极其子树的最大 阅读全文
posted @ 2017-06-13 22:00 友人Aqwq 阅读(149) 评论(0) 推荐(0) 编辑
摘要: 这道题先求出0和-1经过处理后的答案 具体看代码吧 #include<cstdio> #include<cstring> #include<algorithm> using namespace std; int v0=0,v1=-1,ans,av,n,m,x; int main() { char c 阅读全文
posted @ 2017-06-13 21:58 友人Aqwq 阅读(220) 评论(0) 推荐(0) 编辑
摘要: 这道题需要注意的就是标记的传递 规定先传乘法标记再传加法标记就好了 #include<cstdio> #include<cstring> #include<algorithm> #define LL unsigned int using namespace std; const int M=1000 阅读全文
posted @ 2017-06-13 18:41 友人Aqwq 阅读(103) 评论(0) 推荐(0) 编辑
摘要: 这道题就是维护一个有根的lct 一开始建树全部建虚边 求多少次弹出就是求他到根的距离(根为n+1) 这里有个小技巧 将n+1作为根而没有虚根操作起来会比较方便 #include<cstdio> #include<cstring> #include<algorithm> using namespace 阅读全文
posted @ 2017-06-12 14:20 友人Aqwq 阅读(162) 评论(0) 推荐(0) 编辑