task stringlengths 0 154k | __index_level_0__ int64 0 39.2k |
|---|---|
Piggy-Bank (PIGBANK)
Before ACM can do anything, a budget must be prepared and the necessary
financial support obtained. The main income for this action comes from
Irreversibly Bound Money (IBM). The idea behind is simple. Whenever
some ACM member has any small money, he takes all the coins and throws them
into a ... | 30,700 |
Lifting the Stone (STONE)
There are many secret openings in the floor which are covered by a big heavy stone. When the stone is lifted up, a special mechanism detects this and activates poisoned arrows that are shot near the opening. The only possibility is to lift the stone very slowly and carefully. The ACM team mus... | 30,701 |
Play on Words (WORDS1)
Some of the secret doors contain a very interesting word puzzle. The team of
archaeologists has to solve it to open that doors. Because there is no
other way to open the doors, the puzzle is very important for us.
There is a large number of magnetic plates on every door. Every plate has... | 30,702 |
Adding Reversed Numbers (ADDREV)
The Antique Comedians of Malidinesia prefer comedies to tragedies. Unfortunately, most of the ancient plays are tragedies. Therefore the dramatic advisor of ACM has decided to transfigure some tragedies into comedies. Obviously, this work is very hard because the basic sense of the pla... | 30,703 |
Copying Books (BOOKS1)
Before the invention of book-printing, it was very hard to make a copy of a book. All the contents had to be re-written by hand by so called
scribers
. The scriber had been given a book and after several months he finished its copy. One of the most famous scribers lived in the 15th century and ... | 30,704 |
Substitution Cipher (SCYPHER)
Antique Comedians of Malidinesia would like to play a new discovered
comedy of Aristophanes. Putting it on a stage should be a big surprise for
the audience so all the preparations must be kept absolutely secret.
The ACM director suspects one of his competitors of reading his
correspo... | 30,705 |
Commedia dell Arte (COMMEDIA)
So called
commedia dell' arte
is a theater genre first
played in Italy at the beginning of the sixteenth century. It was inspired
with the Roman Theater. The play had no fixed script and the actors (also
called
performers
) had to improvise a lot. There were only a simple
direction... | 30,706 |
Skyscraper Floors (SCRAPER)
What a great idea it is to build skyscrapers! Using not too
large area of land, which is very expensive in many cities today, the
skyscrapers offer an extremely large utility area for flats or offices.
The only disadvantage is that it takes too long to get to the upper
floors. Of cour... | 30,707 |
Glass Beads (BEADS)
Once upon a time there was a famous actress. As you may expect, she played
mostly Antique Comedies most of all. All the people loved her. But she was not
interested in the crowds. Her big hobby were beads of any kind. Many bead
makers were working for her and they manufactured new necklaces and
... | 30,708 |
Hares and Foxes (HAREFOX)
The Antique Comedians of Malidinesia play an interesting comedy
where many animals occur. Because they want their plays to be as true as
possible, a specialist studies the behaviour of various animals.
Recently, he is interested in a binary dynamic ecological
system hares-foxes (SHF). As ... | 30,709 |
Invitation Cards (INCARDS)
In the age of television, not many people attend theater
performances. Antique Comedians of Malidinesia are aware of this fact. They
want to propagate theater and, most of all, Antique Comedies. They have
printed invitation cards with all the necessary information and with the
programme.... | 30,710 |
Fake tournament (TOUR)
We consider only special type of tournaments. Each tournament consists of a series of matches. We have
n
competitors at the beginning of a competition and after each match the loser is moved out of the competition and the winner stays in (there are no draws). The tournament ends when there is ... | 30,711 |
Julka (JULKA)
Julka surprised her teacher at preschool by solving the following riddle:
Klaudia and Natalia have 10 apples together, but Klaudia has two apples more than Natalia.
How many apples does each of he girls have?
Julka said without thinking: Klaudia has 6 apples and Natalia 4 apples.
The teac... | 30,712 |
Jasiek (JASIEK)
Jasiek is only 6 years old, but he already has many skills.
He likes drawing and asking riddles very much. This morning he got
a sheet of grid paper and a pencil from his mother and he
started drawing. All his drawings have some common properties:
Jasiek colors full grid squares;
if some c... | 30,713 |
Dyzio (DYZIO)
Dyzio is Jasiek's friend and he also likes riddles. Here is a riddle he came up with:
Jasiek, here is a piece of rope, which has to be cut into smaller pieces.
I will not tell you directly how to do it, but look at this
sequence of zeros (0) and ones (1). A one at the beginning means that the r... | 30,714 |
Supernumbers in a permutation (SUPPER)
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.
We are interested in the longest increasing subsequences in a permutation. In this exemplary
permutation ... | 30,715 |
Crime at Piccadily Circus (PICAD)
Sherlock Holmes is carrying out an investigation into the crime at Piccadily Circus. Holmes
is trying to determine the maximal and minimal number of people staying simultaneously at the crime scene at a moment when the crime could have been commited. Scotland Yard has already carried... | 30,716 |
Bytelandian Information Agency (BIA)
Bytelandian Information Agency (BIA) uses a net of
n
computers.
The computers are numbered from
1
to
n
, and
the computer number
1
is a server. The computers are connected
by one-way information channels. Every channel connects a pair of computers.
The whole network is o... | 30,717 |
The Gordian Dance (DANCE)
The Gordian Dance is a traditional Bytelandian dance performed by two pairs
of dancers. At the beginning the dancers are standing in the corners of the square
ABCD
,
forming two pairs:
A-B
and
C-D
. Every pair is holding an outstretched string. So in the starting position both strings a... | 30,718 |
Brackets (BRCKTS)
We will call a
bracket word
any word constructed out of two sorts
of characters: the opening bracket "(" and the closing bracket ")". Among
these words we will distinguish
correct bracket expressions
. These are
such bracket words in which the brackets can be matched into pairs such that
ev... | 30,719 |
The Imp (IMP)
An Imp jumps on an infinite chessboard. Moves possible
for the Imp are described by two pairs of integers:
(a, b) and (c, d) - from square (x, y) the Imp
can move to one of the squares: (x+a, y+b), (x-a, y-b),
(x+c, y+d), (x-c, y-d). We want to know for which square
different from (0, 0) to which th... | 30,720 |
Square Brackets (SQRBR)
You are given:
a positive integer n,
an integer k, 1 ≤ k ≤ n,
an increasing sequence of k integers 0 < s
1
< s
2
< ... < s
k
≤ 2n.
What is the number of proper bracket expressions of length 2n with opening brackets appearing in positions s
1
, s
2
... s
k
?
Illustration
Se... | 30,721 |
Permutations (PERMUT1)
Let A = [a
1
, a
2
, ... a
n
] be a permutation of
integers 1, 2, ... n. A pair of indices (i, j), 1 <= i <= j <= n, is an
inversion
of the permutation A if a
i
> a
j
. We are given integers n > 0
and k >= 0. What is the number of n-element permutations containing exactly k
inversions?
... | 30,722 |
Ball (BALL1)
On the rectangular chessboard of n × m square fields we choose one field
adjacent to the edge of the chessboard, called the starting field. Then we put
a ball in the center of this field and push it to roll through the chessboard.
The diameter of the ball equals the width (and height) of chessboa... | 30,723 |
Cross-country (CRSCNTRY)
Agness, a student of computer science, is very keen on crosscountry
running, and she participates in races organised every Saturday in a big park.
Each of the participants obtains a route card, which specifies a sequence of
checkpoints, which they need to visit in the given order. Ag... | 30,724 |
Cutting out (CUTOUT)
One has to cut out a number of rectangles from a paper square. The sides of each rectangle are to be parallel
to the sides of the square. Some rectangles can be already cut out. What is the largest area of a rectangle
which can be cut out from the remaining paper?
Illustration
Three r... | 30,725 |
Expression (EXPR1)
We are given an integer k and an arithmetic expression E with the operations
'+', '-', and arguments from the set {0, 1 ... 9}. Is it possible to put some
parentheses in E to get a new expression E' whose value equals k? If the answer
is positive what is the minimum number of pairs of paren... | 30,726 |
Moulds (MOULDS)
In a factory, moulds for casting metal objects are produced by a special
cutting device. The device is equipped with cuboid-shaped blade of size 1 mm x
1 mm x 30 mm (its height) which operates with each of its sides thus producing
the mould from cuboid of size 250 mm x 250 mm x 30 mm (its height)... | 30,727 |
Relations (RELATS1)
You are given a directed graph, whose edges are labeled with relational symbols
'<', '>' and '='. For a nonnegative integer k, a k-correct
G-labeling is a mapping from vertices of G into integers from interval
[0,k] such that numbers at the ends of each edge satisfy the relation described ... | 30,728 |
Tree (TREE1)
Consider an n-vertex binary search tree T containing n keys 1, 2 ... n. A
permutation p = [p
1
... p
n
] of the integers 1, 2 ... n is
said to be
consistent with the tree T
if the tree can be built from the
empty one as the result of inserting integers p
1
, p
2
... p
n
.
Find how many per... | 30,729 |
Bacterial (BAC)
In the biology laboratory we are observing several bacterial
samples, and under
the microscope we have them shaded with different colors to see them expanding
their territory on the plate.
It is interesting to know that the
bacterial are
... | 30,730 |
Editor (EDIT1)
Have you ever programmed in Brainf**k? If yes, then you know how
annoying it is to press the same key several times in a row. So what we all
need, is a good editor.
Here are the functions that the editor should have:
'\n': begin a new line. If the last line was empty, stop
processing and pri... | 30,731 |
Editor Inverse (EDIT2)
You are given a text. Calculate the minimum number of keystrokes needed
to produce this text,
if the editor described below is used.
If you haven't read the problem "Editor" before, here is a description
of the functionality of the editor:
'\n': begin a new line. If the last line ... | 30,732 |
New bricks disorder (BRICKS)
You have n bricks arranged in a line on the table. There is exactly one letter on each of them. Your task is to rearrange those bricks so that letters on them create some specified inscription. While rearranging you can only swap adjacent bricks with specified letters (you are given m pair... | 30,733 |
Marbles (MARBLES)
Hänschen dreams he is in a shop with an infinite amount of marbles. He is allowed to select n marbles. There are marbles of k different colors. From each color there are also infinitely many marbles. Hänschen wants to have at least one marble of each color, but still there are a lot of possibilities ... | 30,734 |
Easy Problem (EASYPIE)
Last year there were a lot of complaints concerning the set of problems. Most
contestants considered our problems to be too hard to solve. One reason for
this is that the team members responsible for the problems are not able to
evaluate properly whether a particular problem is easy or ... | 30,735 |
Bundling (BUNDLE)
Outel, a famous semiconductor company, recently released a new model of
microprocessor called Platinium. Like many modern processors, Platinium can
execute many instructions in one clock step providing that there are no
dependencies between them (instruction I
2
is dependent on
instructi... | 30,736 |
Shortcut (SHORTCUT)
Mirek has a favourite way from home to the university that he traverses every
working day. The route consists of sections and each section is a straight
segment 10 meters long. Each section is either a straight ahead extension of
the previous section or it is perpendicular to the previous ... | 30,737 |
Dice Contest (DICE1)
Everyone loves gambling in the Dicent City. Every Saturday the whole community
meets to attend a dice contest. They started a few years ago with a classic
six-sided die with 1 to 6 dots displayed on the sides and had a lot of fun.
However they soon got bored and that's why more soph... | 30,738 |
November Rain (RAIN1)
Contemporary buildings can have very complicated roofs. If we take a vertical
section of such a roof it results in a number of sloping segments. When it is
raining the drops are falling down on the roof straight from the sky above.
Some segments are completely exposed to the rain but the... | 30,739 |
Football (FOOTBALL)
Eric has a classic football that is made of 32 pieces of leather: 12 black
pentagons and 20 white hexagons. Each pentagon adjoins 5 hexagons and each
hexagon adjoins 3 pentagons and 3 hexagons. Eric drew a polygon (i.e. a closed
line without intersections) along the edges of the pieces. Th... | 30,740 |
Which is Next (TREE2)
Every computer science student knows binary trees. Here is one of many possible
definitions of binary trees. Binary trees are defined inductively. A binary
tree t is either an external node (leaf)
or an ordered pair t = (t
1
, t
2
) representing an internal
node
with two subtrees ... | 30,741 |
Hang or not to hang (HANGLET)
Little Tom is learning how to program. He has just written some programs but is
afraid to run them, because he does not know if they will ever stop. Please
write a program to help him. This task is not as easy as it may seem, because
Tom's programs are possibly not deterministic. Given... | 30,742 |
Minimizing maximizer (MINIMAX)
The company Chris Ltd. is preparing a new sorting hardware called Maximizer. Maximizer has n
inputs numbered from 1 to n. Each input represents one integer. Maximizer has one output which
represents the maximum value present on Maximizer's inputs.
Maximizer is implemented as a... | 30,743 |
Two squares or not two squares (TWOSQRS)
Given integer n decide if it is possible to represent it as a sum of two squares of integers.
Input
First line of input contains one integer c ≤ 100 - number of test cases. Then c lines follow, each of them consisting of exactly one integer 0 ≤ n ≤ 10
12
.
Output
... | 30,744 |
Cutting off Squares (CUTSQRS)
Two players take it in turns to cut off squares from a rectangle. If the lengths of the sides of the rectangle are
a
and
b
(a ≤ b) at the beginning of a player's turn, he may cut off as many squares with a side of length
a
as he likes (but at least 1 square), provided the square he ... | 30,745 |
Numeral System of the Maya (MAYA)
The Maya lived in Central America during the first millennium. In many regards, they constituted one of the most developed and most fascinating cultures of this epoch. Even though draught animals and the wheel were unknown to the Mayas, they excelled in the fields of weaving, architec... | 30,746 |
Street Parade (STPAR)
For sure, the love mobiles will roll again on this summer's street parade. Each year, the organisers decide on a fixed order for the decorated trucks. Experience taught them to keep free a side street to be able to bring the trucks into order.
The side street is so narrow that no two cars can... | 30,747 |
Shopping (SHOP)
The old tube screen to your computer turned out to be the cause of your chronic headaches. You therefore decide to buy one of these new flat TFT monitors. At the entrance of the computer shop you see that it is quite full with customers.
In fact, the shop is rather packed with customers and moving in... | 30,748 |
Party Schedule (PARTY)
You just received another bill which you cannot pay because you lack the money.
Unfortunately, this is not the first time to happen, and now you decide to investigate the cause of your constant monetary shortness. The reason is quite obvious: the lion's share of your money routinely disappears ... | 30,749 |
Dance Floor (DFLOOR)
You recently watched a video clip in which a singer danced on a grid of colourful tiles enlightened from below. Each step on a tile flipped the tile's state, i.e. light on or off. In addition to that, all the neighbouring tiles flipped their states, too.
In this task, you are supposed to come ... | 30,750 |
Bus (BUS)
The city Buscelona (as the name suggests) has a great bus transport system. All buses have circular lines. The bus drivers in Buscelona like to chat. Fortunately most bus lines have some stops in common. If a bus driver meets a colleague on a bus stop they chat a bit and exchange all news they know.
The op... | 30,751 |
Tower of Babylon (BABTWR)
Apart from the Hanging Gardens the Babylonians (around 3000-539 b.c.) built the Tower of Babylon as well. The tower was meant to reach the sky, but the project failed because of a confusion of language imposed from much higher above.
For the 2638th anniversary a model of the tower will be r... | 30,752 |
Fishmonger (FISHER)
A fishmonger wants to bring his goods from the port to the market. On his route he has to traverse an area with many tiny city states. Of course he has to pay a toll at each border.
Because he is a good business man, he wants to choose the route in such a way that he has to pay as little money fo... | 30,753 |
GX Light Pipeline Inc (LITEPIPE)
The GX Light Pipeline Inc. started to prepare bent pipes for the new transgalactic light pipeline. However during the design of the pipeline they ran into the problem of determing how far the light can reach inside the pipe. In order to improve your scarce budget you decided to fill a ... | 30,754 |
Highways (HIGH)
In some countries building highways takes a lot of time... Maybe that's because there are many possibilities to construct a network of highways and engineers can't make up their minds which one to choose. Suppose we have a list of cities that can be connected directly. Your task is to count how many wa... | 30,755 |
Alice and Bob (ALICEBOB)
This is a puzzle for two persons, let's say Alice and Bob. Alice draws an
n-vertex convex polygon and numbers its vertices with integers 1, 2, ... , n in
an arbitrary way. Then she draws a number of noncrossing diagonals (the
vertices of the polygon are not considered to be crossing p... | 30,756 |
Binary Stirling Numbers (BINSTIRL)
The Stirling number of the second kind S(n, m) stands for the number of ways to
partition a set of n things into m nonempty subsets. For example, there are
seven ways to split a four-element set into two parts: {1, 2, 3} u {4}, {1, 2,
4} u {3}, {1, 3, 4} u {2}, {2, 3, 4} u {... | 30,757 |
Calendar of the Maya (MAYACAL)
The Classical Maya civilization developed in what is today southern Mexico,
Guatemala, Belize and northern Honduras. During its height they developed a
sophisticated system for time keeping which they used both to record history
and for divinatory rituals. Their calendar consist... | 30,758 |
Decoding Morse Sequences (MORSE)
Before the digital age, the most common "binary" code for radio communication was the Morse
code. In Morse code, symbols are encoded as sequences of short and long pulses (called dots and dashes
respectively). The following table reproduces the Morse code for the alphabet, where do... | 30,759 |
Exchanges (EXCHNG)
Given n integer registers r
1
, r
2
... r
n
we
define a Compare-Exchange Instruction CE(a, b), where a, b are register indices
(1 <= a < b <= n):
CE(a, b)::
if content(r
a
) > content(r
b
) then
exchange the contents of registers r
a
and r
b
;
A Compare-Exchange pr... | 30,760 |
Fill the Cisterns (CISTFILL)
During the next century certain regions on earth will experience severe water shortages. The old
town of Uqbar has already started to prepare itself for the worst. Recently they created a network of
pipes connecting the cisterns that distribute water in each neighbourhood, making it ea... | 30,761 |
Horizontally Visible Segments (SEGVIS)
There is a number of disjoint vertical line segments in the plane. We say that
two segments are horizontally visible if they can be connected by a horizontal
line segment that does not have any common points with other vertical segments.
Three different vertical segments... | 30,762 |
Family (FAMILY)
We want to find out how much related are the members of a family of monsters.
Each monster has the same number of genes but the genes themselves may differ
from monster to monster. It would be nice to know how many genes any two given
monsters have in common. This is impossible, however, since... | 30,763 |
Intervals (INTERVAL)
You are given n closed integer intervals [a
i
, b
i
] and n
integers c
1
, ..., c
n
.
Task
Write a program that:
reads the number of intervals, their endpoints and integers c
1
, ...,
c
n
from the standard input,
computes the minimal size of a set Z of integer... | 30,764 |
Rhombs (RHOMBS)
An unbounded triangular grid is a plane covered by equilateral triangles:
Two neighboring triangles in the grid form a rhomb. There are 3 types of such
rhombs:
A grid polygon is a simple polygon which sides consist entirely of sides of
triangles in the grid. We say that a grid p... | 30,765 |
Servers (SERVERS)
The Kingdom of Byteland decided to develop a large computer network of servers
offering various services.
The network is built of n servers connected by bidirectional wires. Two servers
can be directly connected by at most one wire. Each server can be directly
connected to at most 10 ... | 30,766 |
Solitaire (SOLIT)
Solitaire is a game played on an 8x8 chessboard. The rows and columns of the
chessboard are numbered from 1 to 8, from the top to the bottom and from left
to right respectively.
There are four identical pieces on the board. In one move it is allowed to:
move a piece to an ... | 30,767 |
Timetable (TTABLE)
You are the owner of a railway system between n cities, numbered by integers
from 1 to n. Each train travels from the start station to the end station
according to a very specific timetable (always on time), not stopping anywhere
between. On each station a departure timetable is available. ... | 30,768 |
Voracious Steve (STEVE)
Steve and Digit bought a box containing a number of donuts. In order to divide
them between themselves they play a special game that they created. The players
alternately take a certain, positive number of donuts from the box, but no more
than some fixed integer. Each player's donuts a... | 30,769 |
Paying in Byteland (PAYING)
There are infinitely many coin denominations in the Byteland. They have values of 2
i
for i=0, 1, 2 ... . We will say that set of coins c1, c2 ... ck is perfect when it is possible to pay every amount of money between 0 and c1 + ... + ck using some of them (so {4, 2, 2, 1} is perfect while... | 30,770 |
Rent your airplane and make money (RENT)
"ABEAS Corp." is a very small company that owns a single airplane. The
customers of ABEAS Corp are large airline companies which rent the
airplane to accommodate occasional overcapacity.
Customers send renting orders that consist of a time interval and a
price that the cus... | 30,771 |
Square dance (SQDANCE)
You are hired by French NSA to break the RSA code used on the Pink Card. The easiest way to do that is to factor the public modulus and
you have found the fastest algorithm to do that, except that you have to solve a subproblem that can be modeled in the following way.
Let P = {p
1
, p
2
...... | 30,772 |
Help R2-D2! (HELPR2D2)
In Episode III of Star Wars (whose alleged title is "How I became Vader"), R2-D2 (Artoo-Detoo) is again confronted to a tedious work.
He is responsible for the loading of the republic transport starships in the fastest way. Imagine a huge space area where n starships are parked.
Each starship ... | 30,773 |
Phony Primes (PHONY)
You are chief debugger for Poorly Guarded Privacy, Inc. One of the top
selling product, ReallySecureAgent©, seems to have a problem with
its prime number generator. It produces from time to time bogus primes
N.
After a while, you realize that the problem is due to the way primes
are recogniz... | 30,774 |
Men at work (MAWORK)
Every morning you have to drive to your workplace. Unfortunately, roads are under constant repair. Fortunately, administration is aware that this may cause trouble and they enforce a strict rule on roadblocks: roads must be blocked only half of the time. However, contractors are free to schedule t... | 30,775 |
Transformation (TRANS)
You are given two short sequences of numbers, X and Y. Try to determine the
minimum number of steps of transformation required to convert sequence X into
sequence Y, or determine that such a conversion is impossible.
In every step of transformation of a sequence, you are allowed to replace
... | 30,776 |
Partition (PARTIT)
A
partition
of positive integer m into n components is any sequence a
1
... a
n
of positive integers such that a
1
+ ... + a
n
= m and a
1
≤ a
2
≤ ... ≤ a
n
.
Your task is to determine the partition, which occupies the k-th position in
the lexicographic order of all partitions of m i... | 30,777 |
Election Posters (POSTERS)
A parliamentary election was being held in Byteland. Its enterprising and orderly citizens decided to limit the entire election campaign to a single dedicated wall, so as not to ruin the panorama with countless posters and billboards. Every politician was allowed to hang exactly one poster o... | 30,778 |
The Long and Narrow Maze (MAZE)
Consider a maze consisting of 3 rows of n square blocks each. The passageways
in every block match one of three possible patterns, numbered 0 (empty), 1
(straight) and 2 (bent), as depicted below.
Your task is to determine whether it is possible to create a passage in a g... | 30,779 |
The Loner (LONER)
The loner
is a one-dimensional board game for a single player. The board
is composed of squares arranged in a single line, some of which initially have
pawns on them. The player makes a move by jumping with a pawn over a pawn on an
adjacent field, to an empty square two fields to the right ... | 30,780 |
Johnny and the Glue (GLUE)
Little Johnny decided he needed to stick an open metal box to the floor in the
hall of his parents' house, so that all guests coming in would trip on it. He
knew that as soon as his parents saw what he had done, they would try to remove
it, and he wasn't going to stand for this. So,... | 30,781 |
Aliens (ALIENS)
Aliens visited our planet with an obvious intention to find some new species for their space zoo. After entering Earth's orbit, they positioned themselves over the town of Belgrade, having detected some life-form activity on the ground. As they approached the surface, they saw a group of half-intellige... | 30,782 |
Fast Multiplication Again (MULTIPLY)
After trying to solve Problem Number 31 (Fast Multiplication) with some script languages that support arbitrary large integers and timing out, you wonder what would be the best language to do fast multiplication of integers.
And naturally it comes to your mind: Of course it is bra... | 30,783 |
Tautology (TAUT)
Write a program that checks if the given logical expression is a tautology. The logical expression is a tautology if it is always true, regardless of logical value of its variables.
Input
On the first line there is the number of expressions to check (at most 35). The expression is in a prefix ... | 30,784 |
Land for Motorways (MLAND)
With every year, the plans for the construction of motorways in Poland are more
and more advanced. For some time, it seemed as if the building was actually
going to start, so the question of purchasing the land under the roads was of
some importance. Only certain cities can be conne... | 30,785 |
Fencing in the Sheep (FSHEEP)
A shepherd is having some trouble penning in his flock of sheep. After several
hours of ineffectual efforts he gives up, with some of the sheep within their
polygon-shaped pen and some outside. Exhausted, he moves to a place within the
pen from which he can see the whole interior... | 30,786 |
Where to Drink the Plonk? (PLONK)
Consider a city bounded by a square, whose n horizontal and n vertical streets
divide it into (n+1)
2
square blocks. However, in tribute to the
ancient traditions of the first dwellers (who tended to overindulge in
alcohol), all the inhabitants live at crossroads. A group of... | 30,787 |
The Courier (COURIER)
Byteland is a scarcely populated country, and residents of different cities
seldom communicate with each other. There is no regular postal service and
throughout most of the year a one-man courier establishment suffices to
transport all freight. However, on Christmas Day there is somewha... | 30,788 |
Balancing the Stone (SCALES)
You are given scales for weighing loads. On the left side lies a single stone
of known weight W < 2
N
. You own a set of N different weights,
weighing 1, 2, 4 ... 2
N-1
units of mass respectively. Determine
how many possible ways there are of placing some weights on the sides
... | 30,789 |
Sweet and Sour Rock (ROCK)
A manufacturer of sweets has started production of a new type of
sweet called
rock
. Rock comes in sticks composed of
one-centimetre-long segments, some of which are sweet, and the rest are sour.
Before sale, the rock is broken up into smaller pieces by splitting it at the
conn... | 30,790 |
Choosing a Palindromic Sequence (PALSEC)
Given two sequences of words: X=(x
1
,...,x
n
) and Y=(y
1
,...,y
n
), determine how many binary sequences P=(p
1
,...,p
n
) exist, such
that the word concatenation z
1
z
2
...z
n
, where z
i
=x
i
iff p
i
=1 and z
i
=y
i
iff p
i
=0,
is a palindrome (a word which is the s... | 30,791 |
Paint templates (PAINTTMP)
The Painter's Studio is preparing mass production of paintings. Paintings are going to be made with aid of square matrices of various sizes. A matrix of size
i
consists of 2
i
rows and 2
i
columns. There are holes on intersections of some rows and columns. Matrix of size 0 has one hole. ... | 30,792 |
Polygon (POLY1)
We say that two triangles intersect if their interiors have at least one common point. A polygon is called convex if every segment connecting any two of its points is contained in this polygon. A triangle whose vertices are also vertices of a convex polygon is called an elementary triangle of this poly... | 30,793 |
Sum of one-sequence (SUM1SEQ)
We say that a sequence of integers is a one-sequence if the difference between any two consecutive numbers in this sequence is 1 or -1 and its first element is 0. More precisely: [
a
1
,
a
2
, ...,
a
n
] is a one-sequence if
for any
k
, such that 1 <=
k
<
n
: |
a
k
-
a
k
+1... | 30,794 |
AB-words (ABWORDS)
Every sequence of small letters a and b (also the empty sequence) is called an ab-word. If
X
= [
x
1
...
x
n
] is an ab-word and
i
,
j
are integers such that 1 ≤
i
≤
j
≤
n
then
X
[
i
..
j
] denotes the subword of
X
consisting of the letters
x
i
...
x
j
. We say that an ab-word
X
... | 30,795 |
Road net (ROADNET)
A diskette was enclosed to a road map. The diskette contains the table of the shortest ways (distances) between each pair of towns on the map. All the roads are two-way. The location of towns on the map has the following interesting property:
if the length of the shortest way from town A to town B ... | 30,796 |
Word equations (WORDEQ)
Every non-empty sequence of elements 0 and 1 is called a binary word. A word equation is an equation of the form
x
1
x
2
...
x
l
=
y
1
y
2
...
y
r
, where
x
i
and
y
j
are binary digits (0 or 1) or variables i.e. small letters of English alphabet. For every variable there is a fixed lengt... | 30,797 |
How to pack containers (CONTPACK)
Products of a factory are packed into cylindrical boxes. All boxes have the same bases. A height of a box is a non-negative integer being a power of 2, i.e. it is equal to 2
i
for some
i
= 0, 1, 2, ... . The number
i
(exponent) is called a size of a box. All boxes contain the sam... | 30,798 |
Scuba diver (SCUBADIV)
A scuba diver uses a special equipment for diving. He has a cylinder with two containers: one with oxygen and the other with nitrogen. Depending on the time he wants to stay under water and the depth of diving the scuba diver needs various amount of oxygen and nitrogen. The scuba diver has at hi... | 30,799 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.