task stringlengths 0 154k | __index_level_0__ int64 0 39.2k |
|---|---|
Query on a tree (QTREE)
You are given a tree (an acyclic undirected connected graph) with
N
nodes, and edges numbered 1, 2, 3...
N
-1.
We will ask you to perfrom some instructions of the following form:
CHANGE i ti
: change the cost of the i-th edge to ti
or
QUERY a b
: ask for the maximum edge cost on t... | 30,900 |
A concrete simulation (ACS)
You are given a matrix M of type 1234×5678. It is initially filled with integers 1...1234×5678 in row major order. Your task is to process a list of commands manipulating M. There are 4 types of commands:
"R x y" swap the x-th and y-th row of M;
"C x y" swap the x-th and y-th colum... | 30,901 |
Taxi (TAXI)
In New Town all streets are built as straight lines intersecting at right angles at fixed distances, with the distance between intersections being a fixed 200 meters (see picture below).
One of of the major events in New Town is the New Town Festival and nearly everybody wants to get a ticket. To give ... | 30,902 |
Ambiguous Permutations (PERMUT2)
Some programming contest problems are really tricky: not only do they
require a different output format from what you might have expected, but
also the sample output does not show the difference. For an example,
let us look at permutations.
A
permutation
of the integers
1
to
... | 30,903 |
Bullshit Bingo (BINGO)
Bullshit Bingo is a game to make lectures, seminars or meetings less
boring.
Every player has a card with 5 rows and 5 columns. Each of the 25 cells
contains
a word (the cell in the middle has always the word "BINGO"
written in it).
Whenever a player hears a word which is written on his ca... | 30,904 |
106 miles to Chicago (CHICAGO)
In the movie "Blues Brothers", the orphanage where Elwood and Jake were raised may be sold to the Board of Education if they do not pay 5000 dollars in taxes at the Cook County Assessor's Office in Chicago. After playing a gig in the Palace Hotel ballroom to earn these 5000 dollars, they... | 30,905 |
Decorate the wall (DECORATE)
After building his huge villa, Mr. Rich cannot help but notice that
the interior walls
look rather blank. To change that, he starts to hang paintings from
his wonderful collection.
But soon he realizes that it becomes quite difficult to find a place on
the wall where a painting
can b... | 30,906 |
European railroad tracks (EUROPEAN)
As you may already know, different countries in Europe use different railroad systems. Not only do they use different voltages for their trains, but also the distance between the two rails (gauge) differs. The following table shows some railway gauges used:
Broad gauge (Spai... | 30,907 |
Any fool can do it (FOOL)
Surely you know someone who thinks he is very clever. You decide to
let him
down with the following problem:
"Can you tell me what the syntax for a set is?", you ask him.
"Sure!", he replies, "a set encloses a
possibly empty list
of elements within two curly braces. Each element i... | 30,908 |
Game schedule required (GAME)
Sheikh Abdul really loves football. So you better don't ask how much
money he has spent to make famous teams join the annual tournament.
Of course, having spent so much money, he would like to see certain
teams play each other. He worked out a complete list of games
he would like to s... | 30,909 |
Help the problem setter (HELP)
Preparing a problem for a programming contest takes a lot of time.
Not only do you have to write the problem description and write a
solution, but you also have to create difficult input files.
In this problem, you get the chance to help the problem setter
to create some input for a ... | 30,910 |
Travelling tours (TOURS)
In Hanoi, there are N beauty-spots (2 ≤ N ≤ 200), connected by M one-way streets. The length of each street does not exceed 10000. You are the director of a travel agency, and you want to create some tours around the city which satisfy the following conditions:
Each of the N beauty-spots b... | 30,911 |
Menu (MENU)
Alfred wants to plan what to cook in the next days. He can cook various dishes. For each dish the costs of the ingredients and the benefit value is known. If a dish is cooked the second time in a row, the benefit value for the second time is 50 percent of the benefit value of first time, if it is prepared ... | 30,912 |
Use of Hospital Facilities (HOSPITAL)
County General Hospital is trying to chart its course through the troubled waters of the economy and shifting population demographics. To support the planning requirements of the hospital, you have been asked to develop a simulation program that will allow the hospital to evaluate... | 30,913 |
Billiard (BILLIARD)
In a billiard table with horizontal side
a
inches and vertical side
b
inches, a ball is launched from the middle of the table. After
s
> 0 seconds the ball returns to the point from which it was launched, after having made
m
bounces off the vertical sides and
n
bounces off the horizontal ... | 30,914 |
Railroads (RAILROAD)
It's Friday evening and Jill hates two things which are common to all trains:
They are always late.
The schedule is always wrong.
Nevertheless, tomorrow in the early morning hours Jill will have to travel from Hamburg to Darmstadt in order to get to the regional programming contest. ... | 30,915 |
Spin (SPIN)
The classic Chinese Rings puzzle comes in a variety of forms. The original version has seven rings linked together by a sliding loop threaded through them. The aim is to remove the loop by manipulating the rings.
A modern implementation uses seven disks with specially shaped cut-outs mounted on a sli... | 30,916 |
Hexagon (HEXAGON)
Consider a game board consisting of 19 hexagonal fields, as shown in the figure below. We can easily distinguish three main directions in the shape of the board: from top to bottom, from top-left to bottom-right, and from top-right to bottom-left. For each of these primary directions, the board can b... | 30,917 |
Alphacode (ACODE)
Alice and Bob need to send secret messages to each other and are discussing ways to encode their
messages:
Alice:
“Let’s just use a very simple code: We’ll assign ‘A’ the code word 1, ‘B’ will be 2,
and so on down to ‘Z’ being assigned 26.”
Bob:
“That’s a stupid code, Alice. Suppose I ... | 30,918 |
Anti-prime Sequences (APRIME)
Given a sequence of consecutive integers n, n+1, n+2 ... m, an anti-prime sequence is a rearrangement
of these integers so that each adjacent pair of integers sums to a composite (non-prime) number. For
example, if n = 1 and m = 10, one such anti-prime sequence is 1, 3, 5, 4, 2, 6, 9, 7... | 30,919 |
Hit or Miss (HITOMISS)
One very simple type of solitaire game known as “Hit or Miss” (also known as “Frustration”, “Harvest”,
“Roll-Call”, “Talkative”, and “Treize”) is played as follows: take a standard deck of 52 playing cards —
four sets of cards numbered 1 through 13 (suits do not matter in this game) which have... | 30,920 |
I Conduit (CONDUIT)
Irv Kenneth Diggit works for a company that excavates trenches, digs holes and generally tears up
people’s yards. Irv’s job is to make sure that no underground pipe or cable is underneath where
excavation is planned. He has several different maps, one for each utility company, showing where their... | 30,921 |
Roll Playing Games (RPGAMES)
Phil Kropotnik is a game maker, and one common problem he runs into is determining the set of dice to use in a game. In many current games, non-traditional dice are often required, that is, dice with more or fewer sides than the traditional 6-sided cube. Typically, Phil will pick random va... | 30,922 |
Team Rankings (TRANK)
It’s preseason and the local newspaper wants to publish a preseason ranking of the teams in the local
amateur basketball league. The teams are the Ants, the Buckets, the Cats, the Dribblers, and the
Elephants. When Scoop McGee, sports editor of the paper, gets the rankings from the selected loc... | 30,923 |
To and Fro (TOANDFRO)
Mo and Larry have devised a way of encrypting messages. They first decide secretly on the number of
columns and write the message (letters only) down the columns, padding with extra random letters so
as to make a rectangular array of letters. For example, if the message is “There’s no place lik... | 30,924 |
Translations (TRANSL)
Bob Roberts is in charge of performing translations of documents between various languages. To aid
him in this endeavor his bosses have provided him with translation files. These files come in twos — one
containing sample phrases in one of the languages and the other containing their translatio... | 30,925 |
Hike on a Graph (HIKE)
"Hike on a Graph" is a game that is played on a board on
which an undirected graph is drawn. The graph is complete and has
all loops, i.e. for any two locations there is exactly one arrow
between them. The arrows are coloured. There are three players, and
each of them has a piece. At the beg... | 30,926 |
Sort fractions (FRACTION)
You are given a positive integer N. Let us consider set A of fractions x/y where 0 ≤ x/y ≤ 1, y ≤ N and the maximum common divisor of x and y is 1.
For example N = 5. Set A in increasing order consists of elements 0/1; 1/5; 1/4; 1/3; 2/5; 1/2; 3/5; 2/3; 3/4; 4/5; 1/1.
Your task is to... | 30,927 |
Scanner (SCANNER)
A body scanner works by scanning a succession of horizontal slices through
the body; the slices are imaged one at a time. The image slices can be
reassembled to form a three dimensional model of the object. Write a
program to construct a two dimensional image slice using data captured
during the ... | 30,928 |
Tin Cutter (TCUTTER)
In a Tin Cutting factory there is a machine for cutting parts from tin plates. It has an
extraordinarily sharp knife able to make horizontal or vertical segment cuts in the tin plates. Each
cutting process consists of a sequence of such cuts. Each segment cut is given by its endpoints that
are ... | 30,929 |
Logic (LOGIC)
Consider a 10x10 grid. Cells in this grid can contain one of
five logic operations (AND, OR, NOT,
Input, Output). These can be joined together to form a logic circuit.
Given a description of a circuit
and a set of boolean values, build the logic circuit and execute the input
stream against it.
... | 30,930 |
Random Number (RNUMBER)
A Black Box algorithm supposes that natural number sequence
u(1), u(2) ... u(N)
is sorted
in non-descending order,
N ≤ M
and for each
p
(
1 ≤ p ≤ N
) an inequality
p ≤ u(p) ≤ M
is valid.
Making tests for this algorithm we have met with the following problem. For setting a random seq... | 30,931 |
Jill Rides Again (JRIDE)
Jill likes to ride her bicycle, but since the pretty city of Greenhills
where she lives has grown, Jill often uses the
excellent public bus system for part of her journey. She has a folding
bicycle
which she carries with her when she
uses the bus for the first part of her trip. When the b... | 30,932 |
DEL Command (DELCOMM)
It is required to find out whether it is possible to delete given files
from MS-DOS directory
executing the DEL command of MS-DOS operation system only once.
There are no nested subdirectories.
A note
DEL command has the following format:
DEL
wildcard
The actual wildcard as well a... | 30,933 |
Variable Radix Huffman Encoding (VHUFFM)
Huffman encoding is a method of developing an optimal encoding of the symbols
in a
source alphabet
using symbols from a
target alphabet
when the frequencies
of each of the symbols in the source alphabet are known. Optimal means the
average length of an encoded message wi... | 30,934 |
Number of quite different words (NUMQDW)
Let's consider the alphabet consisting of the first
c
roman uppercase letters, i.e. {A, B, C, D, E, F} if
c
is 6.
We will call two words
quite different
, if there is no common subsequence of length more than one between those two words. For example ABC and CBA are qui... | 30,935 |
K-path cover (COVER)
Problem
K-path cover of a directed graph is a set of exactly k of its edges chosen in such way that every two of them have different start vertices and every two of them have different end vertices. Assuming that for each vertex we know its cost we can define cost of the edge as a sum of costs... | 30,936 |
Word Puzzles (WPUZZLES)
Word puzzles are usually simple and very entertaining for all ages.
They are so entertaining that Pizza-Hut company started using table
covers with word puzzles printed on them, possibly with the intent to
minimise their client's perception of any possible delay in bringing
them their order... | 30,937 |
Equatorial Bonfire (BONFIRE)
Some great ideas are never implemented. This was the case with the
equatorial bonfire planned for the millenial celebration. Maybe the plan
will be rediscovered for the next turn of millenia. Before it is
completely forgotten we will tell you about it:
The idea was to put tarred logs a... | 30,938 |
Divisibility by 15 (DIV15)
There is a string containing only decimal digit characters. The length of the string is between
1
and
1000
. Using characters of the string, you have to construct the maximum number which divides by fifteen without remainder. Each character of the string may not be used more than once.
... | 30,939 |
The lazy programmer (LAZYPROG)
A new web-design studio, called SMART (Simply Masters of ART), employs two people. The first one is a web-designer and an executive director at the same time. The second one is a programmer. The director is so a nimble guy that the studio has already got
N
contracts for web site develo... | 30,940 |
Necklace (NECKLACE)
There are
N
points marked on a surface, pair (
x
i
,
y
i
) is coordinates of a point number
i
.
Let's call a
necklace
a set of
N
figures which fulfils the following rules.
The figure
#i
consists of all such points (
x
,
y
) that (
x
-
x
i
)
2
+ (
y
-
y
i
)
2
≤
r
i
2
, whe... | 30,941 |
Transposing is Fun (TRANSP)
Suppose you are given a 2
a
x 2
b
array. It is stored sequentially in memory in the usual way, first values in the first row, then values in the second one and so on. You would like to transpose it, but you don't have any additional memory. The only operation that you can perform is swapp... | 30,942 |
Another Road Problem (AROAD)
Problem
Let's say you are given a set of cities (numbered from 1 to n) and possible bidirectional roads between them. You would like to build cheapest road network that will make getting from the capital (which has number 1) to every other city possible, where the cost of the network i... | 30,943 |
Transposing is Even More Fun (TRANSP2)
Problem
Suppose you are given a 2
a
×2
b
array. It is stored sequentially in memory in the usual way, first values in the first row, then values in the second one and so on. You would like to transpose it, but you don't have any additional memory. The only operation that you... | 30,944 |
Assignments (ASSIGN)
Problem
Your task will be to calculate number of different assignments of n different topics to n students such that everybody gets exactly one topic he likes.
Input
First line of input contains number of test cases c (1 ≤ c ≤ 80). Each test case begins with number of students n (1 ≤ n... | 30,945 |
Particular Palindromes (PARTPALI)
A palindromic decimal integer reads the same forward and backward.
For example, the following numbers are palindromic.
6, 55, 282, 5005, 78187, 904409, 3160613, 11111111
Palindromic integers are plentiful. In fact, any integer not
divisible by 10 has an infinite number of multip... | 30,946 |
Simple Numbers with Fractions Conversion (TCNUMFL)
Every integer number
n
is represented in positional number system of base
r
by a sequence of digits 0 <=
d
i
<
r
, decimal point ',' and fractional part, so the value is equal to:
n
=
d
0
+
r
*
d
1
+
r
2
*
d
2
+
r
3
*
d
3
+ ... +
r
-1
*
d
... | 30,947 |
Permutation generator (TPERML)
Wersja polska
English version
For each index of n element permutation print m subsequent permutations (in separate lines) in lexicographical order starting from the one pointed by index.
Between outputs of subsequent tests there should be an empty line.
Next permutation to the ... | 30,948 |
Roots of polynomial (KMSL4B)
p(x) = p
k
x
k
+ ... + p
0
x
0
is a given polynomial of degree at most 20. Check whether all roots of p( ) belong to the open unit disc |z|< 1 on the complex plain.
Input
First the number of polynomials appears. Then the data for the following polynomials follows in the consecuti... | 30,949 |
Fossil in the Ice (TFOSS)
A small group of archaeologists is working in the Antarctic. Their sensors have detected a number of caves in which there are interesting fossils. However, a thick layer of ice blocks the entrance to each cave. The archaeologists possess the equipment needed to burn a tunnel in the layer of i... | 30,950 |
Prime Intervals (PRINT)
In this problem you have to print all primes from given interval.
Input
t
- the number of test cases, then
t
lines follows. [
t
<= 150]
On each line are written two integers
L
and
U
separated by a blank.
L
- lower bound of interval,
U
- upper bound of interval. [2 <=
L
... | 30,951 |
Collatz (CLTZ)
Let N be a positive integer, Consider the following recurrence: f(1) = N and f(K) = (0.5 + 2.5 * (f(K-1) mod 2)) * f(K-1) + (f(K-1) mod 2) if K > 1. For a given N you have to compute the smallest L for which f(L) = 1 (such an L always exists for N's in the input).
Input
Each line contains a positive... | 30,952 |
Zig-Zag Permutation (ZZPERM)
In the following we will deal with nonempty words consists only of lower case letters 'a', 'b' ... 'j' and we will use the natural 'a' < 'b' < ... < 'j' ordering. Your task is to write a program that generates almost all zig-zag words (zig-zag permutations) from a given collection of lette... | 30,953 |
Divisors (DIV)
Let N be a positive integer. In theory it is easy to decide if d(N) (the number of positive divisors of N including 1 and N) is prime or not. Your task is just a little bit harder: compute all N in [1,10^6] for which d(N)=p*q where p and q distinct primes.
Input
There is no input for this problem.
... | 30,954 |
Divisors 2 (DIV2)
Let N be a positive integer and d(N) be the number of positive divisors of N including 1 and N. Your task is to compute all N in [1,10^6] for which d(N)>3 and if M divides N then d(M) divides d(N) too.
Input
None.
Output
To make the problem less output related write out only every 108-th of ... | 30,955 |
Increasing Subsequences (INCR)
A sequence
p(1)
,
p(2)
, ...,
p(N)
consisting of numbers 1, 2, ...,
N
is called a permutation if all elements in the sequence are different.
It is said that a permutation
p
contains increasing subsequence of
k
elements when there are numbers
1 ≤
i
1
<
i
2
< ... <
i... | 30,956 |
Dungeon of Death (QUEST4)
To reach the treasure,
Jones
has to pass through the
"Room of Death"
. The floor of this room is a square with side
120
units. It is laid with square tiles of dimensions
{1 X 1}
arranged into a grid. But, at some places in the grid tiles are missing. As soon as the door to this room is... | 30,957 |
Nail Them (QUEST5)
To get to the treasure,
Jones
must complete one more task. He comes across a table, where there are a number of wooden planks lying along the length of the table. He notices that the width of the table is exactly equal to the width of every plank on it. The planks are so heavy that they cannot be ... | 30,958 |
String it out (SUBS)
Let
A
and
B
be two strings made up of alphabets such that
A = A
[1-n]
, B = B
[1-m]
. We say
B
is a subsequence of
A
if there exists a sequence of indices
i
1
< i
2
<..
m
of
A
such that
A[i
k
] = B[k]
.
Given
B[1-m]
, a string of characters from some alphabets,
B
i
is de... | 30,959 |
Con-Junctions (VOCV)
The city of
Y-O
is a network of two-way streets and junctions with the following properties:
There is no more than one street between each pair of junctions.
Every junction is connected to every other junction either directly via a street or through other junctions by a unique path.
... | 30,960 |
Sorting is not easy (LSORT)
An N-element permutation is an N-element sequence of distinct numbers from the set {1, 2 ... n}. For example the sequence 2, 1, 4, 5, 3 is a 5-element permutation. P is an N-element permutation. Your task is to sort P in ascending order. But because it is very simple, I have a new rule for ... | 30,961 |
A place for the brewery (BROW)
The dwellers of the island Abstinence are very fond of alcohol-free beer. Hitherto alcohol-free beer was imported from Poland, but this year one of the cities on Abstinence is going to build a brewery. All the cities of this island lie on the coast and are connected by a highway running ... | 30,962 |
Building the Tower (HANOI07)
There are N cubes in a toy box which has 1-unit height, the width is double the height. The teacher organizes a tower-building game. The tower is built by the cubes. The height of the tower is H (h levels). The bottom of the tower contains M cubes; and for all above level, each must contai... | 30,963 |
Pairs of Integers (PAIRINT)
You are to find all pairs of integers such that their sum is equal to the given integer number N and the second number results from the first one by striking out one of its digits. The first integer always has at least two digits and starts with a non-zero digit. The second integer always h... | 30,964 |
Another Assignment Problem (ASSIGN4)
Assume that you are a manager and there are m types of worker (numbered from 1 to m) and n types of task (numbered from 1 to n). There are a(i) workers of type #i and b(j) postitions for task #j. C(i, j) is the cost of hiring a worker of type #i to do the task of type #j. Your job ... | 30,965 |
Partition the sequence (SEQPAR)
Given an integer sequence containing n elements (numbered from 1 to n), your task is to find the minimum value M so that we can find k + 1 integers 0 = p(0) < p(1) < p(2) < ... < p(k-1) < p(k) = n, such that for any i from 0 to k - 1, the sum of elements from postition p(i)+1 to postit... | 30,966 |
Repeats (REPEATS)
A string s is called an (k,l)-repeat if s is obtained by concatenating k>=1 times some seed string t with length l>=1. For example, the string
s = abaabaabaaba
is a (4,3)-repeat with t = aba as its seed string. That is, the seed string t is 3 characters long, and the whole string s is obtain... | 30,967 |
Toy Cars (SAM)
Jasio is a little boy - he is only three years old and enjoys playing with toy cars very much. Jasio has n different cars. They are kept on a shelf so high, that Jasio cannot reach it by himself. As there is little space in his room, at no moment may there be more than k toy cars on the floor.
Jasio... | 30,968 |
Lethal Warfare (LWAR)
A major cosmic battle was getting over. The InterGalactic
SuperPower had been under attack, but it had defended itself quite
well. It was about to launch its final retaliatory assault. But the
number of enemy ships was quite large and they could scatter very
easily. Their only hope, or so the... | 30,969 |
Distinct Substrings (DISUBSTR)
Given a string, we need to find the total number of its distinct substrings.
Input
T- number of test cases. T ≤ 20;
Each test case consists of one string, whose length is ≤ 1000
Output
For each test case output one number saying the number of distinct substrings.
Example
I... | 30,970 |
Unite Fast (UFAST)
The Agents need to unite. They are on a road and each of them possess a special device which can both send and receive signals, in both directions up to a maximal distance of D units. Apart from this small limitation, the devices work very efficiently so that the time
taken for interdevice communic... | 30,971 |
Truth or not (LIAR)
Professor Millman hates us, and worse, characterizes us as liars. We don’t care if he means it or not, but we (more professional that him!) planned to give the lower and upper bound on the number of liars in the class (so that you know what happens the next time he scolds us!)
To start with we to... | 30,972 |
Matrix Words (MWORDS)
Given an N×N matrix of characters. We start at position (1, 1) and want to reach (N, N) in exactly 2N-1 moves. Each move consists of movement in one of the four standard directions. As we move, we collect the characters found in our positions forming a string. We now constrain our attention to al... | 30,973 |
Plane Hopping (PLHOP)
This man has grown so rich that, when he travels between any
two locations he always takes at least K flights. In a region of N
cities, we need to find the minimal cost required for the man to travel
between every pair of cities. There are provisions (especially for this
type of rich men,) to... | 30,974 |
Huge Knap Sack (HKNAP)
Our King has won the brutal battle and this whole land is now ours. The special thing about this land is that it has many beautiful golden statues. Our King wants to take back as much gold as possible to his palace. We have found that there are
N
types of statues and — almost unbelievably — th... | 30,975 |
Branch Prediction (BPRED)
As most of you might already know, the Intel-class hi-tech processors of today do a series of parallel tasks to help speedup instruction execution. The most complicated of those tasks is branch prediction. Since the instruction chunks on a modern processor are broken down into independent chu... | 30,976 |
Barn Expansion (EXPAND)
Farmer John has N (1 <= N <= 25,000) rectangular barns on his farm, all
with sides parallel to the X and Y axes and integer corner coordinates in
the range 0..1,000,000. These barns do not overlap although they may
share corners and/or sides with other barns.
Since he has extra cows to mi... | 30,977 |
Mobile Service (SERVICE)
A company provides service for its partners that are located in different towns. The company
has three mobile service staff employees. If a request occurs at some location, an employee of
the service staff must move from his current location to the location of the request (i... | 30,978 |
Remove The String (PSTRING)
Given two strings X and Y, your task is find the minimum number of characters to be removed from X in order to obtain a string X' that does not contain Y as a substring.
Input
Input contains some test cases. Each test cases contains two lines, First is X and second is Y. Length of X... | 30,979 |
New Distinct Substrings (SUBST1)
Given a string, we need to find the total number of its distinct substrings.
Input
T- number of test cases. T<=20;
Each test case consists of one string, whose length is <= 50000
Output
For each test case output one number saying the number of distinct substrings.
Ex... | 30,980 |
Triple-Free Sets (TFSETS)
A set
S
of positive integers is called
strongly triple-free
if, for any integer
x
, the sets {
x
, 2
x
}
and {
x
, 3
x
} are not subsets of
S
. Let's define
F(n)
as a number of strongly triple-free subsets of {1, 2, ...,
n
},
where
n
is a natural number.
You need to write a... | 30,981 |
The day of the competitors (NICEDAY)
The International Olympiad in Informatics is coming and the leaders of the Vietnamese Team have to choose the best contestants all over the country. Fortunately, the leaders could choose the members of the team among N very good contestants, numbered from 1 to N (3 ≤ N ≤ 100000). I... | 30,982 |
Promotion (PRO)
A large Bytelandian supermarket chain has asked you to write a program for the simulating costs of a promotion being prepared.
The promotion has to follow the following rules:
A customer who wants to participate in the promotion, writes on the receipt, paid by himself, his personal details ... | 30,983 |
Move your armies (MAXIMUS)
Commodus has
discovered with your help that the traitor is Maximus. Commodus has
gathered N prestigious armies A1 A2 ... AN and asked you to lead them
to kill Maximus. A brave warrior like you must now act intelligently to
lead the armies to victory.
There are three countries which are... | 30,984 |
Mountain Walking (MTWALK)
English
Vietnamese
Farmer John and Bessie the cow have embarked on one of those 'active' vacations. They spend entire days walking in the mountains and then, at the end of the day, they tire and return to their vacation cabin.
Since climbing requires a lot of energy and they are... | 30,985 |
Ivan and his interesting game (IVAN)
Little Ivan likes to play games in his spare time. Unfortunately, he cannot always enjoy the company of his friends and sometimes he is a little bored when he is alone. Therefore, he makes up games, where he is the only player. He is especially proud of his last game and likes to t... | 30,986 |
Minimum Diameter Spanning Tree (MDST)
Solve the minimum diameter spanning tree problem for the simple graphs.
For a given list of adjacent vertices of a graph G find the minimum diameter spanning tree T and write down the diameter of this tree diam(T).
Each graph has only one connected component, so there is at l... | 30,987 |
Another Counting Problem (TREE)
Tree is an important data structure in Computer
Science. Of all trees we work with, Binary Tree is probably the most popular
one. A Binary Tree is called a
Strictly Binary Tree
if every nonleaf
node in a binary tree has nonempty left and right subtrees. Let us define
a
Strictly B... | 30,988 |
The Moronic Cowmpouter (NEG2)
Inexperienced in the digital arts, the cows tried to build a calculating engine (yes, it's a cowmpouter) using binary numbers (base 2) but instead built one based on base negative 2! They were quite pleased since numbers expressed in base -2 do not have a sign bit.
You know number ba... | 30,989 |
Treats for the Cows (TRT)
FJ has purchased N (1 ≤ N ≤ 2000) yummy treats for the cows who
get money for giving vast amounts of milk. FJ sells one treat per
day and wants to maximize the money he receives over a given period
time.
The treats are interesting for many reasons:
The treats are numbered 1..N an... | 30,990 |
Steady Cow Assignment (STEAD)
Farmer John's N (1 ≤ N ≤ 1000) cows each reside in one of B (1 ≤ B ≤ 20)
barns which, of course, have limited capacity. Some cows really like their
current barn, and some are not so happy.
FJ would like to rearrange the cows such that the cows are as equally happy
as possible, ev... | 30,991 |
Longest Permutation (LPERMUT)
You are given a sequence A of n integer numbers (1 ≤ A
i
≤ n). A subsequence of A has the form A
u
, A
u+1
... A
v
(1 ≤ u ≤ v ≤ n). We are interested in subsequences that are permutations of 1, 2 ... k (k is the length of the subsequence).
Your task is to find the longest subsequence... | 30,992 |
Thermal Luminescence (TEM)
After many years of hard work a group of scientists developed a shiny new state-of-the-art processor with a 3D configuration. Due to the high clock frequency at which this processor works, the silicon cube uses up too much energy. Even with its powerful cooling system, the processor is unabl... | 30,993 |
Convex Hull 3D (CH3D)
Bytelandian scientists have developed a brand new method for determining the volume of a person's lungs. The idea is simple: the patient is asked to inhale a sufficiently large number of nanobots, which then transmit their exact 3D-coordinates to an external sensor. Early clinical tests proved ra... | 30,994 |
The Archipelago (ARCHPLG)
Byteland is a country located in the Archipelago of Rectangular Islands. The archipelago consists of
1<=n<=1000
islands. A fact that each island has a rectangular shape is very nice for Bytelandian cartographers.
Bytelandian islands are rather small and none are very fertile, so each... | 30,995 |
Trigonometric optimization (TRIOPT)
Many problems arising in practical applications may be stated as
optimization problems
. Usually it is necessary to maximize or minimize so called
criterion function
taking into account some
constraints
.
Let’s consider a trigonometric optimization problem. It is necessary... | 30,996 |
Optimal Marks (OPTM)
You are given an undirected graph G(V, E). Each vertex has a mark which is an integer from the range [0..2
31
– 1]. Different vertexes may have the same mark.
For an edge (u, v), we define Cost(u, v) = mark[u] xor mark[v].
Now we know the marks of some certain nodes. You have to determine the... | 30,997 |
Soccer Choreography (WM06)
Mr. Bitmann, the coach of the national soccer team of Bitland, is a perfectionist. He taught his players optimal tactics and improved their endurance and shape. So they qualified for the soccer woldcup this year. Due to his perfectionism the coach attaches importance not only to the perfor... | 30,998 |
Counting inversions (SWAPS)
You are given a sequence A of
N
(
N
≤250000) integers between 1 and 50000. On this sequence you have to apply
M
(
M
≤10000) operations of the form: modify the i-th element in the sequence and then say how many inversions are there in the sequence. The number of inversions in a sequence ... | 30,999 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.