08 2019 档案
摘要:康拓展开 给出一个全排列,求他是第几个全排列称为康拓展开。 暴力康拓展开 对于一个全排列来说,从左往右第i位,有 n + 1 - i 种选择。如果用变进制数表示的话,这一位就是 n + 1 - i 进制的数,如果这一位选择了第k种情况,那么对应的这一位就是k。(k从0开始) 比如:1 4 5 2 3
阅读全文
摘要:dij SPFA 负环和差分约束之前写程序设计作业的时候就了解过spfa和差分约束,这里再解释一下 负环: 一个边权和为复数的环称为负环。不难知道,如果图中存在负环,那么无论经过多少次迭代,总存在有向边(x,y,z)使得dist[y] > dist[x] + z则spfa算法无法结束。 根据抽屉原理
阅读全文
摘要:Given a connected undirected graph, tell if its minimum spanning tree is unique. Definition 1 (Spanning Tree): Consider a connected, undirected graph
阅读全文
摘要:There are N villages, which are numbered from 1 to N, and you should build some roads such that every two villages can connect to each other. We say t
阅读全文
摘要:You are a member of the space station engineering team, and are assigned a task in the construction process of the station. You are expected to write
阅读全文