id
stringlengths
10
13
content
stringlengths
424
1.17M
app_data_3000
Two great friends, Eddie John and Kris Cross, are attending the Brackets Are Perfection Conference. They wholeheartedly agree with the main message of the conference and they are delighted with all the new things they learn about brackets. One of these things is a bracket sequence. If you want to do a computation with...
app_data_3001
“Sabotage!” exclaimed J.R. Diddly, president and founder of Diddly Widgets Inc. “Vandalism, perhaps. Nothing’s actually been damaged.” responded Robert Lackey, the chief accountant. Both were staring up at the large counter suspended above the factory floor, a counter that had faithfully recorded the number of widge...
app_data_3002
Every modern car has an odometer. It measures how far the car has traveled, and is used, among other things, to decide when to service a car. Sometimes, however, unscrupulous characters who want to sell a car might tamper with its odometer to make the car seem younger than it is. Tommy Catkins wants to buy a used car...
app_data_3003
To address the impending STEM shortage early on, your local elementary school decided to teach graph theory to its kindergarten students! To tap into their age-specific skills, the students are asked to color the vertices of a graph with colors of their own choosing. There is one constraint, however: they cannot use th...
app_data_3004
You need to hire some people to paint a fence. The fence is composed of $10000$ contiguous sections, numbered from $1$ to $10000$. You get some offers from painters to help paint the fence. Each painter offers to paint a contiguous subset of fence sections in a particular color. You need to accept a set of the offers,...
app_data_3005
Spotting patterns in seemingly random strings is a problem with many applications. E.g., in our efforts to understand the genome we investigate the structure of DNA strings. In data compression we are interested in finding repetitions, so the data can be represented more efficiently with pointers. Another plausible exa...
app_data_3006
To store DNA sequences your company has developed a LongLongString class that can store strings with up to ten billion characters. The class supports two basic operations: - Ins($p$, $c$): Insert the character $c$ at position $p$. - Del($p$): Delete the character at position $p$. A DNA editing program is written as...
app_data_3007
Trapped at home in quarantine, Johan tries to keep madness at bay and fend off isolation by playing Critter Junction, a social simulation video game. One of the main aspects of the game is collecting and harvesting various types of resources, in order to gain Bling, the currency of the game. Johan specializes in runnin...
app_data_3008
The online retailer Amagoogsoftbook currently offers $N$ different so-called “home assistants”, which it wants to recommend to its customers. For this recommendation, they wish to rank all the assistants. The quality of this ranking is not very important – multiple assistants may even be assigned the same rank – but th...
app_data_3009
A properly designed room is, as we all know, well-lit. In keeping with the teachings of Feng Shui, you have placed a number of lamps around a newly-designed room at strategic places to give it a friendlier air. Some of the lights project positive energy, and the rest give out only negative energy. Luckily, your neigh...
app_data_3010
Peter is bored during his operating systems class, so he draws doodles on a sheet of paper. He feels like drawing abstract art using his ruler: he draws line segments by choosing two points in the plane and connecting them. Lots of them. Can you write a program that counts the number of distinct points at which the li...
app_data_3011
A Hill Number is a positive integer, the digits of which possibly rise and then possibly fall, but never fall and then rise. For example:12321 is a hill number. 12223 is a hill number. 33322111 is a hill number. 1232321 is not a hill number. Given a positive integer, if it is a hill number, print the number of pos...
app_data_3012
RB is a basketball coach and he has several teams of exceptionally skilled basketball players, who dominate basketball leagues all over the world. Why are RB’s players so good? The reason is that each of them has already mastered exactly one ball trick – either the Triple Spin, or the Power Charge. For convenience, we...
app_data_3013
Archimedes is the name of a new 2D video game, which is very simple: the player hits start, at which point their avatar moves along an Archimedean spiral starting from the origin. When they hit a button, the avatar detaches from the spiral in the direction it is currently moving. The goal is to hit a target. The avatar...
app_data_3014
You own a disco called the Boogie Always Persists Club. The club is famous for its multiple interconnected rooms to twist and shout in. The rooms and the corridors between them form a maze-like structure and for added bonus you have made all the corridors one-way. However, it turns out not everyone is as happy with you...
app_data_3015
Harry the Hamster lives in a giant hamster cage. Inside the cage there is a set of $n$ plastic balls connected by unidirectional hamster tubes of varying lengths. Harry is currently in ball $s$ and his bed is in ball $t$. Being a simple hamster, the hemispheres of Harry’s brain are not so great at communicating with e...
app_data_3016
Baby Timmy has a pool of balls that he plays with. The pool is made up of balls with $n$ different colors with a certain number of each color. Baby Timmy finds it interesting to order these balls in a line given certain conditions he made. Timmy has two conditions when playing his own game: - Balls of certain colors m...
app_data_3017
Theta has been learning about powers of $2$ in school. She notices that some numbers when written out contain powers of $2$ in their digit representation: for instance, $12560$ contains $256$ which is a power of $2$. She has been wondering how many such numbers there are. Can you write a program that counts how many n...
app_data_3018
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. Given the number of dice, the target number the pla...
app_data_3019
Today everyone is talking about big data. As a renowned data provider in the area, you now have $N$ precious pieces of data. You want to sell all $N$ pieces of data to $N$ customers. You can sell multiple pieces of data (including all and none) to a single customer. However, each piece of data must be sold to exactly o...
app_data_3020
“Drat!” cursed Charles. “This stupid carry bar is not working in my Engine! I just tried to calculate the square of a number, but it’s wrong; all of the carries are lost.” “Hmm,” mused Ada, “arithmetic without carries! I wonder if I can figure out what your original input was, based on the result I see on the Engine.”...
app_data_3021
We all know how to alphabetize a list of distinct words when you know the alphabet: One word may be a prefix of another longer word, in which case the shorter word always comes before the longer word. With any other two words there must be a first place in the words where their letters differ. Then the order of the wor...
app_data_3022
Is a world without cookies really worth living in? Alf and Beata do not think so. That’s why they spent the entire weekend baking an enormous amount of cookies. They baked $A$ almond biscuits, $B$ butter cookies and $C$ chocolate macarons. It is now time to eat all these delicious cookies with their friends. The cooki...
app_data_3023
On his birthday, John’s parents made him a huge birthday cake! Everyone had a wonderful dinner, and now it’s time to eat the cake. There are $n$ candles on the cake. John wants to divide the cake into $n$ pieces so that each piece has exactly one candle on it, and there are no left-over pieces. For that, he made $m$ cu...
app_data_3024
Let $s$ be a given string of up to $10^6$ digits. Find the maximal $k$ for which it is possible to partition $s$ into $k$ consecutive contiguous substrings, such that the $k$ parts form a palindrome. More precisely, we say that strings $s_0, s_1, \dots , s_{k-1}$ form a palindrome if $s_ i = s_{k-1-i}$ for all $0\leq i...
app_data_3025
In the hills of a distant land there is a valley with many villages. The villages are all ruled by a cruel king who demands that each village pay him tribute in gold each year. The villages are required to bring gold to the king as quickly as possible when he demands it. There is a bandit village in the kingdom. The b...
app_data_3026
Zapray really loves the Algorithmic Problem Solving course, but he is struggling with it. Recently the class studied Longest Increasing Subsequence (LIS). Zapray knows well how to compute the length of LIS for a given sequence. But on the exam paper there appears to be a different question: “We say an element in a sequ...
app_data_3027
Bureaucrats love bureaucracy. This assertion seems fairly obvious but a less obvious observation is the amount of paperwork this means! When paperwork is complete, a bureaucrat stamps the official document with their official stamp of office. Some bureaucrats are extra thorough and stamp the document multiple times. W...
app_data_3028
Primonimo is a game played on an $n \times m$ board filled with numbers taken from the range $1 \ldots p$ for some prime number $p$. At each move, a player selects a square and adds $1$ to the numbers in all squares in the same row and column as the selected square. If a square already shows the number $p$, it wraps ar...
app_data_3029
You are given a rooted tree of $N$ vertices where each vertex $v_1$ through $v_ N$ is labeled with a non-negative integer $u_1$ through $u_ N$. The vertex $v_1$ is the root. Define a “jumping path” within the tree to be a sequence $a_1, a_2, \ldots , a_ k$ of length $k$ where $v_{a_ i}$ is an ancestor of $v_{a_ j}$ fo...
app_data_3030
You are given a rooted tree with $n$ nodes. The nodes are labeled $1$ to $n$, and node $1$ is the root. Each node has a value $v_ i$. You would like to turn this tree into a heap. That is, you would like to choose the largest possible subset of nodes that satisfy this Heap Property: For every node pair $i$,$j$ in the ...
app_data_3031
The Transit Authority of Greater Podunk is planning its holiday decorations. They want to create an illuminated display of their light rail map in which each stretch of track between stations can be illuminated in one of several colors. At periodic intervals, the controlling software will choose two stations at rando...
app_data_3032
The term “Harvard architecture” applies to a computer that has physically separate memories for instructions and data. The term originated with the Harvard Mark I computer, delivered by IBM in 1944, which used paper tape for instructions and relays for data. Some modern microcontrollers use the Harvard architecture –...
app_data_3033
For every positive integer we may obtain a non-negative integer by multiplying its digits. This defines a function $f$, e.g. $f(38) = 24$. This function gets more interesting if we allow for other bases. In base $3$, the number $80$ is written as $2222$, so: $f_3(80) = 16$. We want you to solve the reverse problem: g...
app_data_3034
The Bluewater Geocloud Organization (BGO) has recently developed brand new software able to predict with pinpoint precision at which second any particular cloud will start and stop raining, and with what intensity. There is, however, some uncertainty about how a cloud will move around; for each zip code, each cloud wil...
app_data_3035
The lunch break just started! Your mother gave you one litre of pink lemonade. You do not like pink lemonade and want blue lemonade instead. Fortunately for you the other children in class are willing to trade with you. Each of them is willing to offer you any quantity of the virtually infinite amount of lemonade they...
app_data_3036
The world-renowned Swedish Chef is planning a gourmet three-course dinner for some muppets: a starter course, a main course, and a dessert. His famous Swedish cook-book offers a wide variety of choices for each of these three courses, though some of them do not go well together (for instance, you of course cannot serve...
app_data_3037
Mr. Turtle loves drawing on his whiteboard at home. One day when he was drawing, his marker dried out! Mr. Turtle then noticed that the marker behaved like an eraser for the remainder of his drawing. Mr. Turtle has a picture in his head of how he wants his final drawing to appear. He plans out his entire drawing ahead...
app_data_3038
You are the owner of IKEA, and you need to order a large number of bolts $B$. There is a single bolt manufacturer, but there are multiple companies reselling these bolts in packs (e.g. boxes, pallets). These companies form a directed chain, where each company buys packs from the previous company and combines these into...
app_data_3039
It is well known that a set of six unit squares that are attached together in a “cross” can be folded into a cube. But what about other initial shapes? That is, given six unit squares that are attached together along some of their sides, can we form a unit cube by folding this arrangement? -----Input----- Input consi...
app_data_3040
Given an input string composed solely of lowercase English letters, find the longest substring that occurs more than once in the input string. The two occurrences are allowed to partially overlap. -----Input----- The input is a single line containing a string of lowercase letters. The string contains more than one cha...
app_data_3041
Johan lives in Stockholm, which means he has to travel a lot by bus and subway. To travel, he needs to pay a number of coupons, depending on which zones his trip goes between. A ticket is specified by an interval $[A, B]$ of zones it is valid in, and costs $2 + |A - B|$ coupons to purchase. When Johan buys a ticket, i...
app_data_3042
An LCM tree is a binary tree in which each node has a positive integer value, and either zero or two children. If two nodes $x$ and $y$ are the children of node $z$, then the Least Common Multiple (LCM) of the values of node $x$ and node $y$ must equal the value of node $z$. You are given $n$ nodes with positive inte...
app_data_3043
You are a treasure hunter searching for gold in the wild. Luckily you got a map of the area from a black marketeer. The map clearly shows where a box of gold is along with the surrounding terrain. Of course, you want to head to the treasure as fast as possible. However, the trip might not be easy. The area is describe...
app_data_3044
Your friend just bought a new programmable robot and has asked for your help. The robot operates in a 2D grid that may contain obstacles. The environment has a known start location and a known goal location. The robot is controlled with a string consisting of commands L, R, U, and D, which respectively instruct the rob...
app_data_3045
The Manhattan Positioning System (MPS) is a modern variant of GPS, optimized for use in large cities. MPS assumes all positions are discrete points on a regular two-dimensional grid. Within MPS, a position is represented by a pair of integers $(X,Y)$. To determine its position, an MPS receiver first measures its dista...
app_data_3046
In the recently proposed Visual Python++ programming language, a block of statements is represented as a rectangle of characters with top-left corner in row $r_1$ and column $c_1$, and bottom-right corner in row $r_2$ and column $c_2$. All characters at locations $(r, c)$ with $r_1 \leq r \leq r_2$ and $c_1 \leq c \leq...
app_data_3047
Theta likes to play Lure of the Labyrinth, which is an online game that uses a compelling graphic novel storyline to engage middle grades students in mathematical thinking and problem-solving. To find lost pets, students have to infiltrate a world of monsters and solve puzzles! Implemented by a professional game studio...
app_data_3048
The Kanto region has $N$ junctions and $N - 1$ bidirectional roads. Junctions are numbered from $1$ to $N$, inclusive. All roads have the same length and each of them connects two different junctions. At any moment, a Pokenom can appear in any of these junctions. To become the best Pokenom trainer, like no one ever w...
app_data_3049
The Swedish Military Intelligence and Security Service (Militära underrättelse- och säkerhetstjänsten, MUST) is trying to locate a submarine in the Stockholm archipelago. They have been intercepting encrypted messages that they believe contain information on the location and route of the submarine. Now all that remains...
app_data_3050
You are the boss of ACM (Association for Cool Machineries), an upstanding company with a single goal of world domination. Like all other world domination oriented villains, you dream of having a gigantic evil robot doing evil deeds. I mean, is there anyone who can resist the urge of having your own personal gigantic l...
app_data_3051
For many people, the word “Peru” conjures up images of the Inca temple Machu Picchu and llamas. But for some visitors to the country, even more remarkable is the sight of fog-catching nets, or atrapanieblas, that Peru is using to harvest water from dense fogs. These nets capture tiny droplets from the fogs, and the wat...
app_data_3052
Many airports have moving conveyor belts in the corridors between halls and terminals. Instead of walking on the floor, passengers can choose to stand on a conveyor or, even better, walk on a conveyor to get to the end of the corridor much faster. The brand new Delft City Airport uses a similar system. However, in lin...
app_data_3053
Rarity is designing new clothes, and she is looking for some inspiration! Recently, she learned about the importance of symmetry, and is trying to find ways to incorporate this idea into her designs. To learn more about symmetry, she decided to search for inspiration in a naturally-symmetric concept, palindromes. A pa...
app_data_3054
A haiku is a three-line poem in which the first and third lines contain $5$ syllables each, and the second line contains $7$ syllables. An example of a haiku is: Blue Ridge mountain road. Leaves, glowing in autumn sun, fall in Virginia. Write a program to examine a line of English text and and attempt to render...
app_data_3055
Thore Husfeldt likes to compare his time on solved Kattis problems with other people. If he has written the fastest solution on a problem he screams “I’m amazing” in pure joy. However if his solution is not the fastest he likes to find out if he is the best Thore, or maybe the best ThoreH on the scoreboard. He is the b...
app_data_3056
In an infinite binary tree: - Each node has exactly two children – a left and a right child. - If a node is labeled with the integer $X$, then its left child is labeled $2X$ and its right child $2X+1$. - The root of the tree is labeled 1. A walk on the binary tree starts in the root. Each step in the walk is either...
app_data_3057
According to Mårten’s Theorem, everything which rhymes is the same thing. For example, Sheep is the same thing as Heap, Dictionary Attack is the same thing as Stack, and Tree is the same thing as the Mediterranean Sea. Strangely, some people have objected to Mårten’s Theorem, despite being rigorously proved by Johan’s...
app_data_3058
It is 2178, and alien life has been discovered on a distant planet. There seems to be only one species on the planet and they do not reproduce as animals on Earth do. Even more amazing, the genetic makeup of every single organism is identical! The genetic makeup of each organism is a single sequence of nucleotides. Th...
app_data_3059
A speedrun is a playthrough of a game with the intention to complete it as quickly as possible. When speedrunning, you usually follow a pre-planned path through the game. Along this path, there may be some places where you have to pull off a difficult technique, or trick, which may cause a delay if you fail to pull it ...
app_data_3060
Gwen loves most numbers. In fact, she loves every number that is not a multiple of $n$ (she really hates the number $n$). For her friends’ birthdays this year, Gwen has decided to draw each of them a sequence of $n-1$ flowers. Each of the flowers will contain between $1$ and $n-1$ flower petals (inclusive). Because of ...
app_data_3061
Filiberto is planning a race to celebrate the 2019 ICPC Mid-Central Regional. The racers compete by going down a mountain on a set of roads. As it would be dangerous to have cars speeding at each other in opposite directions, racers may only drive downhill on each road in a single direction. The endpoint of each road i...
app_data_3062
You are programming an autonomous rocket powered hovercraft. The vehicle can travel very, very fast, but turning is difficult. Since it’s hovering, it turns by firing directional thrusters, which will turn the vehicle whether it is moving forward or is stationary. The salt flats on which you’re testing have been mappe...
app_data_3063
In a little town called Križ live $N$ people. Each of them has borrowed some money from exactly one other inhabitant. Now the time has come to pay back all the debts, but the problem is that everybody has spent all of their money! The major of Križ has decided to solve this problem. The town will give money to a few p...
app_data_3064
A bicycle race is being organized in a country. The transport network of the country consists of $N$ cities numbered $1$ through $N$, with $M$ bidirectional roads connecting them. We will use the following terms: - A path is a sequence of roads in which each road starts in the city the preceding road ended in. - A si...
app_data_3065
Being a space captain can be a dangerous endeavour, especially when conducting missions in Borg space. Today your captain has been tasked with beaming aboard a Borg spaceship to see if he can discover anything useful. The Borg ship consist of rooms connected with passages of equal length, and with no more than one dire...
app_data_3066
Raelynn is trying to learn the newest craze in modern art: Tape Art! This wonderful new type of art is created by taking a wooden plank and pieces of tape of different colors. Each artwork is constructed by taking multiple pieces of tape and placing them on the plank. For each color that appears in the artwork, only a ...
app_data_3067
Pasijans, patience, or solitaire is the name for a group of single player card games. One new such game, so new it has no name, is played with cards sporting random integers as values. The game starts by shuffling all cards and distributing them in $N$ sequences, not necessarily of equal length. During each turn, the ...
app_data_3068
Black Vienna is a puzzle game where players try to deduce the secret identities of the three spies. There are $26$ suspects, represented by cards with a single letter from ‘A’ to ‘Z’. Suspect cards are shuffled and three are secretly set aside; these form the Black Vienna circle. The remaining $23$ cards are distribute...
app_data_3069
A bracket sequence consisting of ‘(’ and ‘)’ is defined to be valid as follows: - An empty sequence is valid. - If $X$ is a valid bracket sequence, then $(X)$ is a valid bracket sequence. - If $X$ and $Y$ are valid bracket sequences, then the concatenation of $X$ and $Y$, $Z=XY$, is a valid bracket sequence. For e...
app_data_3070
In the free-market, ruthlessly capitalist world of train fares, only one thing matters: incentives. Train companies are incentivised with bonuses for high throughput, successful journeys, and customer satisfaction. Conversely, the companies are disincentivised from failure via mandatory refunds for customers delayed b...
app_data_3071
In a tournament with $m$ teams, each team consisting of $n$ players, construct a playing schedule so that each player is paired up against all players in all teams except their own. That is, each player should play $(m-1) \cdot n$ games. The playing schedule should be divided into rounds. A player can play at most on...
app_data_3072
Mirko has bought an apartment and wants to invite to dinner as many people as possible to celebrate with him. For this he needs a large rectangular wooden table for which he will sit down with his guests. The number of people a table can accommodate is equal to its perimeter (the sum of the lengths of all four sides). ...
app_data_3073
Consider an infinite chessboard and a special knight whose move types can change given power-ups. The knight is trying to reach square $(0, 0)$. Some of the squares of the infinite chessboard have tarot cards on them. If the knight lands on some position $(r, c)$ on the infinite chessboard with a tarot card on it, the...
app_data_3074
Mr. Krabs is a hardcore cryptocurrency and blockchain technology enthusiast. In a recent conference, he heard about a new cryptocurrency called ByteConn333ct, which promises a very high rate of return. He wants to invest in this cryptocurrency, but its unique conversion rate to Canadian dollars makes him a bit apprehen...
app_data_3075
Tony is going on a road trip. Because gas is so expensive, Tony wants to carefully choose the gas stations he refuels at to save as much money as possible. For simplicity, assume Tony is driving on a straight road from left to right. There are $n$ gas stations along the road, where each gas station is uniquely identif...
app_data_3076
The grand museum has just announced a large exhibit on jewelry from around the world. In the hopes of his potential future prosperity, the world-renowned thief and master criminal Edward Terrenando has decided to attempt the magnum opus of his career in thievery. Edward is hoping to purloin a large number of jewels fr...
app_data_3077
Liam (angryneeson52) is playing his favorite tower defense game! This game involves destroying minions of his opponent while defending his own villages. Liam’s favorite attack is an Area of Effect attack. The Area of Effect attack is a perfect circle. Liam simply picks a center and a radius for the attack and every mi...
app_data_3078
We say that a sequence of $2K$ elements is interesting if neither the sum of the first $K$ elements, nor the sum of the last $K$ elements, is greater than $S$. A sequence $A$ of length $N$ is given. For every element, output the length of the longest interesting subsequence starting with that element. -----Input----- ...
app_data_3079
Having solved a tedious assignment, Mirko decided to play a game with his good friend Slavko. They have written a sequence of $N$ letters on a piece of paper. Each one of them is trying to put together a word using letters from the sequence. They alternate taking turns consisting of removing a single letter from the s...
app_data_3080
As an enterprising owner of a world-renowned ski resort in the US, you would like to increase your sales by stocking snack stands at key locations throughout your estate. The ski resort is built on a mountain. A ski lift can take a guest to the top of the mountain. From there they can ski to a number of locations thro...
app_data_3081
An airline company offers flights out of $n$ airports. The flight time between any given pair of airports is known, but may differ on direction due to things like wind or geography. Upon landing at a given airport, a plane must be inspected before it can be flown again. This inspection time is dependent on the airport ...
app_data_3082
You are buying lunch at a buffet. A number of different dishes are available, and you can mix and match them to your heart’s desire. Some of the dishes, such as dumplings and roasted potatoes, consist of pieces of roughly equal size, and you can pick an integral number of such pieces (no splitting is allowed). Refer to...
app_data_3083
You have been invited to host a famous radio show to tell your fascinating life story and play some of your favorite songs. However, choosing which songs to play is turning out to be very tricky; there are just way too many good songs and you only have enough time to play a measly nine songs! In order to give the sho...
app_data_3084
Arghs! Yet again, all the clocks in Petra’s home show the wrong time due to a power outage that occurred while she was sleeping. This means she has to spend her day resetting all the clocks to the correct time. Now, you might not consider this a big deal. After all, how many clocks does any single household really have...
app_data_3085
Balanced closed bracket or parenthesis statements are ones where each opening bracket is matched with a closed bracket later in the string. Notice how each closed parenthesis matches to the most recent unmatched open parenthesis. Define an alternative bracket notation as follows: each bracket pair corresponds to a he...
app_data_3086
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 day, and at most 365 days. Events l...
app_data_3087
Note that this is a harder version of problem dance. The change to the previous version is marked in bold. Marek loves dancing and he has danced a lot in the last couple of years. He has actually danced so much that he became too good in all of the traditional dances like swing, salsa, ballroom and hip-hop and now all...
app_data_3088
You are given a positive integer $n$ and asked to make it larger by swapping pairs of its digits. For each swap, you can choose two digits at different positions and exchange their positions, as long as the swap does not result in a leading zero. What is the largest number you can get after performing exactly $k$ swaps...
app_data_3089
You are operating a taxi company in the Land of Bytes, which is an interesting city. First, all roads in the city either along the north-south direction or along the east-west direction. Second, it’s an extremely large city such that the sizes of blocks between different roads are negligible. Therefore, each position i...
app_data_3090
Providing wireless network coverage for a large office can be tricky. In this problem you are asked to set up wireless network coverage for an entire office floor plan. The floor plan can be viewed as an $N\times M$ grid. Each grid cell represents a single office. Each pair of adjacent offices (cells that share a side)...
app_data_3091
KenKen is a popular logic puzzle developed in Japan in 2004. It consists of an $n \times n$ grid divided up into various non-overlapping sections, where each section is labeled with an integer target value and an arithmetic operator. The object is to fill in the entire grid with the numbers in the range 1 to $n$ such t...
app_data_3092
A road network in a country consists of $N$ cities and $M$ one-way roads. The cities are numbered $1$ through $N$. For each road we know the origin and destination cities, as well as its length. We say that the road $F$ is a continuation of road $E$ if the destination city of road $E$ is the same as the origin city of...
app_data_3093
Little Mirko spends his free time painting. For this hobby, he likes to use brushes and a palette containing $K$ colors overall. His friend Slavko decided to use Mirko’s talent and gave him his new coloring book for Mirko to color. The coloring book contains $N$ images numbered $1, 2, \ldots , N$. Mirko has decided to...
app_data_3094
The latest hit song Chair Hopping contains instructions for a group dance. To perform the dance, $n$ performers numbered from $1$ to $n$ and $n$ chairs numbered from $1$ to $n$ are required. Initially, performer $i$ is seated in chair $i$. When a single hop is performed, the performer currently seated in chair $i$ mov...
app_data_3095
Let us denote $A_{i,j}$ as the element from matrix $A$ located in the $i$-th row and $j$-th column. We say that the matrix $A$ is cool if this holds: - $r, s > 1$ - $A_{1,1} + A_{r,s} \leq A_{1,s} + A_{r,1}$ where $r$ denotes the number of rows, and $s$ the number of columns of matrix $A$. Additionally, we say that...
app_data_3096
Petar is throwing a birthday party and he decided to invite some of the employees of his company where he is the CEO. Each employee, including Petar, has a unique label from $1$ to $N$, and an accompanying type of jokes they tell $V_ i$. Also, each employee of the company except Petar has exactly one supervisor. Since...
app_data_3097
Anica is having peculiar dream. She is dreaming about an infinite board. On that board, an infinite table consisting of infinite rows and infinite columns containing infinite numbers is drawn. Interestingly, each number in the table appears a finite number of times. The table is of exceptionally regular shape and its ...
app_data_3098
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 defined by those vertices. Compute the expecte...
app_data_3099
You are a spy for the Benevolent Agent Protection Center (BAPC) and have recently obtained some top secret information. As you are very excited about this discovery, you want to inform your fellow spies of these newfound documents by sending a message to each of them. One option is to privately message all spies within...