2019杭电多校第四场
1001. AND Minimum Spanning Tree
solved at 00:39(+1)
有一张\(n\)个点的完全图,点编号是\(1\)到\(n\),边权是点编号的bitwise and,求最小生成树,输出字典序最小的
solved at 00:39(+1)
有一张\(n\)个点的完全图,点编号是\(1\)到\(n\),边权是点编号的bitwise and,求最小生成树,输出字典序最小的
upsloved
有一个DAG,出度为\(0\)的点是指挥中心,\(q\)次询问,每次给出两个点,这两个点存有关键物资,你可以炸掉一个点和它的邻接边,使得这两个点中任意一个点的物资不能到达指挥中心(有一个点不能到达任意一个指挥中心即可),求方案数,询问独立
upsolved
\(n\)个点,\(m\)条边的图\((1<=n<=1e5,1<=m,q<=2e5)\),\(q\)次操作,操作有两种,一种是翻转区间内边的状态,第二种是询问两个点的邻接点集是否一致
有点自闭,本来应该昨天写的,拖到了今天
upsolved
题意是在\(n\)个位置上填数,只能填\(0,1,2,3\)这四种,然后有\(m\)个限制条件,限制的是区间不同数的个数,求填数方案数\(1<=n,m<=100\)
D还没补,G看起来做不了
solved at 00:21
题意是有两个长为n的数组a,b,每个数组都是1到n的一个排列
询问一个最长的前缀p,使得对于任意的\(1 <= l <= r <= q\),都有\(min\_element(a, l, r) = min\_element(b, l, r)\)(最小值的位置对应相等,而非值相等)
Let's define the Eulerian traversal of a tree (a connected undirected graph without cycles) as follows: consider a depth-first search algorithm which traverses vertices of the tree and enumerates them in the order of visiting (only the first visit of each vertex counts). This function starts from the vertex number \(1\) and then recursively runs from all vertices which are connected with an edge with the current vertex and are not yet visited in increasing numbers order. Formally, you can describe this function using the following pseudocode: next_id = 1id = array of length n filled with -1visited = array of length n filled with falsefunction dfs(v): visited[v] = true id[v] = next_id next_id += 1 for to in neighbors of v in increasing order: if not visited[to]: dfs(to)You are given a weighted tree, the vertices of which were enumerated with integers from \(1\) to \(n\) using the algorithm described above. A leaf is a vertex of the tree which is connected with only one other vertex. In the tree given to you, the vertex \(1\) is not a leaf. The distance between two vertices in the tree is the sum of weights of the edges on the simple path between them. You have to answer \(q\) queries of the following type: given integers \(v\), \(l\) and \(r\), find the shortest distance from vertex \(v\) to one of the leaves with indices from \(l\) to \(r\) inclusive.