08 2013 档案
摘要:1129. Door PaintingTime limit: 0.25 second Memory limit: 64 MBThere are many rooms, corridors and doors between them in the kindergarten. Some repairs are planned to be made soon. The doors are agreed to be painted in bright cheerful colors: green and yellow. The matron of the kindergarten wants the
阅读全文
摘要:Problem DescriptionIt is well known that a human gene can be considered as a sequence, consisting of four nucleotides, which are simply denoted by four letters, A, C, G, and T. Biologists have been interested in identifying human genes and determining their functions, because these can be used to di
阅读全文
摘要:1077. Travelling ToursTime limit: 1.0 second Memory limit: 64 MBThere areNcities numbered from 1 toN(1≤N≤200) andMtwo-way roads connect them. There are at most one road between two cities. In summer holiday, members of DSAP Group want to make some traveling tours. Each tour is a route passesKdiffere
阅读全文
摘要:DescriptionEvery time it rains on Farmer John's fields, a pond forms over Bessie's favorite clover patch. This means that the clover is covered by water for awhile and takes quite a long time to regrow. Thus, Farmer John has built a set of drainage ditches so that Bessie's clover patch i
阅读全文
摘要:Problem DescriptionNetwork flow is a well-known difficult problem for ACMers. Given a graph, your task is to find out the maximum flow for the weighted directed graph.InputThe first line of input contains an integer T, denoting the number of test cases. For each test case, the first line contains tw
阅读全文
摘要:1354. Palindrome. Again PalindromeTime limit: 1.0 second Memory limit: 64 MBAwordis the nonempty sequence of symbolsa1a2…an. Apalindromeis the worda1a2…anthat is read from the left to the right and from the right to the left the same way (a1a2…an=anan−1…a1). IfS1=a1a2…anandS2=b1b2…bm, thenS1S2=a1a2…
阅读全文
摘要:1423. String TaleTime limit: 1.0 second Memory limit: 64 MBBackgroundI want to tell you a story. Not entirely, but only the very beginning, because the ending of this story became a legend of programming—as well as its heroes.When computers were large, when trees were small, when the sun shined brig
阅读全文
摘要:Problem DescriptionA network of m roads connects N cities (numbered from 1 to N). There may be more than one road connecting one city with another. Some of the roads are paid. There are two ways to pay for travel on a paid road i from city ai to city bi:in advance, in a city ci (which may or may not
阅读全文
摘要:Problem DescriptionWshxzt is a lovely girl. She likes apple very much. One day HX takes her to an apple tree. There are N nodes in the tree. Each node has an amount of apples. Wshxzt starts her happy trip at one node. She can eat up all the apples in the nodes she reaches. HX is a kind guy. He knows
阅读全文
摘要:1128. Partition into GroupsTime limit: 0.5 second Memory limit: 64 MBThere areNchildren in the kindergarten. Unfortunately, the children quarrel though not often. Each child has not more than three adversaries. Is it possible to partition the children into two groups (possibly not equal), so that ea
阅读全文
摘要:1160. NetworkTime limit: 1.0 second Memory limit: 64 MBAndrew is working as system administrator and is planning to establish a new network in his company. There will be N hubs in the company, they can be connected to each other using cables. Since each worker of the company must have access to the
阅读全文
摘要:1450. Russian PipelinesTime limit: 0.5 second Memory limit: 64 MBBackgroundThe last year developed into a lot of trouble for independent Russia. Bad harvest, bird flu and - to crown it all - the President, who decided to raise funds to buy new balalaika and tame bear for the child of his first cousi
阅读全文
摘要:1495. One-two, One-two 2Time limit: 2.0 second Memory limit: 64 MBA year ago the famous gangster Vito Maretti woke up in the morning and realized that he was bored of robbing banks of round sums. And for the last year he has been taking from banks sums that have only digits 1 and 2 in their decimal
阅读全文
摘要:1176. HyperchannelsTime limit: 1.0 second Memory limit: 64 MBThe Galaxy Empire consists of N planets. Hyperchannels exist between most of the planets. New Emperor urged to extend hyperchannels network in such a way, that he can move from any planet to any other using no more than one channel. One ca
阅读全文
摘要:1320. Graph DecompositionTime limit: 0.5 second Memory limit: 64 MBThere is a simple graph with an even number of edges. You are to define if it is possible to present it by the set of pairs of adjacent edges (having a common vertex).Inputcontains a sequence of the numbers pairs. Each pair denotes v
阅读全文
摘要:1651. Shortest SubchainTime limit: 1.0 second Memory limit: 64 MBA chainpis given in a directed graph without loops or multiple edges. It is required to specify its subchainqsuch thatthe initial and final vertices of the chainspandqcoincide;the edges in the chainqare in the same order as in the chai
阅读全文
摘要:Give you N integers a1, a2 ... aN (|ai| 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 using namespace std; 9 const int inf=-999999999;10 int a[1001];11 int sum[1001]={0};12 int dp1[1001];13 int dp2[1001];14 int n,i,j,k;15 int num;16 int main()17 {18 while(cin>>n&&
阅读全文
摘要:1156. Two RoundsTime limit: 2.0 second Memory limit: 64 MBThere are two rounds in the Urals Championship. The competitors have to solveNproblems on each round. The jury had been working hard and finally managed to prepare 2Nproblems for the championship. But it appeared that among those problems the
阅读全文
摘要:1227. Rally ChampionshipTime limit: 1.0 second Memory limit: 64 MBA high-level international rally championship is about to be held. The rules of the race state that the race is held on ordinary roads and the route has a fixed length. You are given a map of the cities and two-way roads connecting it
阅读全文
摘要:DescriptionThe relative frequency of characters in natural language texts is very important for cryptography. However, the statistics vary for different languages. Here are the top 9 characters sorted by their relative frequencies for several common languages:English: ETAOINSHR German: ENIRSATUD Fr.
阅读全文
摘要:1463. Happiness to People!Time limit: 1.0 second Memory limit: 64 MBEvery Santa Claus wants to surprise children with his presents. This year Santa Claus Petrovich wants to surprise children of remote Cuckooland. He is sure that in order to make a real impression he should choose a route without rep
阅读全文
摘要:1137. Bus RoutesTime limit: 1.0 second Memory limit: 64 MBSeveral bus routes were in the city of Fishburg. None of the routes shared the same section of road, though common stops and intersections were possible. Fishburg old residents stated that it was possible to move from any stop to any other st
阅读全文
摘要:1004. Sightseeing TripTime limit: 2.0 second Memory limit: 64 MBThere is a travel agency in Adelton town on Zanzibar island. It has decided to offer its clients, besides many other attractions, sightseeing the town. To earn as much as possible from this attraction, the agency has accepted a shrewd d
阅读全文
摘要:1124. MosaicTime limit: 0.25 second Memory limit: 64 MBThere's no doubt that one of the most important and crucial things to do in this world is to bring up children. May be, if you study properly and reach good results at the competition you'll get a position of nanny in a kindergarten. But
阅读全文
摘要:1742. Team buildingTime limit: 1.0 second Memory limit: 64 MBThere arenprogrammers in the software development company. Each of them thinks that he is the greatest or the second greatest programmer in the company. In the latter case he can name the greatest programmer in his opinion.The administrati
阅读全文
摘要:Problem DescriptionZero has an old printer that doesn't work well sometimes. As it is antique, he still like to use it to print articles. But it is too old to work for a long time and it will certainly wear and tear, so Zero use a cost to evaluate this degree. One day Zero want to print an artic
阅读全文
摘要:1049. Brave BalloonistsTime limit: 2.0 second Memory limit: 64 MBTen mathematicians are flying on a balloon over the Pacific ocean. When they are crossing the equator they decide to celebrate this event and open a bottle of champagne. Unfortunately, the cork makes a hole in the balloon. Hydrogen is
阅读全文
摘要:1109. ConferenceTime limit: 0.5 second Memory limit: 64 MBOn the upcoming conference were sentMrepresentatives of countryAandNrepresentatives of countryB(MandN≤1000). The representatives were identified with 1, 2, …,Mfor country A and 1, 2, …,Nfor countryB. Before the conferenceKpairs of representat
阅读全文
摘要:Problem DescriptionFew know that the cows have their own dictionary with W (1 ≤ W ≤ 600) words, each containing no more 25 of the characters 'a'..'z'. Their cowmunication system, based on mooing, is not very accurate; sometimes they hear words that do not make any sense. For instance
阅读全文
摘要:1523. K-inversionsTime limit: 1.0 second Memory limit: 64 MBConsider a permutationa1,a2, …,an(allaiare different integers in range from 1 ton). Let us callk-inversiona sequence of numbersi1,i2, …,iksuch that 1≤i1ai2>…>aik. Your task is to evaluate the number of differentk-inversions in a given
阅读全文
摘要:1350. CanteenTime limit: 1.0 second Memory limit: 64 MBIt’s dangerous to eat in a canteen — you may be poisoned by a not fresh food. One may fall into a coma because of the canteen’s chicken and the other feels OK. And vice versa. The food is cooked fromMdifferent food stuffs. There areNdifferent fo
阅读全文
摘要:Problem DescriptionThe cows don't use actual bowling balls when they go bowling. They each take a number (in the range 0..99), though, and line up in a standard bowling-pin-like triangle like this: 7 3 8 8 1 0 2 7 4 4 4 5 2 6 5Then the other cows ...
阅读全文
摘要:Problem DescriptionGigel has a strange "balance" and he wants to poise it. Actually, the device is different from any other ordinary balance. It orders two arms of negligible weight and each arm's length is 15. Some hooks are attached to these arms and Gigel wants to hang up some weigh
阅读全文
摘要:DescriptionBessie wants to navigate her spaceship through a dangerous asteroid field in the shape of an N x N grid (1 2 #include 3 #include 4 #include 5 #include 6 #include 7 using namespace std; 8 int map[1000][1000]; 9 int bmask[1000];10 int ny,nx;11 int cy[1000],cx[1000];12 int n,k,a,b;13 int xm.
阅读全文
摘要:In the army, a platoon is composed by n soldiers. During the morning inspection, the soldiers are aligned in a straight line in front of the captain. The captain is not satisfied with the way his soldiers are aligned; it is true that the soldiers are aligned in order by their code number: 1 , 2 , 3
阅读全文
摘要:1080. Map ColoringTime limit: 1.0 second Memory limit: 64 MBWe consider a geographical map withNcountries numbered from 1 toN(0 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #include 9 #include10 #include11 using namespace std;12 int pay[105];13 queueQ;14 int map[105][105];15 i
阅读全文
摘要:1242. WerewolfTime limit: 1.0 second Memory limit: 64 MBKnife. Moonlit night. Rotten stump with a short black-handled knife in it. Those who know will understand. Disaster in the village. Werewolf.There are no so many residents in the village. Many of them are each other's relatives. Only this m
阅读全文
摘要:1033. LabyrinthTime limit: 1.0 second Memory limit: 64 MBAdministration of the labyrinth has decided to start a new season with new wallpapers. For this purpose they need a program to calculate the square of the walls inside the labyrinth. This job is just for you!The labyrinth is represented by a m
阅读全文
摘要:1280. Topological SortingTime limit: 1.0 second Memory limit: 64 MBMichael wants to win the world championship in programming and decided to studyNsubjects (for convenience we will number these subjects from 1 toN). Michael has worked out a study plan for this purpose. But it turned out that certain
阅读全文
摘要:A little town started to construct a subway. The peculiarity of the town is that it is located on small islands, some of them are connected with tunnels or bridges. The mayor is sure that the subway is to be under the ground, that’s why the project must use the less bridges the better. The only requ
阅读全文
摘要:The railway line “Yekaterinburg-Sverdlovsk” with several stations has been built. This railway line can be represented as a line segment, railway stations being points on it. The railway line starts at the station “Yekaterinburg” and finishes at the station “Sverdlovsk”, so stations are numbered sta
阅读全文
摘要:1208. Legendary Teams ContestTime limit: 1.0 second Memory limit: 64 MBNothing makes as old as years. A lot of cool contests are gone, a lot of programmers are not students anymore and are not allowed to take part at the contests. Though their spirit is fresh and young as it was years ago! And so on
阅读全文
摘要:1709. Penguin-AviaTime limit: 1.0 second Memory limit: 64 MBThe Penguin-Avia airline, along with other Antarctic airlines, experiences financial difficulties because of the world's economic crisis. People of Antarctica economize on flights and use trains or prefer to stay at home. The airline
阅读全文
摘要:Ivanushka the Fool lives at the planet of 0-level. It's very unpleasant to live there. An awful climate, 80 hours working week, ugly girls… He, as well as every inhabitant of his planet, dreams to get to a planet ofN-th level. To the paradise.At each of thei-th level planets there are several hy
阅读全文
摘要:BackgroundThe system of Martians’ blood relations is confusing enough. Actually, Martians bud when they want and where they want. They gather together in different groups, so that a Martian can have one parent as well as ten. Nobody will be surprised by a hundred of children. Martians have got used
阅读全文
摘要:1106. Two TeamsTime limit: 1.0 second Memory limit: 64 MBThe group of people consists ofNmembers. Every member has one or more friends in the group. You are to write program that divides this group into two teams. Every member of each team must have friends in another team.InputThe first line of inp
阅读全文
摘要:Vladislav Isenbaev is a two-time champion of Ural, vice champion of TopCoder Open 2009, and absolute champion of ACM ICPC 2009. In the time you will spend reading this problem statement Vladislav would have solved a problem. Maybe, even two…Since Vladislav Isenbaev graduated from the Specialized Edu
阅读全文
摘要:Home PageWeb ContestsProblemsRanklistStatusStatistics 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 using namespace std; 8 int c[100]; 9 int s[100];10 int ans;11 int bitmap[100];12 int f[100][70][70],h;13 char str[100];14 int n,m,i,j,k;15 void init()16 {17 cin>>n>>m
阅读全文
摘要:Let us define a regular brackets sequence in the following way:Empty sequence is a regular sequence.If S is a regular sequence, then (S) and [S] are both regular sequences.If A and B are regular sequences, then AB is a regular sequence.For example, all of the following sequences of characters are re
阅读全文
摘要:A题: 判断>2的偶数;B题:(回溯)#include #include#include#include#include#include#includeusing namespace std;int days,times;int xt1[1000],xt2[1000];int sum,i,j,k;int a[1000];int main(){ cin>>days>>times; for(i=1;i>xt1[i]>>xt2[i]; } for(i=1;idays) { cout#include#include#include#include#inc
阅读全文
摘要:Let's imagine how apple tree looks in binary computer world. You're right, it looks just like a binary tree, i.e. any biparous branch splits up to exactly two new branches. We will enumerate by integers the root of binary apple tree, points of branching and the ends of twigs. This way we may
阅读全文