摘要: Description You are given an array a consisting of n integers. In one move you can choose any aiai and divide it by 2 rounding down (in other words, i 阅读全文
posted @ 2019-09-03 22:21 Artoriax 阅读(442) 评论(0) 推荐(0) 编辑
摘要: Description Heard that eom is a fishing MASTER, you want to acknowledge him as your mentor. As everybody knows, if you want to be a MASTER's apprentic 阅读全文
posted @ 2019-09-03 21:48 Artoriax 阅读(125) 评论(0) 推荐(0) 编辑
摘要: Description You have a directed weighted graph with n vertexes and m edges. The value of a path is the sum of the weight of the edges you passed. Note 阅读全文
posted @ 2019-09-03 16:06 Artoriax 阅读(158) 评论(0) 推荐(0) 编辑
摘要: Description You are given a string S consisting of only lowercase english letters and some queries. For each query (l,r,k), please output the starting 阅读全文
posted @ 2019-09-03 14:26 Artoriax 阅读(123) 评论(0) 推荐(0) 编辑
摘要: Description You are given an array a1,a2,...,an(∀i∈[1,n],1≤ai≤n). Initially, each element of the array is unique . Moreover, there are m instructions. 阅读全文
posted @ 2019-09-03 14:15 Artoriax 阅读(186) 评论(0) 推荐(0) 编辑
摘要: BZOJ 2115 Xor Description Input 第一行包含两个整数N和 M, 表示该无向图中点的数目与边的数目。 接下来M 行描述 M 条边,每行三个整数Si,Ti ,Di,表示 Si 与Ti之间存在 一条权值为 Di的无向边。 图中可能有重边或自环。 Output 仅包含一个整数, 阅读全文
posted @ 2019-08-21 11:00 Artoriax 阅读(173) 评论(0) 推荐(0) 编辑
摘要: 简介 线性基是一个集合 从原集合中选取任意多个数异或得到的值都能通过在线性基中选取一些数进行异或得到; 也就是说线性基是对原集合的压缩 构建方法 首先,可以知道 对于集合A = {a1,a2,...,an},将其中的ai(i∈[1,n])用ai ^ aj (j∈[1,n]且j≠i)替换得到集合B = 阅读全文
posted @ 2019-08-21 10:15 Artoriax 阅读(205) 评论(0) 推荐(0) 编辑
摘要: HDU 4348 To the moon Description You‘ve been given N integers A [1], A [2],..., A [N]. On these integers, you need to implement the following operatio 阅读全文
posted @ 2019-08-03 14:43 Artoriax 阅读(220) 评论(0) 推荐(0) 编辑
摘要: SPOJ QTREE3 Query on a tree again! Description You are given a tree (an acyclic undirected connected graph) with N nodes. The tree nodes are numbered 阅读全文
posted @ 2019-08-03 10:58 Artoriax 阅读(275) 评论(0) 推荐(0) 编辑
摘要: 简介 树链剖分就是将树划分为多条链,将每条链映射到序列上,然后使用线段树,平衡树等数据结构来维护每条链的信息。 树剖将树链映射到序列上后用线段树等数据结构来维护树链信息,所以可以像区间修改,区间查询一样进行树上路径的修改、查询等操作 基本概念 重儿子:子树结点数目最多的儿子(size最大的点); 重 阅读全文
posted @ 2019-08-03 10:30 Artoriax 阅读(154) 评论(0) 推荐(0) 编辑
摘要: Codeforces 438D The Child and Sequence Description At the children's day, the child came to Picks's house, and messed his house up. Picks was angry at 阅读全文
posted @ 2019-08-03 10:05 Artoriax 阅读(257) 评论(0) 推荐(0) 编辑
摘要: KMP算法 介绍 用处:用于串的模式匹配,即找出模式串在主串中的出现位置 朴素想法,直接遍历两个串,失配回到主串开始比较位置的下一位继续匹配,复杂度$O(nm)$ KMP算法即在$O(n+m)$复杂度内匹配的算法 算法实现 通过一个叫$next$数组的东西,使指向主串的$i$指针不回溯,只改变指向模 阅读全文
posted @ 2019-04-10 15:43 Artoriax 阅读(194) 评论(0) 推荐(0) 编辑
摘要: 引入 权值树状数组就是数组下标是数值的数组,数组存储下标对应的值有几个数 题目 HDU 2852 KiKi's K Number 题意 几种操作,p=0代表push:将数值为a的数压入盒子 p=1代表pop,代表删除数值为e的数,如果没有这个数,输出No Elment! p=2代表query,查询比 阅读全文
posted @ 2019-04-10 15:09 Artoriax 阅读(288) 评论(0) 推荐(0) 编辑
摘要: 引入 树状数组用于求区间和,其修改和查询的复杂度都是$O(logn)$,非常好写,比较小巧。 几种基础用法,关于权值树状数组在另一篇博客。 单点修改,区间查询 区间和 HDU 1166 敌兵布阵 模版: c++ include define N 50005 using namespace std; 阅读全文
posted @ 2019-04-10 14:56 Artoriax 阅读(199) 评论(0) 推荐(0) 编辑
摘要: 图片内容并非原创,来自巨神学长 2020/1/14更新:修复了最大流板子常数过大的问题 最大流 设G(V,E)为一个有向图,它的每条边都被赋予了一个非负的实数c作为边的容量,记为c(u,v)。网络流 (network flow)指为这个有向图分配流并且使得它每条边上的流量都不能超过这条边的容量。 在 阅读全文
posted @ 2019-04-06 16:30 Artoriax 阅读(286) 评论(0) 推荐(0) 编辑