
构造
文章平均质量分 77
RJ28
小学生
展开
-
Ural 2037. Richness of binary words (打表+构造)
DescriptionFor each integer i from 1 to n, you must print a string si of length n consisting of letters ‘a’ and ‘b’ only. The string si must contain exactly i distinct palindrome substrings. Two sub原创 2016-08-08 14:02:24 · 392 阅读 · 0 评论 -
Codeforces Round #397 E. Tree Folding(脑洞)
Vanya wants to minimize a tree. He can perform the following operation multiple times: choose a vertex v, and two disjoint (except for v) paths of equal length a0 = v, a1, ..., ak, and b0 = v, b原创 2017-03-08 10:12:34 · 290 阅读 · 0 评论 -
ICPCCamp 2017 Day 6: U of Tokyo Selection 1 - Problem A. Spanning Trees
题意:给一个N个点的完全图,让你输出k个边不重复的生成树。分析:如果k > n/2直接无解,否则我们用类似数学归纳法的方法构造;可以发现从2开始才有解,而且n每增加2其构造方案数才能+1,当n为奇数时,我们可以让第n个点直接向前边的点连边来继承n-1的所有方案;当n为偶数时,我们可以直接继承n-2的所有方案,并且让[1,(n-2)/2]的边连向n-1,[(n-2)/2+1,n-原创 2017-02-20 09:05:37 · 543 阅读 · 0 评论 -
Codeforces Round #215 (Div. 1) C. Sereja and the Arrangement of Numbers(欧拉图)
Let's call an array consisting of n integer numbers a1, a2, ..., an, beautiful if it has the following property:consider all pairs of numbers x, y (x ≠ y), such that number x occurs in the a原创 2017-02-09 20:28:02 · 402 阅读 · 0 评论 -
AIM Tech Round 3 (Div. 1) B. Recover the String(构造)
B. Recover the Stringtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputFor each string s consisting of characters '0' a原创 2016-09-05 16:19:21 · 375 阅读 · 0 评论 -
LA 7339 Owllen(贪心)
题意:给定一个长度为n的字符串(26个小写字母),让你再构造一个长度为n的字符串,使得两串的LCS最小。分析:选原串中出现次数最少的字母构造就可以了,可以证明这样一定是LCS最小。#include#include#include#include#include#include#include#include#include#include#include原创 2016-08-22 14:24:03 · 368 阅读 · 0 评论 -
Gym 100801G Graph(贪心构造)
题意:给n个点m条边的DAG,最多可以添加k条边,问添加后的图的最小拓扑序的最大值是多少。分析:开两个set,一个维护当前入度为0的所有点,一个用来维护需要被加边的点,然后对于第一个set中值最小的点,如果set中还有其他点且k还没用完,那么我们便直接把它扔进第二个set中待处理,否则直接将其打印出;如果第一个set中只有这一个点,我们便考虑能不能从第二个set中找一个最大的点原创 2016-08-29 21:28:21 · 669 阅读 · 0 评论 -
Ural 2045 Richness of words(构造)
045. Richness of wordsTime limit: 0.5 secondMemory limit: 64 MBFor each integer i from 1 to n, you must print a stringsi of length n consisting of lowercase Latin letters.The stringsi原创 2016-08-07 20:56:32 · 532 阅读 · 2 评论 -
2017 ACM-ICPC 亚洲区(乌鲁木齐赛区)网络赛 Colored Graph(贪心构造)
In graph theory, graph colouring is a special case of graph labelling.It is an assignment of labels traditionally called colours to edges of a graph.Here we consider the simplest form.Given an u原创 2017-09-14 00:02:30 · 323 阅读 · 0 评论