task
stringlengths
0
154k
__index_level_0__
int64
0
39.2k
The Game (QCJ3) Tom and Hanks play the following game. On a game board having a line of squares labelled from 0, 1, 2 ... certain number of coins are placed with possibly more than one coin on a single square. In each turn a player can move exactly one coin to any square to the left i.e., if a player wishes to remove ...
31,900
Minimum Diameter Circle (QCJ4) Given n points in a plane find the diameter of the smallest circle that encloses all the points. A point lying on the circle is also considered to be inside it. Input First line of input contains the n (< 301) the number of points in the plane , followed by n lines of input. Each lin...
31,901
PBCGAME (PBCGAME) The company "PBC" has made a game which consists of small platforms and pipes. There are 3 types of platforms: starting platforms (there are N1 of them), finishing platforms (there are N3 of them) and middle platforms (there are N2 of them). All starting platforms stand at identical height. Finishing...
31,902
Another GCD problem (GCDSQF) A number is square-free if its prime decomposition contains no repeated factors. For example: 1001 = 7 × 11 × 13 is square-free, but 20 = 2 × 2 × 5 is not square-free. Square-free numbers can encoding as binary numbers. Here are examples to illustrate: Sequence of prime numbers ...
31,903
Chocolate (SOCOLA) Chocolate in its many forms is enjoyed by millions of people around the world every day. It is a truly universal candy, available in virtually every country around the world. You find that the only thing better than eating chocolate is to share it with friends. Unfortunately, your friends are very...
31,904
Building Bridges (BRIDGE) The tribe soon discovers that just communication is not enough and wants to meet each other to form a joint force against the terminator. But there is a deep canyon that needs to crossed. Points have been identified on both sides on which bridge ends can be made. But before the construction c...
31,905
Standing Sequence (SSEQ) Now that the two tribes met, a joint force was formed. Colonel Prateek was ordered to lead the force. He needs to instruct his men on how to stand. The n men in the force have been given ranks from 1(lowest) to n(highest) and on parade they should be lined up from left to right in increasing o...
31,906
Homecoming (HOMEC) It was a tough battle but the humans won it comprehensively in the end. It was made possible due to combined efforts of both the human tribes but the 2 nd tribe wants to take all the credit and rule the world by killing the first tribe. Now that the war has ended, the tribes would be returning to t...
31,907
Majority (MAJOR) The human tribe has just discovered some other tribe and wants to communicate with them. To make sure it is not intercepted by the terminators, they ask their chief computer engineer Rohit to design a system for the purpose. In the design that Rohit proposes, data is transmitted n times. If it is rece...
31,908
OAE (OAE) Having joined forces and preparing for the war with the terminators the humans do know that it will be a tough battle. They plan to strike each base of the terminator and destroy them one by one. A genius computer engineer UD willing to extend his help to his fellow humans found out that each base of the ter...
31,909
Jane and Tarzan (JANE) Jane and Tarzan have got cellphones and now they want to be available all the time. They live in a long line of trees and they are available iff the absolute difference between the heights of the two trees which they are on is not greater than D. Jane and Tarzan are moving by the following rul...
31,910
Edit distance (EDIST) You are given two strings, A and B. Answer, what is the smallest number of operations you need to transform A to B? Operations are: Delete one letter from one of strings Insert one letter into one of strings Replace one of letters from one of strings with another letter Input T ...
31,911
Increasing Powers of K (INCPOWK) Let's define S k as the increasing sequence a 1 , a 2 , a 3 ... consisting of all those positive integers which are powers of K or sums of distinct powers of K. For example S 3 = {1, 3, 4, 9, 10, 12, 13, 27, 28, 30...} Your task is given N and K find the N th term of the sequ...
31,912
Dictionary order (GSP1) English Version: We have n characters in alphabetical table and n circle permutations. They (permutation) need to be ascendingly sorted in dictionary order. If same dictionary orders are found in 2 permutations, higher priority belongs to one having lower starting character's index (in input ...
31,913
Matches (FERT21_0) Upon a table there are two boxes. Each box has N matches inside. We want to know what is the probability of choose N times a random box and take one match from it, at the end have an empty box. You have to print all digits. Constraints 1 <= T <= 1000 1 <= N <= 1000 Input T N1 N2 ... NT O...
31,914
Inversion Count (INVCNT) Let A[0 ... n - 1] be an array of n distinct positive integers. If i < j and A[i] > A[j] then the pair (i, j) is called an inversion of A. Given n and an array A your task is to find the number of inversions of A. Input The first line contains t, the number of testcases followed by a...
31,915
Rank of a Fraction (FNRANK) Let us consider a set of fractions x/y, such that 0 ≤ x/y ≤ 1, y ≤ n and gcd(x, y) = 1. For example, say n = 5. Then we have the following set in increasing order : 0 ⁄ 1 , 1 ⁄ 5 , 1 ⁄ 4 , 1 ⁄ 3 , 2 ⁄ 5 , 1 ⁄ 2 , 3 ⁄ 5 , 2 ⁄ 3 , 3 ⁄ 4 , 4 ⁄ 5 , 1 ⁄ 1 You are given n, a and b...
31,916
Another Game With Numbers (NGM2) Little Chikoo likes to play with numbers. Often he plays the following game: He chooses a number N and a set of positive integers. He writes down all the numbers from 1 to N. He chooses the first number (say x) from the set and cancels out all the multiples of x from 1 to N, in...
31,917
Sum of products (SUMMUL) One boy Petya decided to practice in addition and multiplication of numbers. For this he chose some positive integer n, and ordered all the ways to decompose it into two or more terms of positive integers, and the ways in different order terms are considered to be different (for example, for n...
31,918
Treeramids (PYRA) Daniel is building towers. He has a big amount of block of the size 1×1×K (for any K). Out of them he is building towers according to the following rules: the longest block is put in the basement of the tower. Several towers built by the same rules can be put on this block. The distance between the b...
31,919
Bomberman (BOMBER) Alice and Bob love to play Bomberman. They decided to upgrade the game. Their version is played on a rectangular board divided into cells. The first player puts a bomb on any cell. The bomb destroys this cell, as well as all consecutive undestroyed cells left, right, above and below it. Then the sec...
31,920
Robbery 2 (ROBBERY2) k bandits robbed a bank. They took away n gold coins. Being a progressive group of robbers they decided to use the following procedure to divide the coins. First the most respected bandit takes 1 coin, then the second respected takes 2 coins ... the least respected takes k coins, then aga...
31,921
Shmoogle Wave (SHMOOGLE) Shmoogle company developed new protocol < > for the multi-user online editing of the text data. Using it, any client can send commands to the server for editing the text and the server would broadcast it to all other connected clients. Each command consists of a sequence of operations of the f...
31,922
Yodaness Level (YODANESS) Yoda is the wisest, and perhaps the most powerful Jedi of his time. Yoda is a mysterious figure and he has many oddities. One of them is that Yoda often changes the order of words in the sentence. For example, one of such phrases is "Or I will help you not." Let's call the yodaness level of a...
31,923
Experiment (EXPER) The following experiment is taking place. There are n points of a plane. Each point is moving with the uniform velocity. It is needed to determine the minimum circle which encloses all the points after each second of the experiment during the fixed time T. Input The first line of input contain...
31,924
Decipher (ROOTCIPH) Radar scanned the approaching enemy aircraft on the border. However due to some error part of the transmitted data can't be deciphered. It was possible only to obtain the coefficients of the cubic polynomial, whose roots are the coordinates of the aircraft relative to the radar. Now you need to cal...
31,925
Move Marbles (MOVMRBL) You have N marbles and K slots. You have to follow the below mentioned rules : You can put in a marble or take out a marble from slot numbered 1 at any time. You can put in a marble or take out a marble from slot numbered i only if there exists a marble at the slot i - 1. The game stops ...
31,926
The hunt for Gollum (ARDA1) Along the skirts of the Dead Marshes I followed it, and then I had him. Lurking by a stagnant mere, peering in the water as the dark eve fell, I caught him, Gollum. He was covered with green slime. He will never love me, I fear; for he bit me, and I was not gentle. Nothing more did I ever g...
31,927
Many polygons (NGON) There is a regular n-gon. We mark some points on its sides: a1 points on the first side, a2 on the second ... an on the last. Marked points do not coincide with the vertices n-gon. The question is, how many different convex nondegenerate (n-1)-gons you can build, using marked points as vertices? ...
31,928
ZUMA (ZUMA) One day Mirko, while he was walking through the high grass, stumbled upon a sequence of N colored marbles. Soon he noticed that if he touches K or more consecutive marbles of the same color, they start to twinkle and then he could wish them to magically vanish, although he doesn't have to do that immediate...
31,929
Rock-Paper-Scissors-Lizard-Spock (RPSSL) Daniel enjoys watching TV series. One of his favorite is "The Big Bang Theory". The main characters of this series are: Sheldon – genius theoretical physicist, his friend Leonard – talented experimental physicist, their attractive, blonde neighbor Penny, and also their friends ...
31,930
Two Array Problem (SAMTWARR) You are given two arrays each of length N (1 ≤ N ≤ 100000) which are initially filled with zeros. You have to apply M (1 ≤ M ≤ 100000) queries of three kind:  0 arr left right :   calculate and output sum of elements from left to right in array arr (arr = 0 -- first array, arr = 1 -- sec...
31,931
Counting Triangles 2 (KKKCT2) This is a new version of problem CT with the new limit: X, Y <= 10000, and the result will be written in modulo 2009 Input The input begins with C – number of test cases. Each test case consists of X, Y. Output For each test case, output the result in a line. Limit C <= 200 0 ...
31,932
PP numbers (MB1) PP numbers are prime numbers and palindromes in decimal notation at once. Your task is to find n -th PP number in ascending order. Then calculate product of its non-zero digits - let's call it m - and find m -th prime number in ascending order. Input In the first line of input there is one pos...
31,933
Finding the Kth Prime (TDKPRIME) The problem statement is really simple. There are some queries. You are to give the answers. Input An integer stating the number of queries Q (equal to 50000), and Q lines follow, each containing one integer K between 1 and 5000000 inclusive. Output Q lines with the answer ...
31,934
Printing some primes (TDPRIMES) The problem statement is really simple. You are to write all primes less than 10 8 . Input There is no input. Output To make the problem less output related write out only the 1st, 101st, 201st, ... 1st mod 100. Example Input: Output: 2 547 1229 ... 99995...
31,935
Bowling (BOWLING1) It is well known that programmers enjoy bowling. Bowling is a competitive sport in which a player (the “bowler”) rolls a bowling ball down a wooden or synthetic lane with the objective of scoring points by knocking down as many pins as possible. For a beginner, scoring is probably the part of bowl...
31,936
Hamster Flight 2 (HAMSTER2) There is a competition of flying hamsters in Hamsterburg. Each competing hamster is thrown from a sling. The initial speed of the hamsters is V0 m/s. Free fall acceleration is g = 10 m/s2. There is no air friction. The size of the hamster and the sling are negligible. When the hamster is th...
31,937
The Very Greatest Common Divisor (VGCD) Given two integers a and b find their greatest common divisor. Input The first line of the input file contains number 0 < n < 1000 the amount of tests. The description of n test cases follow. The description of a test case consists of two lines. The first line contains int...
31,938
Printing some primes (Hard) (PRIMES2) The problem statement is really simple (the constraints maybe not). You are to write all primes less than 10^9. Input There is no input. Output To make the problem less output related write out only the 1st, 501st, 1001st, ... 1st mod 500. Example Input: Output...
31,939
Finding the Kth Prime (Hard) (KPRIMES2) The problem statement is really simple (the constraints maybe not). There are some queries. You are to give the answers. Input An integer stating the number of queries Q (equal to 100000), and Q lines follow, each containing one integer K between 1 and 50000000 inclusive. ...
31,940
Breaking Chocolates (BCHOCO) Bored of setting problems for Bytecode, Venkatesh and Akhil decided to take some time off and started to play a game. The game is played on an R×C bar of chocolate consisting of Black and White chocolate cells. Both of them do not like black chocolate, so if the bar consists only of black ...
31,941
Counting Diameter (DCOUNT) Given an integer 'K', construct a set 'S' containing all integers from 1 to 2*K-1 (both inclusive). Construct a graph 'G' with vertices represented by all the K-1 element subsets of 'S'. There is an edge from vertex 'u' to vertex 'v' in 'G', if the corresponding subsets of 'u' and 'v' do not...
31,942
Travelling Salesman Again ! (TSPAGAIN) There are N cities numbered from 0..N-1. A salesman is located at city 0. He wishes to visit all cities exactly once and return back to city 0. There are K toll booths. Each toll booth has a certain range of functioning. The parameters for toll k are given as x_k and y_k. If the ...
31,943
Farmer Sepp (JOCHEF) Chief Farmer Josef aka Sepp needs to crop hay several times through the summer. Due to high petrol costs he can currently use his truck only once to drive to a spot where he will harvest the dried grass. Lazy by nature, John does not want to harvest those parts of the field which contain cows, sin...
31,944
N DIV PHI_N (NDIVPHI) Given an integer N ≤ 10 40 find the smallest m ≤ N such that m / phi(m) is maximum, where Phi is Euler's totient function . Input There are twenty values for N. N 1 N 2 . . . N 20 Output Output twenty answers, one for each value of N in the input. m 1 m 2 . . . m 20 Example ...
31,945
N DIV PHI_N (Hard) (NDIVPHI2) Given an integer N <= 10 25000 find the smallest m <= N such that m/phi(m) is maximum. Where phi is Euler's totient function. Input The first line in the input gives the number of test cases T (T <= 200), and then T lines follow each containing an integer N. Output Output the sma...
31,946
Esferas (PRUBALL) The classic Two Glass Balls brain-teaser is often posed as: "Given two identical glass spheres, you would like to determine the lowest floor in a 100-story building from which they will break when dropped. Assume the spheres are undamaged when dropped below this point. What is the strategy that wil...
31,947
Divide and Conquer (DIVCON) Anne and Brenda found some cookies scattered on the lattice points in the 2D coordinate system. They agreed to divide them in the following manner. First, Anne draws a vertical line (that is, a line with the equation x = c, for any real number c) somewhere in the plane. Then Brenda draws ...
31,948
Segment Tree (SEGTREE) It was Arbor Day. Alice implemented an RB-tree , Bob composed a segment tree , I made a binary tree - we all have a bright outlook. Lambda is always making mistakes while implementing segment trees (See his history of submissions). He then decides to draw a "segment tree". He puts n points...
31,949
Islands and Hotel Chains (HCHAINS) In Croatia there are N small islands. For the purposes of further tourism development, the government has decided to build exactly one hotel on the each island. The government has contracts with two hotel chains: let's call them A and B. Unfortunately, there is a problem since each h...
31,950
Snowball Game (SNOWGAME) Farmer John's N (1 ≤ N ≤ 10 18 ) cows went for a trip around the world. Now they are at the North Pole. They decided to play a snowball game. Each of the cows made one snowball. As it is known, heavier snowballs make more harm. FJ is sure that cows' snowballs are of the same weight except one ...
31,951
Consecutive sequence (SEQ6) We define consecutive sequence as a sequence of integer numbers {n, n+1, n+2 ... n+m}. For each given positive integer N ≤ 10 7 calculate number of such sequences which sum is equal to N. Input The input file consists of multiple lines (about 10 3 in the first data set and 10 5 in ...
31,952
Skiers (SKIVER1) English Vietnamese On the south slope of Bytemount there is a number of ski tracks and one ski lift. All the tracks run from the top station of the ski lift to the bottom one. Every morning a group of ski lift workers examines the condition of the tracks. They together take the lift up to ...
31,953
Easy Longest Common Substring (ELCS) In this problem, a string only consists of lowercase letters. Substring, is a consecutive sequence of characters occurrences at least once in a string. Common substring means a substring of two strings. After getting TLE on LCS and LCS2, lqp18_31 felt really depressed. So he ...
31,954
Load Testing (GCJ101C) Now that you have won Code Jam and been hired by Google as a software engineer, you have been assigned to work on their wildly popular programming contest website. Google is expecting a lot of participants ( P ) in Code Jam next year, and they want to make sure that the site can support that m...
31,955
Point on the side of the rectangle (MRECT1) English Vietnamese   The government is planning to build a walkway for tourists in the middle of an oak forest. The forest can be represented as plane with N special lattice points representing oaks. The walkway is represented as a rectangle with sides parallel...
31,956
A - Comparison Expressions (BOCOMP) Automated Compilers Manufacture, is developing a new, intelligent compiler. One of the problems its scientists are facing is how to determine whether two expressions are equivalent. An expression consists of one or more alphabetic lowercase letters, representing variables , separat...
31,957
Picking Up Chicks (GCJ101BB) A flock of chickens are running east along a straight, narrow road. Each one is running with its own constant speed. Whenever a chick catches up to the one in front of it, it has to slow down and follow at the speed of the other chick. You are in a mobile crane behind the flock, chasing th...
31,958
B - Esperanto Lessons (BOLESSON) In a Latin American high school the directors had decided to implement Esperanto lessons, because they have observed many of their students started studying the universal language on their own. Because of this, all kids have really different levels before the courses are implemented. T...
31,959
C - Karaoke (BOKO) “But I sing awfully!” - Gonzo kept saying. “Come on! Nobody cares, it just for fun!” – was the common reply of his friends. “And we’ll give you all our support!”. But Gonzo was not convinced. Although he was an accomplished shower singer, he didn’t like to do it in public. He had played karaoke game...
31,960
D - Playing with Marbles (BOMARBLE) PROBLEM D  PLAYING WITH MARBLES Pablo was assigned in his class to construct pentagons inside pentagons with marbles but he doesn’t know how many marbles he will need. He knows that for one pentagon he needs 5 marbles The only way he knows to insert a second pentagon is putt...
31,961
E - Publish of Perish (BOPERISH) “Publish or perish” is the academic life’s fundamental motto. It refers to the fact that publishing your work frequently is the only way to guarantee access to research funds, bright students and career advances. But publishing is not enough. It is necessary that your work is referenc...
31,962
Make it Smooth (GCJ101AB) You have a one-dimensional array of N pixels. Each pixel has a value, represented by a number between 0 and 255, inclusive. The distance between two pixels is the absolute difference of their numbers. You can perform each of the following operations zero or more times: With cost D , ...
31,963
Making Chess Boards (CT101CC) The chess board industry has fallen on hard times and needs your help. It is a little-known fact that chess boards are made from the bark of the extremely rare Croatian Chess Board tree, ( Biggus Mobydiccus ). The bark of that tree is stripped and unwrapped into a huge rectangular sheet o...
31,964
Multiplying by Rotation (MBR) Multiplication of natural numbers in general is a cumbersome operation. In some cases however the product can be obtained by moving the last digit to the front. Example: 179487 × 4 = 717948 Of course this property depends on the number system you use, in the above example we used the ...
31,965
Transform a Sequence (BLOCK) An integer sequence is called block iff it is made of two identical and neighboring sequences. For example, (3, 3) and (5, 2, 5, 2) are blocks, while (9, 6, 6, 9) and (1, 1, 1) are not blocks. An integer sequence is called non-decreasing iff its each element (except the last one) is ...
31,966
Two Paths (TWOPATHS) In Flatland there are N  cities, connected by N-1  two-way roads. The cities are numbered from 1 to N . You can get from one city to another moving along the roads. The "Two Paths" company, has won a tender to repair two paths in Flatland. A path is a sequence of different cities, connected s...
31,967
Paper Fold (PFOLD) Sedrak likes making various things from paper (and he's very good at that). But after he finishes the job, his table is covered with a lot of useless creased, scrappy paper. Can he use them somehow? Imagine a thin strip of paper marked with creases at regular intervals, which we can think of as a ...
31,968
Goldbach graphs (GOLDG) Christian Goldbach sent a letter to Leonhard Euler in 1742 in which he made the following conjecture: " Every even number greater than 4 can be written as the sum of two odd prime numbers. " To find the solutions of Goldbach's conjecture for a given even number n ( n > 0), let us def...
31,969
Coeficientes (COEF) The problem is to calculate the coefficients in expansion of polynomial (x 1 +x 2 +...+x k ) n . Input The input will consist of a set of pairs of lines. The first line of the pair consists of two integers n and k separated with space ( 0 < n, k <13 ). This integers define the power of th...
31,970
Camels (CT14E) Bob likes to draw camels: with a single hump, two humps, three humps, etc. He draws a camel by connecting points on a coordinate plane. Now he's drawing camels with t humps, representing them as polylines in the plane. Each polyline consists of n vertices with coordinates ( x 1 , y 1 ), ( x 2 , y ...
31,971
Nice Quadrangles (CHEFMAY) There are n points with integer coordinates. We can form different quadrangles out of them by taking four different points and connecting them with lines. Let’s call a quadrangle ABCD nice if and only if: Ax > 0 and Ay > 0; Bx > 0 and By < 0; Cx < 0 and Cy < 0; Dx < 0 and Dy > 0; ...
31,972
Sequence Function (SEQFUN) We define a sequence {x}: {x} = {x 0 , x 1 ... x n-1 } where x i is an integer. We have a function f: {x} → {x’} where {x} is a finite sequence. After we have a finite sequence {x}, we can get f({x}) follow these rules : Remove all 0 in x : a 0 b 0 c d 0 e f 0 g → a b c d e f g ...
31,973
Happy Coins (HC) A line of coins are given, some belongs to lxh while others belongs to hhb. Now the two guys are about to play a game. In every round of game, each player can select any two consecutive coins and change them into one coin, if the two coins belongs to the same person, the new one will be gained to hhb,...
31,974
Dinostratus Numbers (DINONUM) Recent archaeological discoveries of researchers from the University of Alberta in Canada showed that a strange sequence of numbers were found on the walls of the pyramids of Egypt, the ruins of Macchu Picchu and the stones of Stonehenge. Intrigued by the apparent coincidence researchers ...
31,975
Can you answer these queries VII (GSS7) Given a tree with N (N ≤ 100000) nodes. Each node has a integer value x i (|x i | ≤ 10000). You have to apply Q (Q ≤ 100000) operations: 1 a b : answer the maximum contiguous sum (maybe empty, will always larger than or equal to 0) from the path a→b (inclusive). 2 a b c...
31,976
Absurd prices (ABSURD) Surely you know that supermarkets, shopping centres, and indeed all kind of vendors seem to have fallen in love with the digit 9 , for that digit occurs most often in the price of a product, preferably at the least significant positions. Your favourite chocolate bar might cost 99 cents, just ...
31,977
Cheating or Not (CHEATING) For the organizers of a soccer world championship the final draw is a very delicate job. It determines the compositions of the groups for the first stage of the tournament and indirectly also the possible matches in the knockout stage. The importance lies in the fact that the success of a te...
31,978
Counter attack (CATTACK) At our soccer training camp, we have rehearsed a lot of motion sequences. In case we are defending, all players except the two strikers of our team are in our half. As soon as we are getting the ball, we are starting a counterattack with a long-range pass to one of our strikers. They know each...
31,979
Capital City (CAPCITY) There are N cities in Flatland connected with M unidirectional roads. The cities are numbered from 1 to N. The Flat Circle of Flatland (FCF) wants to set up a new capital city for his kingdom. For security reasons, the capital must be reachable from all other cities of Flatland. FCF needs the ...
31,980
Yet Another Assignment Problem (ASSIGN5) New semester is coming.  As the class monitor, Cathy Yin is going to make necessary preparations.  She has m jobs to do, n classmates are going to help her.  Each job requires some classmates working on it for certain time, say the i -th classmate must work on the j -th...
31,981
Seller Bob (CFJUN21) Last year Bob earned by selling memory sticks. During each of  n  days of his work one of the two following events took place: A customer came to Bob and asked to sell him a 2 x  MB memory stick. If Bob had such a stick, he sold it and got 2 x berllars. Bob won some programming competition ...
31,982
Flag (CTFLAG) According to a new ISO standard, a flag of every country should have, strangely enough, a chequered field  n × m , each square should be wholly painted one of 26 colours. The following restrictions are set: In each row at most two different colours can be used. No two adjacent squares can be pain...
31,983
Field Plan (FPLAN) World Soccer Championship is coming soon and coach Yogi wants to prepare his team as well as possible. So he made up a strategy field plan for every player of the team. One plan describes a number of possible locations for the player on the field. Moreover, if Yogi wants the player to be able to mov...
31,984
Hacking (HACKING) A coach of one of the soccer world finals teams (lets call him Hugo Hacker) wants to find out secret information about an opposing team before the game. The coach of the opposing team has a website with public information about his team. Hugo suspects that also secret information is stored on the com...
31,985
Last Minute Construction (LMCONSTR) For the upcoming soccer world championship's finals in South Africa the organisation committee has planned a very prestigious project. To take the two teams, which are battling it out for the title, to new heights, the final should take place on a plateau of the "Mafadi", the highe...
31,986
Lineup (LINEUP) On June 13th team Germany has its first match in the FIFA world cup against team Australia. As the coach of team Germany, it is your duty to select the lineup for the game. Given this is your first game in the cup, naturally you want to make a good impression. Therefore you'd like to play with the s...
31,987
Polynomial (POLYNOM) The number of spectators at the FIFA World Cup increases year after year. As you sell the advertisement slots during the games for the coming years, you need to come up with the price a company has to pay in order to get an advertisement slot. For this, you need a good estimate for the number of s...
31,988
Soccer Bets (SBETS) The teams have finished the group stage of the FIFA World Cup and the teams that are in the round of the last sixteen are known. My boss has all of the games analyzed and bets on the whole rest of the tournament by writing the outcome of each match on a single sheet of paper. It was my job to bring...
31,989
Two Ball Game (TBGAME) Lizarb's national soccer team undoubtedly belongs to the group of favourites to win the World Cup at the upcoming championship. Their greatest advantages are their excellent dribbling skills and the ball passing precision. Particularly, each player can pass the ball to every other player on t...
31,990
To Score or not to score (TOSCORE) Robot soccer matches in the very early days were quite funny, since most of the time there wasn't any action in the game. Robots only moved to catch a ball that a robot from the other team had shot. The reason for this somewhat strange behavior was attributed to the used strategy. Th...
31,991
Fence (CT10R3B) We are looking into building a very long fence. We have already found a nice place to build it, and all that remains is to collect the materials. From local hardware stores, we can buy unlimited numbers of wooden boards, each of which can come in a variety of different lengths. To avoid waste, we...
31,992
Fish (CT16E) n fish, numbered from 1 to n , live in a lake. Every day right one pair of fish meet, and the probability of each other pair meeting is the same. If two fish with indexes i and j meet, the first will eat up the second with the probability a ij , and the second will eat up the first with the probability...
31,993
Asistent (ASISTENT) You are given a permutation of first N natural numbers on which you are to perform K operations of following type: given integers A and B, your task is to swap elements on positions A and B in permutation and then output permutation rank modulo 1000 000 007. Note: Difference from original task i...
31,994
Wonkas Oompa-Impa Dilemma (WONKA1) Willy Wonka, the amazing Chocolatier , appears to have a serious predicament at hand. You see, the worker population of his large factory, which consists of 100% Oompa Loompas , is facing a massive decline. This started off because of the fatal accidents in the testing of new Wonka...
31,995
Power Sums (PWSUM) Everyone knows that we can express sums this form as polynomials of degree k+1. Most people find it hard to derive actual formulas for such sums, so we'd like to have a program that does that for us! You are given a non-negative integer K, and you're asked to compute the coefficient representation o...
31,996
Maximum Edge of Powers of Permutation (MEPPERM) For a directed graph G where any vertex v has two weights A v and B v , we call A u + B v the weight of a edge ( u , v ). Let MaxEdge ( G ) be the maximum weight of the edges of G . Given a permutation P on 1.. n , we can derive a directed graph G =( V ...
31,997
Substring Problem (SUB_PROB) String matching is an important problem in computer science research and finds applications in bioinformatics, data mining, pattern recognition, internet security and many more areas. The problem we consider here is a smaller version of it. You are given a string M and N other strings sm...
31,998
Raining Parabolas (RPAR) Nowadays you just can't predict what'll fall on your head the next day. Because we don't care about the nature, it is now striking back: it's raining parabolas! The parabolas that are falling are given in form of quadratic functions: f(x) = ax 2 + bx + c . The ground can be defined as a li...
31,999