task stringlengths 0 154k | __index_level_0__ int64 0 39.2k |
|---|---|
Pick up sticks
Description:
Pick up sticks is a fascinating game. A collection of
coloured sticks are dumped in a tangled heap on the table.
Players take turns trying to pick up a single stick at a time
without moving any of the other sticks. It is very difficult to
pick up a stick if there is another ... | 29,200 |
Picking Up Steam
Description:
Meteorologist Wendy Wynne Blose and geologist Maddy Morfik
are in the Porous Mountains of Central Asia, studying mild
eruptions of superheated smoke and steam from below ground.
Unlike more dramatic eruptions such as the one that blew the
top off Mount St. Helens in $1980$... | 29,201 |
Picking Up the Dice
Description:
Two players are playing a game with a set of $K$ six-sided dice. One player calls
out a number in the range $K\ldots 6K$ and the other tries to
roll that number. After the first roll, the player is allowed
to pick up any number ($0\ldots
K$) of dice and re-roll them.
G... | 29,202 |
Pickle Clicker
Description:
Approximately six months ago, the critically acclaimed game
Pickle Clicker was released. After spending countless
hours on the game, Rasmus has decided to take things to the
next level: he plans to speedrun the game.
The goal of Pickle Clicker is to collect as much of the
c... | 29,203 |
Picture Day
Description:
The school for applied astrology has decided to take
pictures of all their students. With moon phases being what
they are, combined with Saturn’s position relative to Venus,
they are forced to focus on cost.
In order to minimise cost, they have asked three
photographers for th... | 29,204 |
Pie
Description:
My friends are very annoying and if one of them gets a
bigger piece than the others, they start complaining. Therefore
all of them should get equally sized (but not necessarily
equally shaped) pieces, even if this leads to some pie getting
spoiled (which is better than spoiling the par... | 29,205 |
Piece It Together
Description:
Tom has developed a special kind of puzzle: it involves a
whole bunch of identical puzzle pieces. The pieces have the
shape of three adjoint squares in an L-shape. The corner square
is black, the two adjacent squares are white.
The puzzler is given a pattern of black and whi... | 29,206 |
Piece of Cake
Description:
Alice received a cake for her birthday! Her cake can be
described by a convex polygon with $n$ vertices. No three vertices are
collinear.
Alice will now choose exactly $k$ random vertices ($k{\ge }3$) from her cake and cut a
piece, the shape of which is the convex polygon define... | 29,207 |
Piece of Cake!
Description:
It is Greg’s birthday! To celebrate, his friend Sam invites
Greg and two other friends for a small party. Of course, every
birthday party must have cake.
Sam ordered a square cake. She makes a single horizontal cut
and a single vertical cut. In her excitement to eat cake, Sam
... | 29,208 |
Pieces of Parentheses
Description:
You are teaching a class in programming, and you want to
cover balanced parentheses. You’ve got a great visual aid, a
sign with a very long, balanced string of parentheses. But,
alas, somehow, your visual aid has been broken into pieces, and
some pieces may be missing... | 29,209 |
Pig Latin
Description:
Ancay youyay eakspay igpay atinlay? (Can you speak pig
latin?) If you can’t, here are the rules:
* If a word begins with a consonant, take all of the
letters before the first vowel and move them to the end of
the word, then add ay to the end of
the word. Examples: pi... | 29,210 |
Pigstep
Description:
Steve and Alex have a challenge for you. They are each
thinking of an integer between $1$ and $500$, and your task is to guess their
numbers. If you can guess both numbers in $10$ guesses, they’ll give you a rare
prize: a Pigstep music disc. Are you up to the
challenge?
To make it... | 29,211 |
Pillow Stacking
Description:
Eleanor has recently lost her favorite pillow. Being very
particular about her pillows, she categorizes pillows by their
softness. The pillow she lost had softness $C$, and she will be unable to sleep
without this exact softness. While she has access to some other
types of ... | 29,212 |
Pinball
Description:
Maria is quite addicted to pinball. She can shoot the ball
to any position at the top of the board, but she cannot predict
where the ball will end when it falls down, because it hits
many bumpers on its way down.
She decided to model the pinball table as line segments and
assume t... | 29,213 |
Ping Pong Tournament
Description:
Rulls is a true enthusiast of PO (the Pingis Olympiad). He
loves following the matches and cheering on his favorite
players as they compete.
PO is a table tennis tournament with an exciting format. The
tournament begins with $N$
players, where each player has a starti... | 29,214 |
Pinned Files
Description:
You recently discovered a new feature in Visual Studio —
pinned files! You have no idea what pinned files are good for —
you could hear a pin drop when you asked your friends about it
— but that doesn’t stop you from pinning and unpinning files
all day and night.
Visual Studi... | 29,215 |
Pinni Frændi
Description:
Hannes was ordering a pizza, but had forgotten his PIN, as
per usual. Luckily he has it saved in the contact Pinni Frændi
on his phone. While he was still looking at that contact he got
the confirmation number from Panucci’s Pizza. Surprisingly
enough his PIN number and the co... | 29,216 |
Pipe Rotation
Description:
The four ninja turtles: Leonardo, Donatello, Michelangelo,
and Raphael are seeking a new home in Manhattan, New York City.
The turtles don’t like sudden dead-ends in their home.
Fortunately, the government recently installed a new sewage
system where pipes can be rotated! The... | 29,217 |
Pipe Stream
Description:
In the possible event that somebody somewhere decides they
want some Flubber, they would like to know how quickly it will
flow through the pipes. Measuring its rate of flow is your
job.
You have access to one of the pipes connected to the
network. The pipe is $l$
meters lo... | 29,218 |
Pipes
Description:
Kažimír got an important job at the plumbing department. He
needs to connect certain pairs of locations by pipes. However,
as the department’s budget is very low, they have only two
types of pipe parts: straight and “elbow” (L) shaped ones, all
of the same size. Moreover, each pipe p... | 29,219 |
Pipes
Description:
After writing a solver for the “moveable maze” game last
week, you have grown tired of it. After all, you already know
the optimal solution. To entertain yourself, you find another
puzzle game called “Pipes”, and play that for a while. On one
puzzle, you have not been able to find a ... | 29,220 |
Pipes
Description:
The construction of office buildings has become a very
standardized task. Pre-fabricated modules are combined
according to the customer’s needs, shipped from a faraway
factory, and assembled on the construction site. However, there
are still some tasks that require careful planning, ... | 29,221 |
Pirate Chest
Description:
Pirate Dick finally had enough of fighting, marauding,
theft, and making life miserable for many on the open seas. So
he decided to retire, and he found the perfect island to spend
the rest of his days on, provided he does not run out of money.
He has plenty of gold coins now,... | 29,222 |
Pitch Performance
Description:
After a recent disaster at the Easter party karaoke, you are
working on improving your singing. To gauge how well you are
doing, you would like to measure how much the pitch and timing
of your singing differs from the target melody you were trying
to perform.
We model th... | 29,223 |
Pivot
Description:
An $O(n)$ Partition algorithm partitions an array
A around a pivot element (pivot
is a member of A) into three parts: a
left sub-array that contains elements that are $\leq $ pivot, the pivot
itself, and a right sub-array that contains elements that are
$>$ pivot.
A Partition al... | 29,224 |
Pixelated
Description:
An LCD panel is composed of a grid of pixels, spaced
$1$ alu (“arbitrary length
unit”) apart both horizontally and vertically. Wires run along
each row and each column, intersecting at the pixels. Wires are
numbered beginning with $1$ and proceeding up to a
panel-dependent ma... | 29,225 |
Pizza Crust
Description:
George has bought a pizza. George loves cheese. George
thinks the pizza does not have enough cheese. George gets
angry.
George’s pizza is round, and has a radius of $R$ cm. The outermost $C$ cm is crust, and does not have
cheese. What percent of George’s pizza has cheese?
## Inpu... | 29,226 |
Pizza Cutting
Description:
Pizzas are usually cooked as a circle, and are often cut
“triangularly” along lines moving out from the center, as shown
on the left in Figure 1 below. However, some heretical people
prefer that the pizza be cut into rectangular pieces, as shown
on the right in the figure:
A... | 29,227 |
Pizza Delivery
Description:
Your Irish pizza and kebab restaurant is doing very well.
Not only is the restaurant full almost every night, but there
are also an ever increasing number of deliveries to be made,
all over town. To meet this demand, you realize that it will be
necessary to separate the deli... | 29,228 |
Pizza Hawaii
Description:
You are travelling in a foreign country. Although you are
also open to eat some regional food, you just cannot resist
after you have found an Italian restaurant which offers pizza.
Unfortunately the menu is written in the foreign language, so
the list of ingredients of the piz... | 29,229 |
Pizza Party!
Description:
You are co-organizing a computer science conference, and you
are in charge of a pizza party for the conference guests. Each
guest holds preferences over combinations of toppings, and
guests are seated in groups by table in the conference center
ballroom. One pizza is served to... | 29,230 |
Pizza Problems
Description:
Me and my friends are ordering a big pizza to share. As you
can imagine this is quite complicated, since everyone has
different wishes about what should be on the pizza. For
instance Gunnar wants bananas on the pizza, Emma doesn’t want
bananas but wants olives, Marc wants th... | 29,231 |
Pizza slicing
Description:
Tonight you will be at one of the regular GAUSS sky observation nights, and as
always there’s free pizza. The $N$ participants have ordered a single
giant $A\times B$
rectangular pizza that you will have to share between you. To
break the monotony of looking at differently si... | 29,232 |
Pizzastrengur
Description:
Today is game day at Tommi’s pizzas so Georg and his friends
are going to order some pizzas. The game starts with the
employees at Tommi’s pizzas choosing a secret passcode,
consisting only of the letters {“P”,
“I”, “Z”,
“A”}, and telling the customer the
length of th... | 29,233 |
Pizzubestun
Description:
Nonni has asked his guests what kind of pizza they would
like, so he knows how many pizzas need to be ordered.
Nonni wishes to pay as little as possible for the pizzas and
asks you for help. Given the pizzas he wishes to order and the
price of each pizza you need to figure out whi... | 29,234 |
Plan Your Guesses
Description:
After the Deer God heals Ashitaka in the forest, Ashitaka
gives San a challenge to distract himself. He tells San that
his favorite number is between $1$ and $n$, and wants her to guess it.
Anytime San guesses a number, she will be told that the
guess is correct, or that it ... | 29,235 |
Plane Ticket Pricing
Description:
Plane ticket prices fluctuate wildly from one week to the
next, and their unpredictability is a major source of
frustration for travellers. Some travellers regret buying
tickets too early when the prices drop right after they
purchase the tickets, and some travellers r... | 29,236 |
Planes, Trains, but not Automobiles
Description:
Being a traveling salesman is tough work. Per is one such
salesman and would like to find an efficient way to visit all
the cities in a foreign country exactly once.
Per defines efficiency in a peculiar way as Per hates flying
on planes. Even worse, he abso... | 29,237 |
Planet Destruction
Description:
Darth Vader is back to his favourite hobby: destroying
planets (or their population to be precise). He just discovered
that the rebel leadership has gathered at a planet named
Watooine, so he must act quickly to eliminate the threat.
Unfortunately, the Empire is in a pre... | 29,238 |
Planet Hopping
Description:
As part of the Constellation Commerce and Planetary
Connections company (CCPC), you are tasked with mining
resources from planets in the Milky Way. As a part of this
task, you are given a spaceship that can travel to different
planets in the Milky Way, as well as a device th... | 29,239 |
Planetaris
Description:
Oh, no. Atli has just painted himself into a corner. He has
been playing the video game Planetaris and decided to
start a war against his friend Finni. The downside is Finni had
a considerably larger spaceship fleet than Atli expected. Atli
now needs your help to turn the tide, ... | 29,240 |
Planetary Grid
Description:
Yraglac wants to get around within his gated community on
Mars, Cossin. The Cossin community grounds are precisely – but
strangely – shaped. Yraglac has spent many hours studying the
grounds and has figured out the logic behind the
landscaping.
If you put the landscaper’s h... | 29,241 |
Planete
Description:
The European Space Agency has $N$ telescopes observing distant
planets. They have classified $M$ different types of events. They
noticed that every day on each planet there is exactly one type of event. They measure events
in days because they discovered each event lasts at least one
... | 29,242 |
Planets
Description:
The spaceport likes collecting data on its visitors. We know
that there are $p$ nearby
planets that generate all traffic in and out of the spaceport.
Each planet contains $n$
species and every ship contains $m$ passengers of a particular
species. No two planets contain the same... | 29,243 |
Planina
Description:
Mirko and Slavko are filming a movie adaptation of the
popular SF novel “Chicks in space 13”. The script requires them
to present a lot of different worlds so they decided to film
the entire movie in front of a green screen and add CGI
backgrounds later. Mirko heard that the best w... | 29,244 |
Plankton Food
Description:
Only few ZOOs can afford to cultivate all types of plankton
food they need to feed to various sea vertebrates and
invertebrates which live in their voluminous aquariums. Some
ZOOs might be from time to time in a short supply of a
particular kind of plankton food which is mome... | 29,245 |
Planting Trees
Description:
Farmer Jon has recently bought $n$ tree seedlings that he wants to
plant in his yard. It takes $1$ day for Jon to plant a
seedling1, and for each tree Jon knows exactly
in how many days after planting it grows to full maturity. Jon
would also like to throw a party for his fa... | 29,246 |
Plants vs Bad Guys
Description:
Oh no! There are a bunch of bad guys creeping around on
Mikael’s lawn, and they all want to attack Mikael! Luckily,
Mikael has planted several peashooters on his lawn that can
protect him from the bad guys.
Mikael’s lawn consists of $N$ rows, where Mikael has planted
$R... | 29,247 |
Platform Placing
Description:
The city of Atlantis is making an above-water section. They
are doing so by building floating platforms that are anchored
at their centers to foundation points that lie in a straight
line at the bottom of the ocean. Each platform is a fixed-width
rectangle aligned to the f... | 29,248 |
Platforme
Description:
A level is being designed for a new platform game. The
locations of the platforms have been chosen. Contrary to
popular opinion, platforms can’t float in the air, but need
pillars for support. More precisely, each of the two ends of
the platform needs to be supported by a pillar ... | 29,249 |
Playfair Cipher
Description:
The Playfair cipher is a manual symmetric encryption
technique and was the first digraph substitution cipher. The
scheme was invented in 1854 by Charles Wheatstone, but bears
the name of Lord Playfair who promoted the use of the
cipher.
The Playfair cipher uses a $5$ by $5... | 29,250 |
Playground
Description:
George has $K \le 20$
steel wires shaped in the form of half-circles, with radii
$a_{1}, a_{2}, ...,
a_{K}$. They can be soldered (connected) at the ends, in
any angle. Is it possible for George to make a closed shape out
of these wires? He does not have to use all the wires... | 29,251 |
Playing the Slots
Description:
The small nation of Erratica prides itself on defying
conventions established by the more “boring” countries around
the world. One of their more obvious distinctions lies in the
design of their coinage. Believing that a person should be
easily able to identify the value a... | 29,252 |
Playing with Geometry
Description:
Dynamic geometry software can help students understand
transformation geometry as it allows to visualize the effect of
transformations on a shape. Alice is learning the elementary
transformations – slides, flips and turns – or, more formally,
translations, reflections... | 29,253 |
Playing with Numbers
Description:
You have a list of $N$
numbers, each of the form $2^ a3^
b$ for some non-negative integers $a$ and $b$. You want to perform $N-1$ operations on these numbers.
Each operation acts on two numbers $X$ and $Y$ of your choice from the list,
replacing them with a new number ... | 29,254 |
Playlist
Description:
In order to give the show a sense of continuity, you have
decided that consecutive songs you play should have some detail
in common. For instance, if you start by playing Björk’s song
“Pagan Poetry”, you could continue with next playing matmos’
track “Enigma Machine for Alan Turin... | 29,255 |
Please, Go First
Description:
You are currently on a skiing trip with a group of friends.
In general, it is going well: you enjoy the skiing during the
day and, of course, the après-skiing during the night. However,
there is one nuisance: the skiing lift. As always, it is too
small, and can only serve ... | 29,256 |
Plotting Polynomials
Description:
Graphical calculators have become popular among high school
students. They allow functions to be plotted on screen with
minimal efforts by the students. These calculators generally do
not possess very fast processors. In this problem, you are
asked to implement a metho... | 29,257 |
Plus Minus
Description:
Matthew the physicist studies the quantum electro-dynamics
of a silicon-based rectangular microchip. The microchip
consists of a very large $N
\times M$ grid of electrons. Each electron has either
positive (up) or negative (down) spin, denoted by $+$ and $-$ respectively.
Matth... | 29,258 |
Podnizovi
Description:
You are given an array of integers of length $N$. Let $s_1, s_2, \ldots , s_ q$ be the
lexicographically sorted array of all its non-empty
subsequences. A subsequence of the array is an array obtained
by removing zero or more elements from the initial array.
Notice that some subs... | 29,259 |
Poetry Tower
Description:
Alice and Bob are young, aspiring poets. Alice likes
variation in poems, so she only gets impressed by a poems that
do not contain repeated words (and of course, the words used
have to be real words).
Bob has found $N$
six-sided blocks where each side has a letter or a wildca... | 29,260 |
Point in Polygon
Description:
## Input
Input contains several test cases. Each test case begins
with an integer $n$
($3 \leq n \leq 1000$).
Then follow the $n$
vertices of a simple polygon, one per line, each of the form
$x\ y$. The points may be
given in either clockwise or counterclockwise o... | 29,261 |
Pokeball Fever
Description:
Pokemon Go has become a recent trend. Zapray becomes
immediately addicted to the game after it comes out. Zapray’s
Pokemon journey begins with a bag of $100$ Pokeballs. Each time he
encounters a Pokemon, he keeps throwing Pokeballs to the
Pokemon until he either catches the ... | 29,262 |
Pokechat
Description:
The year is 2011, and you and your friend each got a copy of
the newly released Pokemon Diamond and Pearl games. You enjoy
playing the game together, but you can’t always be together and
talk while you’re playing because your mom makes you come home
after dark. This would be fine,... | 29,263 |
Pokegene
Description:
Professor Oak, the friendly neighbourhood Pokémon Professor,
has been getting a lot of questions about Pokémon ancestors
lately.
One of the things a lot of Pokémon trainers are curious
about is finding common ancestors of Pokémon in their Pokédex.
In particular, each Pokémon Trai... | 29,264 |
Pokemon Go Go
Description:
The program assumes that the user is in a city where travel
is restricted to moving only in the north–south and east–west
directions. The program also assumes that all poké stops are on
the intersection of two roads.
For example, consider a case where the application finds
f... | 29,265 |
Poker Hand
Description:
You are given a five-card hand drawn from a standard
$52$-card deck. The
strength of your hand is the maximum value $k$ such that there are $k$ cards in your hand that have the
same rank.
Compute the strength of your hand.
## Input
The input will consist of a single line, with fi... | 29,266 |
Poklon
Description:
Mirko got a set of intervals for his birthday. There are
many games he can play with them. In one of them, Mirko must
find the longest sequence of distinct intervals such that each
interval in the sequence is in the set and that each interval
contains the one that follows in the seq... | 29,267 |
Pokémon Ice Maze
Description:
You are hired as a level designer for the next Pokémon
series, with games called Ice and Fire. For
the first of these two games, players have to get through a
maze in an icy cave. The cave is represented as a grid, with
each square of the grid being either ice, gravel or a... | 29,268 |
Pole Colouring
Description:
All the street lights of lineland should be coloured red,
blue, green, yellow, black or white. Red and blue paint comes
in packages that suffice for two poles, and there’s some left
over blue paint in storage. Thus an even number of poles must
be red and an odd number must b... | 29,269 |
Police
Description:
Librarian Jurica has $N$ shelves in his library, and each
shelf can contain $M$
books. Jurica is a good librarian so he decided to make an
inventory in the library and, if it’s necessary, return the
books that aren’t in their place to their right place. He moves
the books in the... | 29,270 |
Polish Notation
Description:
One way of representing mathematical expressions is with
Polish (or prefix) notation, initially developed by Jan
Łukasiewicz (1878–1956) for use in logic. In this notation, the
operator appears before its operands. For example, rather than
writing
using so-called infix not... | 29,271 |
Political Development
Description:
A certain political party with $N$ members wants to develop some
brand new politics. In order to do so, the party plans to make
a committee for new political development. Clearly, the best
politics is developed when all committee members disagree with
each other, and ... | 29,272 |
Pollution Solution
Description:
As an employee of Aqueous Contaminate Management, you must
monitor the pollution that gets dumped (sometimes accidentally,
sometimes purposefully) into rivers, lakes and oceans. One of
your jobs is to measure the impact of the pollution on various
ecosystems in the water... | 29,273 |
Polly Gone
Description:
Polly, the programming parrot, has escaped. As Johan is in
desperate need for some programming skill, he wants to find
her. The only clue that Johan has about the escape route is
that Polly flew into his kitchen.
Johan has $N$ boxes on
his kitchen table, and each box has a cert... | 29,274 |
Polygon Area
Description:
Compute the area of a simple polygon, and the direction
(clockwise or counterclockwise) in which its vertices are
given.
## Input
Input contains up to $25$ test cases. Each test case begins
with an integer $n$
($3 \leq n \leq 1\, 000$).
Then follow the $n$
vertices o... | 29,275 |
Polygon Game
Description:
Jack and Jill are playing a game they call Polygon Game. In
this game they start with a convex polygon and then take turns
dividing the polygon into smaller parts. They divide the
polygon by drawing a straight line from one point on the border
of the original polygon to anothe... | 29,276 |
Polygonal Puzzle
Description:
During last year’s ACM ICPC World Finals in Marrakesh, one
of the judges bought a pretty wooden puzzle depicting a camel
and palm trees (see Figure 1). Unlike traditional jigsaw
puzzles, which are usually created by cutting up an existing
rectangular picture, all the piece... | 29,277 |
Polygraph
Description:
On the distant isle of Googlia, there are two cities,
Truthtown and Liarville. People from Truthtown always tell the
truth and people from Liarville always lie. While exploring
Googlia, you have run across a group of N inhabitants, and you
want to figure out which city each one c... | 29,278 |
Polyline Simplification
Description:
Mapping applications often represent the boundaries of
countries, cities, etc. as polylines, which are connected
sequences of line segments. Since fine details have to be shown
when the user zooms into the map, these polylines often contain
a very large number of se... | 29,279 |
Polynomial Multiplication 1
Description:
## Input
Standard input begins with an integer $T \le 100$, the number of test
cases.
Each test case consists of two polynomials. A polynomial is
given by an integer $1 \le n \le
255$ indicating the degree of the polynomial, followed
by a sequence of integers ... | 29,280 |
Polynomial Multiplication 2
Description:
## Input
Standard input begins with an integer $T = 1$, the number of test cases
(this is not a typo, there is always exactly one test
case).
Each test case consists of two polynomials. A polynomial is
given by an integer $1 \le n \le
131\, 071$ indicating the... | 29,281 |
Polyomino Powers
Description:
## Input
One line with two positive integers $h, w \leq 10$. Next follows an
$h \times w$ matrix of
characters ‘.’ or ‘X’, the ‘X’s
describing a polyomino and ‘.’
space.
## Output
A $k$-power with
$2 \leq k \leq 5$ copies
of a smaller polyomino: Output a $h\time... | 29,282 |
Pong Tournament
Description:
The Swedes wanted to arrange a ping pong tournament among
the $n$ high school
students in the nation. Since Sweden is the fairest country on
earth, they wanted to ensure that the ranking of all the
players is perfectly fair. Therfore, they decided that every
high school... | 29,283 |
Pony-less Express
Description:
Howdy, pardner! You’ve been put in charge of mail delivery
in these here parts. Your headquarters is in Capital City, and
Miss Penelope has asked us to tell all of the local farmsteads
about her fashionable doin’s. The roads hereabouts were built
so that each farmstead co... | 29,284 |
Pop!
Description:
A large number of helium balloons have been set up as part
of a carnival game. Players shoot a pellet gun into the
balloons and earn a point for every balloon they pop. Each
balloon is spherical and is tied to a string at the bottom.
Each string is taped to a table top at a particular... | 29,285 |
Popcorn
Description:
The culmination of the Galactic Popcorn Festival G-Pop is
undoubtedly the competitive eating event.
First, the participants are separated into four groups of
equal size. Then each participants competes against every other
member of the same group; the goal is to eat half a bag of
... | 29,286 |
Poplava
Description:
Mirko dreamt of a histogram last night that consists of
$N$ columns. Each column
is one meter wide and the heights of the columns in meters are
$h_1, h_2, \ldots , h_
N$.
The capacity of a histogram is the maximal amount of water
that a histogram can hold so that the configura... | 29,287 |
Popločavanje
Description:
Mirko’s ASCII street is made of $N$ lowercase letters of the English
alphabet. The city government occasionally replaces the tiles
in the street. However, the letter tiles are in high demand, so
the government has only $M$ different tile patterns
available.
The $i$th tile pat... | 29,288 |
Popular Vote
Description:
## Input
The first line of input contains a single positive integer
$T \leq 500$ indicating
the number of test cases. The first line of each test case also
contains a single positive integer $n$ indicating the number of
candidates in the election. This is followed by $n$ line... | 29,289 |
Popularity Contest
Description:
It’s not about what you know, but who you know. A
famous saying – but is it true? You start looking around
yourself, pondering what lies behind the success of some of
your friends. Could it be that life is just one big popularity
contest? Are all the hours you spend lear... | 29,290 |
Pork Barrel
Description:
Winning the election was simpler than you expected: it was
enough to promise to finally build a good quality, country-wide
road infrastructure, of course without crippling the
budget…Your happiness did not last long, however: it seems,
that the citizens have found a way to actu... | 29,291 |
Porridge Boxes
Description:
Julia loves porridge. So much in fact, that if she had the
possibility she would eat it all day, any day. However, due to
a busy schedule, she does not have time to make porridge every
day. But on days when she does have time to make porridge, she
can make a big batch in her... | 29,292 |
Portal
Description:
You think it would be funny to prank your best friend by
placing them on cell $(0,
0)$ of an infinite grid of coloured cells. The friend
then moves around the grid indefinitely, one step at a time,
always moving to one of the four adjacent cells.
$N$ of the cells on the
grid co... | 29,293 |
Positive Divisors
Description:
Given a positive integer $N$, compute all of its positive
divisors.
## Input
The first and only line contains the integer $N$ ($1
\le N \le 10^{15}$).
## Output
Output all the divisors of $N$, in ascending order, one per
line.
**Sample Input 1**
**Sample Output 1**
```... | 29,294 |
Poslozi
Description:
“Arrange” is a planetary popular Flash game. In “Arrange”
the player is given a permutation of numbers $1$ to $N$ and a list of allowed swaps. He
then has to perform a sequence of swaps that transforms the
initial permutation back to the ordered sequence $1,2,3,4,5, \ldots , N$.
In or... | 29,295 |
Postal Delivery
Description:
The postal service is interested in cutting costs as an
alternative to raising the postage rates. One way to do this is
by minimizing the distance traveled when delivering mail from
the post office to all the required locations and returning to
the post office. It may be th... | 29,296 |
Posterize
Description:
Pixels in a digital picture can be represented with three
integers in the range $0$
to $255$ that indicate the
intensity of the red, green, and blue colors. To compress an
image or to create an artistic effect, many photo-editing tools
include a “posterize” operation which wo... | 29,297 |
Pot
Description:
The teacher has sent an e-mail to her students with the
following task: “Write a program that will determine and output
the value of $X$ if given
the statement:
and it holds that $\mathit{number}_1$, $\mathit{number}_2$ to $\mathit{number}_ N$ are integers, and
$\mathit{pow}_1$,
$... | 29,298 |
Potion Commotion
Description:
You are incredibly close to becoming the Pokemon champion,
but one final obstacle stands in your way: the Elite Four.
Throughout your journey, you raised your starter Pokemon to a
high enough level, and out of a show of loyalty to your
favorite Pokemon, you vowed to never ... | 29,299 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.