今天在codeforces上面做到一道题:http://codeforces.com/contest/638/problem/B 题目大意是:给定n个字符串,找到最短的字符串S使得n个字符串都是这个字符串S的子串. 题目里有一个限制条件是每个字母都最多出现一次,所以可以用下面的方法来解决: http://codeforces.com/contest/638/submission/16900955 然后我想到如果问题没有“每个字母最多只出现一次”这个限制的话应该怎么解决. 暂时还在想………
B. Making Genome in Berland 题目连接: http://www.codeforces.com/contest/638/problem/B Description Berland scientists face a very important task - given the parts of short DNA fragments, restore the dinosaur DNA! The genome of a berland dinosaur has notin…
D. Three-dimensional Turtle Super Computer 题目连接: http://www.codeforces.com/contest/638/problem/D Description A super computer has been built in the Turtle Academy of Sciences. The computer consists of n·m·k CPUs. The architecture was the paralellepip…
C. Road Improvement 题目连接: http://www.codeforces.com/contest/638/problem/C Description In Berland there are n cities and n - 1 bidirectional roads. Each road connects some pair of cities, from any city you can get to any other one using only the given…
A. Home Numbers 题目连接: http://www.codeforces.com/contest/638/problem/A Description The main street of Berland is a straight line with n houses built along it (n is an even number). The houses are located at both sides of the street. The houses with od…
D. Running with Obstacles 题目连接: http://www.codeforces.com/contest/637/problem/D Description A sportsman starts from point xstart = 0 and runs to point with coordinate xfinish = m (on a straight line). Also, the sportsman can jump - to jump, he should…
C. Promocodes with Mistakes 题目连接: http://www.codeforces.com/contest/637/problem/C Description During a New Year special offer the "Sudislavl Bars" offered n promo codes. Each promo code consists of exactly six digits and gives right to one free…
B. Chat Order 题目连接: http://www.codeforces.com/contest/637/problem/B Description Polycarp is a big lover of killing time in social networks. A page with a chatlist in his favourite network is made so that when a message is sent to some friend, his fri…
A. Voting for Photos 题目连接: http://www.codeforces.com/contest/637/problem/A Description After celebrating the midcourse the students of one of the faculties of the Berland State University decided to conduct a vote for the best photo. They published t…
A. Voting for Photos time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output After celebrating the midcourse the students of one of the faculties of the Berland State University decided to conduct…