id stringlengths 10 13 | content stringlengths 424 1.17M |
|---|---|
app_data_2900 | You are given a string $s$ consisting only of upper case letters A and B. For an integer $k$, a pair of indices $i$ and $j$ ($1 \le i<j \le n$) is called a $k$-inversion if and only if $s[i] = \textbf{B}$, $s[j] = \textbf{A}$ and $j-i = k$.
Consider the string BABA. It has two $1$-inversions and one $3$-inversion. It ... |
app_data_2901 | Johnny has been roped into a fantasy soccer league and needs your help to set up the best team.
He has a list of $10$ players that are on his fantasy team (no goalkeepers in this league). He also knows what country they’re from, what league they play in, and what team they play for.
He doesn’t know much about soccer... |
app_data_2902 | Baxter Scott owns The Enlightened Dairy Co., a dairy company with magical cows. Early each morning, he brushes his teeth, strolls outside, and finds that the cows have doubled in number. With double the number of cows, he can produce double the quantity of milk. While he is ecstatic that he has so many cows and so much... |
app_data_2903 | A Fenwick Tree (also known as a Binary Indexed Tree) is a data structure on an array which enables fast ($O(\log n)$) updates and prefix sum queries on the underlying data.
For this problem, implement a Fenwick Tree to support operations of two types: (a) increment an element in the array or (b) query the prefix sum o... |
app_data_2904 | At some point or another, most computer science students have written a standard Sudoku solving program. This is yet another “put numbers in a grid” puzzle.
Numbers are placed in the grid so that each outlined region contains the numbers $1$ to $n$, where $n$ is the number of squares in the region. The same number can... |
app_data_2905 | “It’s like how hot dogs come in packs of ten, and buns come in packs of eight or twelve — you have to buy nine packs to make it come out even.”
This is a quote from the 1986 movie, “True Stories”, and it’s true; well, almost true. You could buy four packs of $10$ hotdogs and five packs of $8$ buns. That would give y... |
app_data_2906 | Marek and his schoolmates have just finished their studies at the university. They wanted to celebrate it with a game of paintball. After an hour of playing a very strange thing happened – everyone had exactly one bullet left. Marek, being a very curious person, wanted to know whether it’s possible that everyone will b... |
app_data_2907 | Boris works at a secret communication station for the government training new employees on how to encode messages. Messages at this station are encoded with a rotation (“Caesar”) cipher that replaces each letter with one at a set offset in the alphabet, e.g., for offset $2$ an ‘a’ is replaced by a ‘c’ and ‘y’ is replac... |
app_data_2908 | Simon is a contestant on the new exciting game show, Add ’Em Up! In this show, contestants are given a set of cards with multi-digit numbers on them, and need to select two cards that add up to a given sum. However, to make things more interesting, the font that the cards are printed in (see below) means that certain c... |
app_data_2909 | Michael works in a bakery. At the end of his shift, his boss wants the breads sorted in a certain order. She can’t seem to decide on which order, though – every day there seems to be a new one – to Michael’s despair. Michael has worked there for a while now and has learned a neat trick with his wooden bakery paddle. He... |
app_data_2910 | Iskander the Baker is decorating a huge cake, covering the rectangular surface of the cake with frosting. For this purpose, he mixes frosting sugar with lemon juice and food coloring, in order to produce three kinds of frosting: yellow, pink, and white. These colors are identified by the numbers $0$ for yellow, $1$ for... |
app_data_2911 | You just finished participating in a programming contest with your friend. Unfortunately, you were unable to All Kill the contest (i.e., solve all of the problems), but you are now wondering if there might be some strategy that would have solved all of the problems.
Solving a problem has two phases, a thinking phase a... |
app_data_2912 | You are given a collection of $N$ non-empty strings, denoted by $S_1, S_2, \ldots , S_ n$. Then you are given $N$-$1$ operations which you execute in the order they are given. The $i^{th}$ operation is has the following format: ‘$a$$b$’ ($1$-based indexing, without the quotes), which means that you have to make the fol... |
app_data_2913 | Nathaniel collects rare gems and minerals, and has decided he has to protect his valuable collection from thieves. He is installing an electric eye system, in which he shines a laser into the room with his collection, and the laser will hit a sensor as long as no one steps in a spot that the laser crosses. Unfortunatel... |
app_data_2914 | Gunnar and his friends like games which involve rolling dice. Gunnar has a huge collection of 6-sided, 12-sided and 20-sided dice. All the games with dice started to bore him, so he came up with a new game. He rolls an $s$-sided die $n$ times and wins if at least $k$ different numbers appear in the $n$ throws. An $s$-s... |
app_data_2915 | 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 that all the mail to be delivered does not fit o... |
app_data_2916 | Trouble has come to the remote group of islands known as Insumulia. Due to an unfortunate combination of over-consumption, natural climate variations, and generally difficult conditions, the island of Incunabula has run out of trees. Because several other Insumulian islands depended on trees from Incunabula through tra... |
app_data_2917 | Last weekend you and your friends went to visit the local farmer’s market at the town square. As you were standing around in a circle talking, you couldn’t help overhearing two of your friends musing over what sounded like an interesting problem: They were considering the number of ways in which you could all shake han... |
app_data_2918 | You are organising a king of the hill tournament, the Buenos Aires Paddleboarding Competition (BAPC), with $n$ participants. In a king of the hill tournament, one person starts as a “king” and is then challenged by another person, the winning person becomes the new king. This is repeated until all participants have cha... |
app_data_2919 | Whitespace is an esoteric programming language (esolang) created in 2003 by Edwin Brady and Chris Morris. Many elements of Whitespace are familiar, including the fact that it is imperative and stack-based, but it has one main distinguishing feature: the only significant characters in a Whitespace source code file are [... |
app_data_2920 | You have recently made a grid traversing robot that can find its way from the top left corner of a grid to the bottom right corner. However, you had forgotten all your AI programming skills, so you only programmed your robot to go rightwards and downwards (that’s after all where the goal is). You have placed your robot... |
app_data_2921 | The University of Lagado is organising events for the upcoming Fresher’s week and has been told — much to the surprise of its staff — that some of the undergraduates may enjoy a beer tasting. While sourcing a wide variety of drinks for the students to taste, the university realised that in the interests of safety there... |
app_data_2922 | Cady’s Chocolate Company just opened down the street! Cady’s chocolate is world famous, and her recipe is top secret. But the company is more renowned for the fact that they sell the chocolate in random quantities. Each box of chocolate may contain anywhere from $1$ to $100$ pieces.
Bob’s nephews, John and Sam, love C... |
app_data_2923 | Two kingdoms had been at war for a long time, until the emperor intervened to bring an end to the conflict. The territory in question comprises an $M$ by $N$ rectangular grid. At the emperor’s insistence, the two kings have withdrawn their troops until no two opposing troops are in adjacent squares of the map (adjacent... |
app_data_2924 | Lucy is making her road bike ready for the season. All parts have been checked for wear and tear and washed clean and she is ready to put the beauty back together again. There is only one thing troubling her. During the winter she has been to several motivational talks by previous professional cyclists. They have all t... |
app_data_2925 | Your slightly pointy-bearded boss has assigned you to write software to find the best songs from different music albums. And the software should be finished in an hour. But don’t panic, you don’t have to solve the problem of writing an AI with good taste. At your disposal is the impeccable taste of a vast horde of long... |
app_data_2926 | When reading programming problems, one can often get some hints regarding the topic of the problem by skimming the problem statement for certain words. If, for example, the word “vertex” or “edge” appears, the problem is almost certainly a graph problem, while the words “words” or “letters” suggest that the problem is ... |
app_data_2927 | In a game of American Football, there are several factors to take into consideration when detailing the rules of the game. The goal of the game is to move the football across the field into the endzone of the defending team through a series of plays, which form a drive. In each play, the attacking team may either gain ... |
app_data_2928 | George has won the lottery and, being a nice guy, has decided to spread the wealth around. However, monetary gifts can be taxed once they get over a certain size—the amount of tax depends on how much his friends have earned that year.
The amount of tax paid depends on tax bands. The bands start at zero. Each one takes... |
app_data_2929 | It is monsoon season, and your goldfish Orange is stuck at the bottom of a cave system in Thailand. Every hour, the water rises by $1$ meter. Thankfully, Orange has the ability to swim instantaneously from one location to another. However, he can’t hop over the sharp rocks in the way.
You trust that Orange is smart an... |
app_data_2930 | A sequence of integers is said to Zigzag if adjacent elements alternate between strictly increasing and strictly decreasing. Note that the sequence may start by either increasing or decreasing. Given a sequence of integers, determine the length of the longest subsequence that Zigzags. For example, consider this sequenc... |
app_data_2931 | The 3rd round of COCI is already here! In order to bet on predict the scores, we have assumed the following:
- If contestant $A$ scored strictly more points than contestant $B$ in each of the first two rounds, then in the third round $A$ will score at least an equal amount of points as $B$.
Of course, in each round (... |
app_data_2932 | You have a string $s$ and you may modify it by making long swaps of its letters. Two letters can be swapped if their positions differ by at least $k$. That is, you may swap the $i$-th letter with the $j$-th letter in $s$ if $|i - j| \geq k$. Is it possible to sort all the letters in $s$ increasingly, if you are allowed... |
app_data_2933 | Wallace the Weightlifting Walrus is training for a contest where it will have to lift $1000$ kg. Wallace has some weight plates lying around, possibly of different weights, and its goal is to add some of the plates to a bar so that it can train with a weight as close as possible to $1000$ kg.
In case there exist two s... |
app_data_2934 | Pierre is famous for his macarons. He makes round macarons, stored in square boxes of size $1\times 1$, and oval-shaped macarons, stored in rectangular boxes of size $1\times 2$ (or, rotated, in rectangular boxes of size $2\times 1$). For the purpose of a buffet, Pierre wishes to tile a rectangular table of size $N\tim... |
app_data_2935 | Peter returned from the recently held ACM ICPC World Finals only to find that his return flight was overbooked and he was bumped from the flight! Well, at least he wasn’t beat up by the airline and he’s received a voucher for one free flight between any two destinations he wishes.
He is already planning next year’s tr... |
app_data_2936 | You may have heard of the “maximum subarray problem” from your university’s undergraduate algorithms course. The problem goes like this: You are given an array $A$ of $n$ integers, and the task is to find a contiguous subarray of $A$ whose sum is maximum. For example, in the array below:\[ \texttt{A := [-2, 3, 5, -7, 8... |
app_data_2937 | An elementary school class is going on a road trip by bus to a computer factory. However, the driver is really tired of having to drive fighting kids all day, so she suggested that the class should split up and go to the factory in groups. She has already observed which kids dislike each other and are likely to fight, ... |
app_data_2938 | Chess has been a long time passion of Yraglac. He spents at least an hour per day playing chess matches online or reading chess tactics books. The game is played by two players on an $8 \times 8$ grid, with each player taking turns to move a piece.
In this problem, we will consider a simplified variant of chess consis... |
app_data_2939 | A town is often divided into zones, e.g, industrial zones, commercial zones, and residential zones. If some residential zone is very far from all commercial zones, then the people living there will have a long journey whenever they want to do some shopping, and this is undesirable.
The input will consist of an $n\time... |
app_data_2940 | You are the boss of ACM (Association for Control over Minds), an upstanding company with a single goal of world domination.
Yesterday, you woke up, and saw that the weather was clear, and the birds were singing. “Another day, another world domination plan”, you sang to yourself as you devised your next world dominatio... |
app_data_2941 | You work at a clinic. The clinic factors in the waiting time when selecting patients to treat next. This approach was adopted to prevent patients from having to wait too long before being treated. Your task is to help the clinic perform $3$ types of queries:
- Process a patient arrival to the clinic. The patient will ... |
app_data_2942 | Susan is making high-speed videos of falling coffee mugs. When analyzing the videos she wants to know how big the mugs are, but unfortunately they all got destroyed during filming. Susan knows some physics though, so she has figured out how far they moved between different video frames. The camera was filming at a spee... |
app_data_2943 | Purple rain falls in the magic kingdom of Linearland which is a straight, thin peninsula.
On close observation however, Prof. Nelson Rogers finds that actually it is a mix of Red and Blue drops.
In his zeal, he records the location and color of the raindrops in different locations along the peninsula. Looking at the... |
app_data_2944 | According to Wikipedia, to hear something “through the grapevine” is to learn of something informally and unofficially by means of gossip or rumor. In this problem, you are tasked with determining how many people will hear about a particular rumor “through the grapevine” after a certain number of days.
Rumors are alwa... |
app_data_2945 | The local zoo has acquired a large open garden in which animals may freely move as in their natural habitats and entertain visitors with their usual shenanigans.
The most popular animals are monkeys. With their climbing and jumping and other skills, they delight old and young visitors alike.
One species of monkey has... |
app_data_2946 | Simone is learning to trade crypto currencies. Right now, she is looking into a new currency called CryptoKattis. A CryptoKattis can be used to improve your Kattis ranklist score without having to solve problems.
Simone, unlike most competitive programmers, is very perceptive of competition trends. She has lately noti... |
app_data_2947 | Lily is fascinated by numbers. She believes the whole world revolves around them, and that everything is connected by numbers. Her friends, Alice, Bob, Charlie and Diane, are not convinced. But she gives them an example: Alice lives in house number 25 on her street, but that is exactly Bob’s age. Bob is born on June 4... |
app_data_2948 | A land far, far away has N Members of Parliament (MP). They had a turbulent and passionate debate on the law on amendments to the law on a new referendum on referendums. From Monday to Friday, all MPs joyfully came to work and argued all day.
A diligent news reporter photographed MPs at their workplace in the heat of ... |
app_data_2949 | Last winter, an avalanche swept away all the ski lifts from the ski resort Valen. Instead of rebuilding the lifts like they were before, the plan is to do it in a more optimized way, and you are responsible for this.
The only thing remaining from the old lift system are $n$ pylons situated at integer coordinates in t... |
app_data_2950 | For the grand opening of the algorithmic games in NlogNsglow, a row of tower blocks is set to be demolished in a grand demonstration of renewal. Originally the plan was to accomplish this with controlled explosions, one for each tower block, but time constraints now require a hastier solution.
To help you remove the b... |
app_data_2951 | A tennis match involves three people: two players and an umpire. Each of these has to come from a different country. There are $N$ countries, and the $i$th country has $a_ i$ tennis players and $b_ i$ umpires. (Nobody can be both a player and an umpire.) How many different tennis matches are possible? Two tennis matche... |
app_data_2952 | Alice, Bob, and Clara are eating at a new restaurant today. They’re having trouble deciding what to order, so Alice proposes that they each pick some items from the menu, and then they will order the items that everyone picked. The menu has $m$ items, and Alice, Bob, and Clara will order $a$, $b$, and $c$ items respect... |
app_data_2953 | Quido plans to send a New Year greeting to his friend Hugo. He has recently acquired access to an advanced high-precision plotter and he is planning to print the greeting card on the plotter.
Here’s how the plotter operates. In step one, the plotter plots an intricate pattern of $n$ dots on the paper. In step two, the... |
app_data_2954 | Jimmy is performing in ByteLand today! Anthony the Ant is a huge fan of Jimmy’s music, so he can’t wait to get to the concert.
ByteLand consists of of $N$ intersections and $M$ roads. Every road is bidirectional and connects two distinct intersections. Anthony is currently on intersection $s$ and the concert is being ... |
app_data_2955 | Pia is getting ready for her flight to the NWERC 2018 in Eindhoven. As she is packing her hard drive, she remembers the airline’s ridiculous weight restrictions, which may pose a problem. You see, the hard drive is essentially a string of ones and zeros, and its weight depends on the number of “bit changes” in it: for ... |
app_data_2956 | Many phones use a nine-pivot unlock pattern. The nine pivots are arranged as a $3 \times 3$ grid, and numbered from $1$ to $9$ as shown in the figure. The unlock pattern is a single stroke that starts at any pivot and visits each pivot exactly once. The stroke goes in a straight line segment between each pair of consec... |
app_data_2957 | Löpkass is out running in the forest again. He loves running in the forest. However, there is a programming competition starting in a couple of hours, and he needs to calculate how long it will take him to get home (so that he can stay in the fresh air as long as possible). You have to help him out.
The forest is mode... |
app_data_2958 | Anthony and Cora are playing Dominion, their favorite card game. In Dominion, there are $T$ different card types, and each player has a set of cards (known as a deck). A deck $D$ is said to have $C$ combos if $C$ is the largest integer such that for $C$ different card types in the game, $D$ contains at least two cards ... |
app_data_2959 | Dee Siduous is a botanist who specializes in trees. A lot of her research has to do with the formation of tree rings, and what they say about the growing conditions over the tree’s lifetime. She has a certain theory and wants to run some simulations to see if it holds up to the evidence gathered in the field.
One thin... |
app_data_2960 | You might be familiar with the binomial coefficient ${m \choose k}$ defined as ${m \choose k} = \frac{m!}{k!(m-k)!}$, where $m$ and $k$ are non-negative integers and $k \leq m$. Let $T_2(n)$ be the number of odd binomial coefficients such that $0 \le k \le m < n$. The most useful mathematical inequality you will learn ... |
app_data_2961 | The Hogwarts School of Witchcraft and Wizardry is the home of many students during the school year. The school has many rooms connected by corridors and stairs. Each room has four exits labelled by the integers $1, 2, 3$ or $4$. Some exits lead to another room, some of them are blocked, and some even lead back to the s... |
app_data_2962 | Oliver is a manager of a bank near KTH and wants to close soon. There are many people standing in the queue wanting to put cash into their accounts after they heard that the bank increased the interest rates by $42\% $ (from $0.01\% $ per year to $0.0142\% $ per year).
However, there are too many people and only one ... |
app_data_2963 | Neelix has been working on making the Altonian warp bubble power itself up. While waiting for the system checks to complete, he saw a number on his screen and wondered if there is a number that powers itself up to this number.
-----Input-----
The first and only input line consists of a single integer $n$, the number N... |
app_data_2964 | Robert Hood, a less famous sibling of the Robin Hood, is fed up. Despite him being a young, talented archer he never seems to reach quite the same level as his legendary brother, and so he decided to come up with rules for a new archery contest, in which he will stand a better chance of winning.
The rules for the new ... |
app_data_2965 | Pumpkin Pete is trying out a new type of “rapid-growth” pumpkin seed that he bought from the farmer’s market. Without looking at the directions, Pumpkin Pete tears through the packaging and plants the seeds he has into his pumpkin patch. Unbeknownst to Pumpkin Pete, his rival, Gourd Gary, is watching him plant the new ... |
app_data_2966 | Quido and Hugo are making a chocolate cake. The central ingredient of the cake is a large chocolate bar, lying unwrapped on the kitchen table. The bar is an $M \times N$ rectangular grid of chocolate blocks. All of the $MN$ blocks are rectangles of identical shape and size. The chocolate bar is of top quality and the f... |
app_data_2967 | Penelope is part of the admin team of the newly built supercomputer. Her job is to assign workstations to the researchers who come here to run their computations at the supercomputer.
Penelope is very lazy and hates unlocking machines for the arriving researchers. She can unlock the machines remotely from her desk, b... |
app_data_2968 | You are leading a kayaking trip with a mixed group of participants in the Stockholm archipelago, but as you are about to begin your final stretch back to the mainland you notice a storm on the horizon. You had better paddle as fast as you can to make sure you do not get trapped on one of the islands. Of course, you can... |
app_data_2969 | In the card game Wolf (a variant of the famous card games War and Svälta räv), two players both have a pile of cards, which together form a normal deck of playing cards. Such a deck contains $52$ cards, with each card being a unique combination of one of $4$ suits and $13$ ranks.
During a turn, each player picks the t... |
app_data_2970 | A new student dorm has been opened! It consists of $M$ buildings, labeled with integers from $1$ to $M$. The dorm is initially empty, but soon $N$ students will be moving in at a rate of exactly one student per day.
Each time a new student moves in a building, a big party is being held inside that building. The noise ... |
app_data_2971 | Rhymes are complicated. The extent to which one word rhymes with another depends on how similar they sound; but if they are too similar then they aren’t considered a rhyme at all. Karim has a huge list of $N$ words and wants to determine the maximally rhyming pair of words. To that end he has introduced the concept of ... |
app_data_2972 | Nicholas Neverson was a student at Northlings Neverland Academy. As with any daydreaming student, Nicholas was playing around with a Kaleidoscope one day instead of paying attention to the teacher. Since this was math class, his daydreams quickly turned to palindromic numbers. A palindromic number is any number which r... |
app_data_2973 | Sheila is a student and she drives a typical student car: it is old, slow, rusty, and falling apart. Recently, the needle on the speedometer fell off. She glued it back on, but she might have placed it at the wrong angle. Thus, when the speedometer reads $s$, her true speed is $s+c$, where $c$ is an unknown constant (p... |
app_data_2974 | “[There] is a reason why the most successful trial lawyers are often master storytellers, making their cases come to life for their jurors.” –G. Christopher Ritter.
A good lawyer can take an incomplete set of facts and turn it into a convincing story.
Last night, a major robbery occurred at a bank, and, luckily, the... |
app_data_2975 | Lisa works as a waitress in a restaurant. Tonight is her birthday so Lisa asked the chef to prepare his special meal for her friends. The chef’s meal is made of $N$ ingredients. To prepare one serving of the meal he needs a certain amount of each ingredient.
There are some ingredients already available in the kitchen ... |
app_data_2976 | After Borko’s second plan of taking over the village fell through (because Mirko’s brother Stanko drank all the water), young Zvonko decided to relax with sports. For this purpose he stocked up on carrot juice and peanuts, and dived onto the couch, ready to watch the next tennis match on television.
While the two play... |
app_data_2977 | In the intergalactic low budget streaming show “Flag quiz!”, contestants need to answer questions along the lines of “What are the joint colors, symbols and shapes occurring on the flags of Empire $X$?”. An empire in this context is simply some subset of entities on the same planet, or otherwise related, according to t... |
app_data_2978 | A new town is being planned, and the designers have some very specific ideas about how things should be laid out. First, they lay out the streets. Each street is perfectly straight and passes completely from one end of the town to the other. These streets divide the town into regions, and each region is to be designate... |
app_data_2979 | Oh no! Hackers are threatening to shut down Twitface, the premier social networking site. By taking advantage of lax security protocols, nefarious cyber-bandits have developed a virus that spreads from user to user, amplifying over time and eventually bringing the network to its knees from massive congestion. Normally ... |
app_data_2980 | Arthur and his sister Carol have been playing a game called Nim for some time now. Nim is played as follows:
- The starting position has a number of heaps, all containing some, not necessarily equal, number of beads.
- The players take turns chosing a heap and removing a positive number of beads from it.
- The first... |
app_data_2981 | 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 coin in a pocket or change purse by touch alone... |
app_data_2982 | Your friend Tóti is an aspiring musician. He has written $n$ songs, each of which has a hype rating of either $1$, $2$, or $3$. A higher hype rating means the song has more energy. Tóti is planning his first live performance and needs your help. He wants to know how many setlists he can make. A setlist consist of at le... |
app_data_2983 | Björn likes the square root of two, $\sqrt {2} = 1.41421356\dots $ very much. He likes it so much that he has decided to write down the first $10000$ digits of it on a single paper. He started doing this on an A4 paper, but ran out of space after writing down only $1250$ digits. Being pretty good at math, he quickly fi... |
app_data_2984 | Punctual City is well known for the punctuality of its citizens and its public transportation system. It is particularly famous for its train system. It is always on time, and never too late (or even too early). Statistics about train boarding is regularly collected to keep things running smoothly.
A train has cars nu... |
app_data_2985 | There is a long electrical wire of length $\ell $ centimetres between two poles where birds like to sit. After a long day at work you like to watch the birds on the wire from your balcony. Some time ago you noticed that they don’t like to sit closer than $d$ centimetres from each other. In addition, they cannot sit clo... |
app_data_2986 | This problem is an extension of another Kattis problem - backspace. In that problem, every time we see a character ‘<’, it actually means that the ‘Backspace’ key is pressed and we undo the last character that was just typed.
The extension is as follows: Now, pressing a ‘<’ (the ‘Backspace’ key) when the (typing) cur... |
app_data_2987 | 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 regret buying tickets too late when prices rise righ... |
app_data_2988 | There is a legendary tale about Dragon Balls on Planet X: if one collects seven Dragon Balls, the Dragon God will show up and help you fulfill your wishes.
One day, you are surprised to discover that the tale might possibly be true: you found a Dragon Ball radar at a flea market! The radar shows you the locations of t... |
app_data_2989 | A water company is trying to provide water from its pumping station to a mansion. The company owns $n$ water stations, numbered $1 \ldots n$, which are connected by a variety of pipes. Water can flow through both directions of a pipe, but the total amount of water that can flow through the pipe is bounded by the capaci... |
app_data_2990 | In fantasy hockey, there are $n$ team owners that each selects $k$ hockey players. To determine which owner gets which players, the owners hold a draft.
The draft proceeds as follows: the first owner may select any player, then the second owner can select any player except the player taken first and so on. In general,... |
app_data_2991 | A family of $n$ gnomes likes to line up for a group picture. Each gnome can be uniquely identified by a number $1..n$ written on their hat.
Suppose there are $5$ gnomes. The gnomes could line up like so: $1, 3, 4, 2, 5$.
Now, an evil magician will remove some of the gnomes from the lineup and wipe your memory of the ... |
app_data_2992 | These days, many carmakers are developing cars that run on electricity instead of gasoline. The batteries used in these cars are generally very heavy and expensive, so designers must make an important tradeoffs when determining the battery capacity, and therefore the range, of these vehicles. Your task is to help deter... |
app_data_2993 | Arithmetic coding is a method to represent a message as a real number $x$ such that $0 \leq x < 1$. We will assume that the message consists only of uppercase ‘A’s and ‘B’s. The two letters have associated probabilities $p_ A$ and $p_ B = 1 - p_ A$ such that $0 < p_ A < 1$.
The current interval $[a,b)$ is initially se... |
app_data_2994 | You have a 2D rectangular grid. Each grid cell contains either an apple, an obstacle, or is empty. Empty cells are denoted as ’.’, apples as ’a’, and obstacles as ’#’. You are to implement a simulation of gravity, based on the following rules:
- The obstacles do not move.
- Whenever there is an empty cell immediatel... |
app_data_2995 | Walter was once a promising chemist. Now he teaches high school students chemistry, and was recently diagnosed with lung cancer. In both desperation and excitement he decides to use his chemistry skills to produce illegal drugs and make quick money for his family. He forms a partnership with one of his old students, Je... |
app_data_2996 | Paul owns a catering company and business is booming. The company has $k$ catering teams, each in charge of one set of catering equipment. Every week, the company accepts $n$ catering requests for various events. For every request, they send a catering team with their equipment to the event location. The team delivers ... |
app_data_2997 | Alice and Bob are playing a game on a simple connected graph with $N$ nodes and $M$ edges.
Alice colors each edge in the graph red or blue.
A path is a sequence of edges where each pair of consecutive edges have a node in common. If the first edge in the pair is of a different color than the second edge, then that is... |
app_data_2998 | The current programming club president, Norbit, gives speeches at the weekly club meetings. Casual viewers are underwhelmed with the quality of Norbit’s elocution. Specifically, Norbit often hesitates during his speeches with interjections like “umm.”
You, however, are no casual viewer–you are a computer scientist! Yo... |
app_data_2999 | Today the Intergalactic Council of Pebble Coins (ICPC) conducted an intergalactic auction of the Neutronium Chaos Pebble Coin (NCPC). This coin, which was forged in the Ancient Coin Machine (ACM), is rumored to be the key to ruling the universe.
Due to the extremely competitive nature of the auction, as well as the o... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.