摘要: 太菜了QAQ,看懂了过下又突然不懂了QAQ 洛谷日报76期有树上差分知识点,讲的很清楚 阅读全文
posted @ 2019-06-04 14:22 红色OI再临 阅读(88) 评论(0) 推荐(0) 编辑
摘要: #include #define RI register int #define MN 300008 using namespace std; struct node{ int x,y,lca,dis ; }ask[MN]; int comp(node xx,node yy){ return xx.disdep[y])swap(x,y); for(RI i=20;i>=0;... 阅读全文
posted @ 2019-06-04 13:23 红色OI再临 阅读(86) 评论(0) 推荐(0) 编辑
摘要: #include #include #include #define MN 3000050 using namespace std; int dfn[MN], f[MN][21]; int n, m, cnt, root; int head[MN], lg[MN]; int a[MN]; int sum[MN]; struct tu { int v, nxt; } e[MN]; v... 阅读全文
posted @ 2019-06-04 10:25 红色OI再临 阅读(160) 评论(0) 推荐(0) 编辑
摘要: upd:之前的博客什么也没讲,只贴了代码,居然能在百度搜素的第一条,我表示抱歉,,,,,, 考虑dijstra的过程,最短路计数我们只需要加上一个ans,如果当前能松弛,即dis[v]>dis[u]+e[i].w,我们就讲当前v的ans更新为ans[u],但还有一种特殊情况即dis[v]=dis[u 阅读全文
posted @ 2019-06-04 08:38 红色OI再临 阅读(284) 评论(0) 推荐(0) 编辑
摘要: 其实我做这题为时尚早 做这题之前先学习set 阅读全文
posted @ 2019-06-04 08:32 红色OI再临 阅读(115) 评论(0) 推荐(0) 编辑
摘要: 树上边的差分,给每个点赋值为0,对于非树边(x,y)x,y权值+1,lca(x,y)-=2,再dfs #include <iostream> #include <cstdio> #include <algorithm> #include <cmath> #define MN 200050 using 阅读全文
posted @ 2019-06-03 15:38 红色OI再临 阅读(174) 评论(0) 推荐(0) 编辑
摘要: #include #include #include using namespace std; int dfn[500001], f[500001][21]; int n, m, cnt, root; int head[500001], lg[500001]; struct tu { int v, nxt; } e[5000001]; void add(int u, int v) ... 阅读全文
posted @ 2019-06-03 13:58 红色OI再临 阅读(123) 评论(0) 推荐(0) 编辑
摘要: 单点修改区间查询 例题 i hate it 区间修改区间查询 线段树1 最大数 线段树2 维护序列 花神周游列国 开平方暴力修改 色板游戏 阅读全文
posted @ 2019-06-02 21:18 红色OI再临 阅读(116) 评论(0) 推荐(0) 编辑
摘要: 发布题解便于我日后复习二分用 顺便水下咕值 看到这道题,根据题意我们能很快找到c与时间t和d[i],s[i]的关系,然后呢? 然后不会了 于是就想到了二分答案 二分枚举,一直靠近答案为止 代码有注释 阅读全文
posted @ 2019-05-29 19:31 红色OI再临 阅读(168) 评论(0) 推荐(0) 编辑