上一页 1 ··· 17 18 19 20 21 22 23 24 25 ··· 28 下一页
摘要: 我好咸鱼。 归并排序之前写过,树状数组就是维护从后往前插入,找比现在插入的数大的数的数量。 如果值域大,可以离散化 归并排序求 cpp include include include using namespace std; int n,a[50005],b[50005]; int merge(in 阅读全文
posted @ 2018-07-09 20:43 SWHsz 阅读(206) 评论(0) 推荐(0) 编辑
摘要: 想填一下以前的坑,结果发现是巨坑Orz lcs就是把a序列的位置映射到b序列上,求一个用树状数组lis即可 好简单啊,我真的是咸鱼Orz cpp include include include using namespace std; int n,ans; int a[100005],b[10000 阅读全文
posted @ 2018-07-09 10:52 SWHsz 阅读(244) 评论(0) 推荐(1) 编辑
摘要: 分层图bfs/spfa spfa好难写。。。 调不出来,写了bfs 记录持有钥匙的状态,以此分层即可。 cpp include include include include using namespace std; const int N=105,dx[4]={0,0,1, 1},dy[4]={1 阅读全文
posted @ 2018-07-09 10:00 SWHsz 阅读(212) 评论(0) 推荐(0) 编辑
摘要: 01分数规划的基本裸题。 因为路线一定是个环,所以找个最优比率生成环即可 二分一个比值,check一下即可。 阅读全文
posted @ 2018-07-08 23:51 SWHsz 阅读(108) 评论(0) 推荐(0) 编辑
摘要: 我真的是咸鱼啊 多少年前的基础了我竟然才弄明白,哭 用树状数组维护 using namespace std; mapmp; int f[50005],n,t[50005]; void modify(int x,int Max){ for(int i=x;i 阅读全文
posted @ 2018-07-08 21:48 SWHsz 阅读(766) 评论(5) 推荐(0) 编辑
摘要: 前置: nlogn逆序对: 前一个小时我还真的不会这个Orz 这里运用归并排序的思想。 对于一个序列,我们把它先分开,再合并成一个有序序列。 引自https://blog.csdn.net/qq_30189255/article/details/50937307 假设f(i,j)为i到j号元素中的逆 阅读全文
posted @ 2018-07-08 21:28 SWHsz 阅读(361) 评论(0) 推荐(0) 编辑
摘要: 一直没有思路啊。。 看了下byvoid的解释,强啊 以下内容来自byvoid https://www.byvoid.com/zhs/blog/lpf24 solution 最大权不相交路径问题,可以用最大费用最大流解决。 【建模方法】 方法1 按左端点排序所有区间,把每个区间拆分看做两个顶点,建立附 阅读全文
posted @ 2018-07-08 19:04 SWHsz 阅读(172) 评论(2) 推荐(0) 编辑
摘要: 树链剖分LCA O(n) O(logn) cpp include include const int N=500005; int n,m,S,ecnt,head[N],tim; struct Edge{int to,nxt;}e[N=dep[top[y]]) x=fa[top[x]]; else y 阅读全文
posted @ 2018-07-08 18:41 SWHsz 阅读(98) 评论(0) 推荐(0) 编辑
摘要: 看到一个dalao的博客,里面有很多神奇的东西。 https://www.czyhe.me/2018/05/05/strangaj lerta%C4%B5oj.html (这种博客会不会崩。。。) 阅读全文
posted @ 2018-07-08 17:35 SWHsz 阅读(192) 评论(2) 推荐(0) 编辑
摘要: 一道冒充网络流的最短路题。 根据题意,用位运算表示能否转移与转以后的状态。 (!($u$ & $cantinc$[i])) && (!($incw$[i] & $u$ ^ $incw$[i])) $u$表示旧状态,$cantinc$(can't include),$inc$(include wron 阅读全文
posted @ 2018-07-08 15:40 SWHsz 阅读(116) 评论(0) 推荐(0) 编辑
上一页 1 ··· 17 18 19 20 21 22 23 24 25 ··· 28 下一页