task
stringlengths
0
154k
__index_level_0__
int64
0
39.2k
Bee Walk (MBEEWALK) English Vietnamese A bee larva living in a hexagonal cell of a large honey comb decides to creep for a walk. In each “step” the larva may move into any of the six adjacent cells and after n steps, it is to end up in its original cell. Your program has to compute, for a given n, the nu...
31,600
K-th Number (MKTHNUM) English Vietnamese You are working for Macrohard company in data structures department. After failing your previous task about key insertion you were asked to write a new data structure that would be able to return quickly k-th order statistics in the array segment. That is, given ...
31,601
Polynomial Evaluation - Angry Teacher (MPOLEVAL) English Vietnamese Mr. O'Cruel is teaching Math to ninth grade students. Students of course are very lazy, so they do not like to do their homework. On the other side, Mr. O'Cruel doesn't like lazy students.Recently Andrew failed to do his homework again, so...
31,602
Paid Roads (MMINPAID) A 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 a i to city b i : in advance, in a city c i (which may or m...
31,603
Journey with Pigs (MJOURNEY) English Vietnamese Farmer John has a pig farm near town A. He wants to visit his friend living in town B. During this journey he will visit n small villages so he decided to earn some money. He tooks n pigs and plans to sell one pig in each village he visits. Pork prices in vil...
31,604
ELEVATOR II (MELE2) English Vietnamese Edward works as an engineer for Non-trivial Elevators: Engineering, Research and Construction (NEERC). His new task is to design a brand new elevator for a skyscraper with h floors. Edward has an idée fixe: he thinks that four buttons are enough to control the movement...
31,605
Investment Money (MINVEST) John never knew he had a grand-uncle, until he received the notary’s letter. He learned that his late grand-uncle had gathered a lot of money, somewhere in South-America, and that John was the only inheritor. John did not need that much money for the moment. But he realized that it would be...
31,606
Minimax Triangulation (MMINMAX) Triangulation of surfaces has applications in the Finite Element Method of solid mechanics. The objective is to estimate the stress and strain on complex objects by partitioning theminto small simple objects which are considered incompressible. It is convenient to approximate a plane...
31,607
M&M Game (MMMGAME) English Vietnamese Little John is playing very funny game with his younger brother. There is one big box filled with M&Ms of different colors. At first John has to eat several M&Ms of the same color. Then his opponent has to make a turn. And so on. Please note that each player has to...
31,608
Convert to Decimal Base System (MCONVERT) Life can be taught, but sometimes simple problems are just very well hidden among difficult ones. Once identifying those simple problems you are almost on a half way of solving them as well as making one big step towards winning the contest. Just be careful, this is NOT the si...
31,609
Stargates (STARGATE) English Vietnamese "A Long Time Ago, in a Galaxy Far, Far Away..." one advanced civilization discovered a manner of instant traveling between solar systems. Since that moment, they have devoted all their efforts to constructing pairs of stargates that connect distant planets. Soon enou...
31,610
0 0 Pairs (M00PAIR) English Vietnamese A sequence consisting of one digit, the number 1 is initially written into a computer. At each successive time step, the computer simultaneously transforms each digit 0 into the sequence 1 0 and each digit 1 into the sequence 0 1. So, after the first ti...
31,611
Another Tree Problem (MTREE) English Vietnamese As you are bound to know by now, a tree is a connected graph consisting of N vertices and N−1 edges. Trees also have the property of there being exactly a single unique path between any pair of vertices. You will be given a tree i...
31,612
Most Servings Meal (MKUHAR) English Vietnamese Lisa works as a waitress in a restaurant. Tonight is her birthday so Lisa asked the chef to prepare his special meal for her friends. The chef's meal is made of N ingredients. To prepare one serving of the meal he needs a certain amount of each ingredient. T...
31,613
Police Query (POLQUERY) To help capture criminals on the run, the police are introducing a new computer system. The area covered by the police contains N cities and E bidirectional roads connecting them. The cities are labelled 1 to N . The police often want to catch criminals trying to ...
31,614
Distance Query (DISQUERY) The traffic network in a country consists of N cities (labeled with integers from 1 to N) and N-1 roads connecting the cities. There is a unique path between each pair of different cities, and we know the exact length of each road. Write a program that will, for each of the K given pairs o...
31,615
Whirligig number (MZVRK) English Vietnamese By removing all digits left of the rightmost digit one in the binary representation of some integer, we get what is called the "whirligig" of that number. For example, the whirligig of 6 i.e. (110) 2 is 2 i.e. (10) 2, and the whirligig of 40 i.e. (101000) 2 is 8 i....
31,616
Point Visible (MPOINT) N points are given in a plane. Any point has integer coordinates and no two points have the same x coordinates or the same y coordinates. A pair of points A and B uniquely define a rectangle R(A,B) whose sides are parallel to coordinate axes such that the points A and B are endpoints of one ...
31,617
Shortest Regular Bracket (MBRACKET) English Vietnamese Lets observe sequences made only of round and square brackets, i.e. characters '( ) [ ]'. A sequence of brackets is regular if it satisfies this inductive definition: '( )' and '[ ]' are regular sequences. If A is regular, then (A) and [A] are...
31,618
String problem (MSTRING) English Vietnamese Substring of some string A is defined as one or more (not necessarily consecutive) elements of the string while maintaining the order. There are given two strings, string VOKI and string TOKI. Write the program that will calculate the length of any shortest substrin...
31,619
Right Triangle Counting (RIGHTTRI) N points are placed in the coordinate plane. Write a program which calculates in how many ways a right triangle can be formed by three of the given points. A right triangle is one in which one of the angles is 90 degrees. Input The first line of input contains an integer N (3 ≤ N...
31,620
FROGGER (FROGGER) “Frogger” was one of the first really popular arcade games after it was introduced by SEGA in 1981. The game consists of helping a frog cross a multi-lane motorway without getting run over by a car. You are given a view of an n-lane motorway where each lane consists of m different spaces that can ei...
31,621
GALLUP (GALLUP) Often, we see results of gallups, like this: Prefer red: 3.5% Prefer green: 4.5% Prefer yellow: 22.0% Prefer blue: 70.0% and you begin to wonder: how many people did they really ask? If the numbers are simple, like 20%, 40%, and 40%, you know that they asked 5 people (or 10, or 15, or more, but we...
31,622
Subway planning (SUBWAYPL) The government in a foreign country is looking into the possibility of establishing a subway system in its capital. Because of practical reasons, they would like each subway line to start at the central station and then go in a straight line in some angle as far as necessary. You have been h...
31,623
Exploding CPU (CPU) The well known hardware manufacturing company Processors for Professors is about to release a highly specialized CPU with exceptional functionality in, amongst other areas, number theory. It has, for example, an instruction PFACT that takes one parameter and returns all prime factors of that parame...
31,624
Con Voi (MCONVOI) English Vietnamese An elephant lives by a lake with N plants on the surface. The lake can be modeled by a coordinate plane, with plants at points with integer coordinates. Every morning after waking up, the elephant performs his morning exercise, happily jumping from pl...
31,625
Chặt cây (OPTCUT) English Vietnamese You have to cut a piece of wood into n smaller pieces, each piece is of length a i . The pieces must be cut in order exactly a 1 , a 2 ... a n from left to right. At each step, you may cut a piece into two smaller pieces. The cost for that cut is the length of the p...
31,626
Bipalindrome (MBIPALIN) English Vietnamese Pero and Slavko are two students who love math. Pero is very creative and often comes up with new ideas. Slavko later spends days thinking about Pero's ideas. One day Pero and Slavko learned what a palindrome was: a string read the same in either direction (...
31,627
Mass of Molecule (MMASS) English Vietnamese A molecule can be defined as a sequence of atoms and represented by a chemical formula consisting of letters denoting these atoms. E.g. letter H denotes atom of hydrogen, C denotes atom of carbon, O denotes atom of oxygen, formula COOH represents molecule consistin...
31,628
Phone List (PHONELST) Phone List Given a list of phone numbers, determine if it is consistent in the sense that no number is the prefix of another. Let’s say the phone catalogue listed these numbers: Emergency 911 Alice 97 625 999 Bob 91 12 54 26 In this case, it’s not possible to call Bob, because t...
31,629
Pizza Delivery (MDOSTAVA) English Vietnamese   Little Ivica recently got a job delivering pizzas for the most popular pizzeria in town. At the start of his work day, he receives a list with the locations to which he needs to deliver pizzas, in order in which the locations are given. The city is divid...
31,630
NERED (MNERED) English Vietnamese In the nearby kindergarten they recently made up an attractive game of strength and agility that kids love. The surface for the game is a large flat area divided into N×N squares. The children lay large spongy cues onto the surface. The sides of the cubes are the same len...
31,631
Cuckoo Hashing (CUCKOO) One of the most fundamental data structure problems is the dictionary problem: given a set D of words you want to be able to quickly determine if any given query string q is present in the dictionary D or not. Hashing is a well-known solution for the problem. The idea is to create a f...
31,632
Counting The Way of Bracket Replacement (MREPLBRC) English Vietnamese A regular bracket sequence is a string of characters consisting only of opening and closing brackets, and satisfying the following conditions: An empty string is a regular bracket sequence. If A is a regular bracket0sequence, then ...
31,633
Game (MGAME1) English Vietnamese Note: C, S, B are used instead of H, F, I, respectively, in test case. Hal and Dave are playing an interesting game on a rectangular chess-like board consisting of squares arranged in R rows and C columns. Here are the rules of the game: There is only one piece on a board a...
31,634
Card Sorting (MCARDS) English Vietnamese   Dave’s little son Maverick likes to play card games, but being only four years old, he always lose when playing with his older friends. Also, arranging cards in his hand is quite a problem to him. When Maverick gets his cards, he has to arrange them in groups ...
31,635
A game with probability (KPGAME) Alice and Bob play the following game. First, they collect N small stones and put them together in one pile. After that, they throw a coin one by one. Alice starts first. If a player throws heads then he takes exactly one stone from the pile. In case of tails he don't do anything. Th...
31,636
Polygon (MPOLY) There are N points in a plane whose coordinates are natural numbers. A convex polygon with maximal number of vertices is a convex polygon whose vertices are some of given points and the origin having maximal possible number of vertices. Origin, i.e. point with coordinates (0, 0), must be one of ver...
31,637
Rob Mini-Safe (MSAFE) English Vietnamese Mirko has decided to rob mini-safe owned by his son so that he could take away some football stickers which are missing in his big sticker collection. Lock on the safe consists of N equal discs, each of them being divided in 10,000,000 equal segments numbered from 1 t...
31,638
Sell Pigs (MPIGS) English Vietnamese Mirko works on a pig farm that consists of M locked pig-houses and Mirko can't unlock any pig-house because he doesn't have the keys. Customers come to the farm one after another. Each of them has keys to some pig-houses and wants to buy a certain number of pigs. ...
31,639
Morphing is Fun (MORPH) Morphic is a tree that grows very rapidly, bringing happiness to its owner. It has a single trunk consisting of a number of cells stacked one on top of another. Each cell has one of n possible colors which determine the way it mutates during the night, while nobody can see it. Florists denote...
31,640
Two Professors (TWOPROF) There are two professors at the great Academy of X that really do not get along with each other. In order not to reveal their names, we will call them 1 and 2. The Academy employs exactly n professors, each of them has to give exactly one lecture. As their schedules are rather tight (they are ...
31,641
BLAST (MBLAST) English Vietnamese There are given two strings, A and B. An expansion of some string X is a string created by adding or inserting any number (zero, one or more) of blanks anywhere in the string, or in the begining or the end of the string. Eg., if the string X is ‘abcbcd’, then the strings 'abcb...
31,642
Tele Broadcast (MTELE) English Vietnamese A TV-network plans to broadcast an important football match. Their network of transmitters and users can be represented as a tree. The root of the tree is a transmitter that emits the football match, the leaves of the tree are the potential users and other vertice...
31,643
Locomotive (MTRAIN) Mirko and Slavko have finally gotten jobs as locomotive drivers on the Croatian Railroad. As early as the first day of work, they got an assignment. Each of them was to take their locomotive from a certain town and visit as many towns as possible. Mirko is an experienced driver, so he is afrai...
31,644
Sum of Vectors (MVECTOR) English Vietnamese We can represent a 2D vector as a pair (X, Y). The sum of two or more vectors is a vector whose coordinates are the sums of the corresponding coordinates of all the vectors in the sum. e.g. (1, 2) + (3, 4) + (5, 6) = (1 + 3 + 5, 2 + 4 + 6) = (9, 12) Weight of a v...
31,645
Extend to Palindrome (EPALIN) Your task is, given an integer N, to make a palindrome (word that reads the same when you reverse it) of length at least N (1 <= N <= 100,000). Any palindrome will do. Easy, isn't it? That's what you thought before you passed it on to your inexperienced team-mate. When the contest is ...
31,646
Fast Maximum Flow (FASTFLOW) Given a graph with N (2 ≤ N ≤ 5,000) vertices numbered 1 to N and M (1 ≤ M ≤ 30,000) undirected, weighted edges, compute the maximum flow / minimum cut from vertex 1 to vertex N. Input The first line contains the two integers N and M. The next M lines each contain three integers A, B...
31,647
Euler Totient Function (ETF) English Vietnamese In number theory, the totient φ of a positive integer n is defined to be the number of positive integers less than or equal to n that are coprime to n. Given an integer n (1 ≤ n ≤ 10 6 ). Compute the value of the totient φ. Input First line contains a...
31,648
Ellipse (ELLIPSE) Given 5 points on a ellipse, calculate the area of the ellipse. We accept solutions with absolute error less than 10 -6 or relative error less than 10 -9 . Input Many test cases. Each contains a line with 10 integers with absolute value less than 1000 - the X and Y coordinates of the 5 points, ...
31,649
IZBORI (IZBORI) English Vietnamese It is election time. V voters attend the election, each casting their vote for one of N political parties. M officials will be elected into the parliament. The conversion from votes to parliament seats is done using the D'Hondt method with a 5% threshold. More precisely, ...
31,650
OTOCI (OTOCI) English Vietnamese Some time ago Mirko founded a new tourist agency named "Dreams of Ice". The agency purchased N icy islands near the South Pole and now offers excursions. Especially popular are the emperor penguins, which can be found in large numbers on the islands. Mirko's agency has become a...
31,651
PLAHTE (PLAHTE) English Vietnamese Mirko washed his sheets and is on his way to hang them to dry in front of his house. However, strong winds have pulled the clothesline out of the ground so Mirko temporarily laid out the sheets on the grass. The grass field can be modeled by an infinite square grid, where eve...
31,652
Domino (DOMINO2) You have an n × m rectangle, some cells have some obstacles in. A domino piece is a 1 × 2 or 2 × 1 rectangle. You're going to place some domino pieces in this rectangle so that there's no empty cell is covered more than once and no cell with obstacles is covered. For some unknown reason, you have ...
31,653
A1 Road (MA1) Our country needs to be connected by highways that need to be repaired every once in a while. A committee chosen by the government of our country tries to continually improve the condition of the main highway imaginatively named “A1” by finding the first damage that needs to be fixed. Starting wit...
31,654
A conjecture of Paul Erdős (HS08PAUL) In number theory there is a very deep unsolved conjecture of the Hungarian Paul Erdős (1913-1996), that there exist infinitely many primes of the form x 2 +1, where x is an integer. However, a weaker form of this conjecture has been proved: there are infinitely many primes of t...
31,655
Four colors (HS08FOUR) Let there be given n points: P 1 , P 2 ... P n arranged in this order on a line. We would like to color them using four colors: white, black, red, and blue, in such a way that for every three consecutive points it is true that either: 1. the colors of these three points are pairwise dist...
31,656
Square-free integers (SQFREE) In number theory we call an integer square-free if it is not divisible by a perfect square, except 1. You have to count them! Input First line contains an integer T , the number of test cases ( T ≤100). The following T lines each contains one positive integer: n , where n ≤ 10 14...
31,657
Multiplicative digital root (DROOT) For an integer find the multiplicative digital root of it! Multiple all nonzero digits of that number and repeat this process until it is only a single digit. We call that digit the multiplicative digital root of the number. For example the multiplicative digital root of n = 2009 ...
31,658
A Knightly Pursuit (KPURSUIT) In chess, game pieces move about an chessboard in a fashion defined by their type. The object of the game is to capture opposing pieces by landing on their squares, and eventually trapping the king piece. In our version of the game, we shall use a variable sized board with only 2 pieces...
31,659
Herding (HERDING) Oh no! A number of stray cats have been let loose in the city, and as the City Cat Catcher, you have been assigned the vital task of retrieving all of the cats. This is an ideal opportunity to test your latest invention, a cat trap which is guaranteed to retrieve every cat which walks into a square-s...
31,660
Distance on a square lattice (LATTICE) Let L to be an n×n square lattice, you can consider its points as (x, y) , where x and y are integers from the [1, n ] interval. And let f( n ) to be the expected distance between two not necessarily distinct points on the lattice. For example f(1)=0 and f(2)=(2 + √  2...
31,661
Temptation Island (TEMPTISL) On Monday, the number of frosh were reduced in half. To further reduce the number of engineers to a manageable number, the following challenge was devised for the second day. Each of the students would have to take this challenge individually. Each student would be placed at a vertex o...
31,662
Pizza Location (PIZZALOC) English Vietnamese Our friend Picko is very reach and he wants to open lots of restaurants with delivery. The main food will be, of course, pizza. He has certain number of potential locations for the restaurants, and he knows the locations of the solitairs with lots of people wh...
31,663
MELE3 (MELE3) English Vietnamese Solitaire has N elevators. Each elevator are connecting exactly two floors and it does not stop on the floors between that two floors The speed of all the elevators are the same, 5 seconds to pass one floor. On the beginning, each elevator is in its lower position and they are ...
31,664
Candy (Again) (FCANDY) You and a friend have a big bag of candy. You want to keep slim and trim, and so you would like to equalize the candy which you are sharing with your friend in terms of calorie count. That is, your task is to divide the candies into two groups such that the number of calories in each group is as...
31,665
Cube (CCCCUBE) Imagine a cube formed from solid interlocking pieces of various shapes. If the pieces are sufficiently intertwined, the only way to separate them would be to cut some of them. We can ask the question, "is the cube stable?" That is, is it physically impossible to separate the cube into 2 or more fragment...
31,666
Break a New RSA system (HS08CODE) Today, Gerrob's RSA company has featured a New RSA cryptosystem: its public key is n , the secret keys are three distinct primes p , q and r , where n = p * q * r . Note that the ordinary RSA uses only 2 primes! Unfortunately some hackers have stolen a DVD from the company. It d...
31,667
Amazing equality (HS08EQ) The definition of a perfect number is about 2300 years old. A perfect number is defined as a positive integer which is the sum of its proper positive divisors, that is, the sum of the positive divisors excluding the number itself. What can we get if, in the sum, we replace each divisor by i...
31,668
Landing (LANDING) Keep watching the skies! Alien spacecraft are due to land any day now to share all of their advanced programming secrets with us. In preparation for this day, you've been asked with preparing a landing pad for our visitors in a given field. Unfortunately, due to environmental considerations, you wi...
31,669
Sky Code (MSKYCODE) English Vietnamese Stancu likes space travels but he is a poor software developer and will never be able to buy his own spacecraft. That is why he is preparing to steal the spacecraft of Petru. There is only one problem – Petru has locked the spacecraft with a sophisticated cryptosystem ...
31,670
Another Lucky Numbers (MSE08G) English Vietnamese John has recently arrived in Bucharest for the South Eastern European Regional Contest. John is famous for his theory of lucky numbers. That’s why all the contestants and spectators are very happy. According to that theory 4 and 7 are lucky digits, and al...
31,671
GCD Determinant (MSE08H) English Vietnamese We say that a set S = {x1, x2, …, xn} is factor closed if for any xi ∈ S and any divisor d of xi we have d ∈ S. Let’s build a GCD matrix (S) = (sij), where sij = GCD(xi, xj) – the greatest common divisor of xi and xj. Given the factor closed set S, find the...
31,672
Dominoes (DOMINOES) Johnny is playing with some dominoes one afternoon. His dominoes come in a variety of heights and colors. Just like any other child, he likes to put them in a row and knock them over. He wants to know something: how many pushes does it take to knock down all the dominoes? Johnny is lazy, so he wa...
31,673
Lego (LEGO) It's Christmas morning, and you've got what you wanted: a box of Lego™! (Okay, maybe not, but better than nothing) Lego is pretty fun to tinker with, and you've decided to build some sort of shape. (For the sake of this problem, let's say your shape is basically 2-dimensional - it'll be a slab) But ...
31,674
Hamster flight (HAMSTER1) There is a competition of flying hamsters in Hamsterburg. Each competing hamster is thrown from a sling. The judges rate the flight according to its length and height. Let X meters be the distance of the flight, and Y meters – maximum height to which the hamster rose during the flight. The ha...
31,675
Coder Ratings (RATING) Some of the more elite (and not-so-elite) coders around take part in a certain unnamed programming contest. In said contest, there are multiple types of competitions. Here, we consider the Open and High School competition types. For each type, each competitor receives a rating , an integer betw...
31,676
Brackets Parade (BRPAR) Count the number of different correct bracket sequences consisting of k1 pairs of brackets of the 1st type, k2 pairs of brackets of the 2nd type … km pairs of brackets of the m-th type. The bracket sequence is considered correct in the following cases: empty sequence is correct; if A is correct...
31,677
Double Queue (MSE07B) English Vietnamese The new founded Balkan Investment Group Bank (BIG-Bank) opened a new office in Bucharest, equipped with a modern computing environment provided by IBM Romania, and using modern information technologies. As usual, each client of the bank is identified by a positive i...
31,678
Showstopper (MSE07E) Data-mining huge data sets can be a painful and long lasting process if we are not aware of tiny patterns existing within those data sets. One reputable company has recently discovered a tiny bug in their hardware video processing solution and they are trying to create software workaround. To ...
31,679
Fast Maximum Matching (MATCHING) FJ has N (1 ≤ N ≤ 50,000) cows and M (1 ≤ M ≤ 50,000) bulls. Given a list of P (1 ≤ P ≤ 150,000) potential matches between a cow and a bull, compute the greatest number of pairs that can be matched. Of course, a cow can be matched to at most one bull, and vice versa. Input The firs...
31,680
Fast Maximum Matching (FMATCH) English Vietnamese FJ has N (1 ≤ N ≤ 50,000) cows and M (1 ≤ M ≤ 50,000) bulls. Given a list of P (1 ≤ P ≤ 150,000) potential matches between a cow and a bull, compute the greatest number of pairs that can be matched. Of course, a cow can be matched to at most one bull, and vice ve...
31,681
Fast Maximum Flow (FFLOW) English Vietnamese Given a graph with N (2 ≤ N ≤ 5,000) vertices numbered 1 to N and M (1 ≤ M ≤ 30,000) undirected, weighted edges, compute the maximum flow / minimum cut from vertex 1 to vertex N. Input The first line contains the two integers N and M. The next M lines each conta...
31,682
Another Longest Increasing Subsequence Problem (LIS2VN) English Vietnamese Given a sequence of N pairs of integers, find the length of the longest increasing subsequence of it. An increasing sequence A 1 ..A n is a sequence such that for every i < j , A i < A j . A subsequence of a sequence is...
31,683
Payment System (MSE06E) The payment system in the University of Mineral Water Production is completely automated (written entirely in Tomato Programming Language) and lets you input the amount of money you want to withdraw. Due to the high payment rates of the professors they may input the amounts in exponential f...
31,684
Japan (MSE06H) English Vietnamese Japan plans to welcome the ACM ICPC World Finals and a lot of roads must be built for the venue. Japan is tall island with N cities on the East coast and M cities on the West coast (M ≤ 1000, N ≤ 1000). K superhighways will be build. Cities on each coast are numbered 1, 2, ...
31,685
"Shortest" pair of paths (MSE06I) A chemical company has an unusual shortest path problem. There are N depots (vertices) where chemicals can be stored. There are M individual shipping methods (edges) connecting pairs of depots. Each individual shipping method has a cost. In the usual problem, the company would nee...
31,686
Wandering Queen (QUEEN) There is a checkmates board with n rows and m columns. Some of the cells of the board are occupied. There is a queen standing on a certain cell. It wants to move to another cell of this board. Help it do this making the least possible moves. The queen can go any number of cells in any of ei...
31,687
Pilots (MPILOT) English Vietnamese Charlie acquired airline transport company and to stay in business he needs to lower the expenses by any means possible. There are N pilots working for his company (N is even) and N/2 plane crews needs to be made. A plane crew consists of two pilots - a captain and his as...
31,688
Train TimeTable (TTTABLE) A train line has two stations on it, A and B. Trains can take trips from A to B or from B to A multiple times during a day. When a train arrives at B from A (or arrives at A from B), it needs a certain amount of time before it is ready to take the return journey - this is the turnaround time....
31,689
rotate it (BFROTATE) Rotate the given string starting at the given place from the end with wrapping around at the end. You are allowed to use only BrainFck! Input Given an integer of strictly 2 digits and a string (length <= 99) in the same line without space between them. You may assume that the string consists o...
31,690
Battlefield (FIELD) The Ministry of Defence (MoD) of Mighty Mouse Kingdom (MMK) needs to arrange defence forces in a battlefield to prevent possible attacks of Catland's army. The battlefield is a square grid of N rows and N columns. The cell in the i th row and j th column is denoted by (i,j), with 0 ≤ i, j ≤ N-1. ...
31,691
Rectangles (AE00) Byteman has a collection of N squares with side 1. How many different rectangles can he form using these squares? Two rectangles are considered different if none of them can be rotated and moved to obtain the second one. During rectangle construction, Byteman can neither defo...
31,692
(K,N)-Knight (AE2B) Bytean chess is one of the most peculiar variants of chess in the world. Playing each match is a major difficulty, because the game is played on an infinite chessboard. The basic ability learnt by young enthusiasts of Bytean chess is considering all possible situations on a chessboard after m...
31,693
Dice (AE2A) Jack claims that he has telekinetic powers. He has made a bet with Mike that he would throw a die n times and would get exactly k pips in total. Jack's die has 6 faces with numbers from 1 to 6 written on them and is perfectly symmetric. Mike does not believe in Jack's telekinetic powers (in general, bei...
31,694
Drilling (AE3A) Byteman is the person in charge of a team that is looking for crude oil reservoirs. He has made two boreholes: he found crude oil in point A and found out that there is no crude oil in point B. It is known that the oil reservoir occupies a connected fragment of segment AB with one end at point A. Now...
31,695
The way to Bytemountain (AE4B) Byteman woke up early this morning, just after dawn. He is planning to get to the top of Bytemountain, so the spent the night in a mountain hostel right in the middle of picturesque mountain range of Lower Bytehills. Since Bytemountain in the highest mountain of the range, at each trai...
31,696
Stamps (AE4A) Little Johnny is playing with his small magical stamp, trying to draw a bunny on a piece of paper that is a square k by k divided into unit squares with side 1. Johnny’s stamp is a square with side 3 and consists of smaller squares with side 1. Exactly two of these squares are protuberant. Moreover, bo...
31,697
Byteantean towns (AE5B1) “Segment is the shortest path connecting two points” — this motto was the main motivation for road designers in the Byteantean Empire. For this reason all roads constructed in the Empire were straight and led across the whole country. At each crossing of two roads Byteanteans planted a town....
31,698
Circular game (AE5A1) English Vietnamese In the ”circular game” the board consists of m fields arranged on a circle and numbered from 1 to m. On the board there are b white and c black pieces, at most one on each field. Two players are playing the game, the white player and the black player. Starting from ...
31,699