Welcome to the first round of the Swiss Olympiad in Informatics! You will find below an overview of what you’ve done so far as well as a few things that you should know before getting started.
This contest is over.
Category | Task | Total | Subtask 1 | Subtask 2 | Subtask 3 | Subtask 4 | Subtask 5 |
---|---|---|---|---|---|---|---|
Junior only | stairracing | ‒/100 | ‒/25 | ‒/25 | ‒/25 | ‒/25 | |
Junior only | secretcode | ‒/100 | ‒/25 | ‒/25 | ‒/25 | ‒/25 | |
Both | bamboo | ‒/100 | ‒/15 | ‒/25 | ‒/25 | ‒/35 | |
Both | batteryfix | ‒/100 | ‒/10 | ‒/10 | ‒/10 | ‒/70 | |
Both | lilypads | ‒/100 | ‒/15 | ‒/25 | ‒/20 | ‒/40 | |
Regular only | changifalls | ‒/100 | ‒/15 | ‒/15 | ‒/20 | ‒/25 | ‒/25 |
Regular only | satay | ‒/100 | ‒/20 | ‒/20 | ‒/10 | ‒/50 | |
Regular only | muffins | ‒/100 | ‒/25 | ‒/25 | ‒/50 |
The Asian tower running scene began in Raffles City, Singapore in 1987, where Swissotel The Stamford hotel was chosen as the venue of a vertical marathon across a mere 1336 staircase steps.
Mouse Binna is the main organizer of such an event. For this year’s edition, she’d like to organize a triathlon: the racing track starts with a vertical downward section, followed by a horizontal section, followed by a vertical upward section. She has already chosen a street through Singapore where she wants to host the event. On each side of the street, there are exactly skyscrapers at unit distance such that each skyscraper on one side of the street is facing another skyscraper on the other side. Mouse Binna knows the height of each skyscraper and she will choose a racing track that has the largest total length, starting on the roof of one of the skyscrapers, going down the stairs to the street, where it will lead to a skyscraper on the other side of the street and end on its roof. The total length of the racing track is given by the sum of heights of the skyscrapers and their distance along the street.
Mouse Binna has chosen a street with only one skyscraper on each side.
The first line contains the number of test cases . test cases follow in the following format:
You should output lines, one for each test case. For the -th test case, output “Case #i: l”, where is equal to the maximum length of the racing track Mouse Binna can choose.
Input:
2 1 2 3 1 1336 1
Output:
Case #0: 5 Case #1: 1337
Comment:
The contest is over, you can no longer submit. But you can still solve the task (‘upsolve’ it), and check your solution here.
If the time expires, or you don’t get full points, you can try again by downloading a fresh input.
You can directly run C++ solutions in your browser. For other languages, you need to download the input and manually run your solution. Please note that running in the browser is slower than running natively.
Do not navigate away while your solution is running.
Mouse Binna has chosen a street with two skyscrapers on each side.
The first line contains the number of test cases . test cases follow in the following format:
Same as subtask 1 – lines of the form “Case #i: l”, where is the maximum total length.
Input:
3 2 1 1 1 1 2 1336 1336 1 1 2 1 1336 1 1336
Output:
Case #0: 3 Case #1: 1338 Case #2: 2672
Comment:
The contest is over, you can no longer submit. But you can still solve the task (‘upsolve’ it), and check your solution here.
If the time expires, or you don’t get full points, you can try again by downloading a fresh input.
You can directly run C++ solutions in your browser. For other languages, you need to download the input and manually run your solution. Please note that running in the browser is slower than running natively.
Do not navigate away while your solution is running.
Mouse Binna has chosen a street with up to skyscrapers on each side.
The first line contains the number of test cases . test cases follow in the following format:
Same as subtasks 1 and 2.
Input:
1 5 1 5 5 1 1 1 2 3 4 1
Output:
Case #0: 11
The contest is over, you can no longer submit. But you can still solve the task (‘upsolve’ it), and check your solution here.
If the time expires, or you don’t get full points, you can try again by downloading a fresh input.
You can directly run C++ solutions in your browser. For other languages, you need to download the input and manually run your solution. Please note that running in the browser is slower than running natively.
Do not navigate away while your solution is running.
Mouse Binna has chosen a street with up to skyscrapers on each side.
Same as subtask 3.
The contest is over, you can no longer submit. But you can still solve the task (‘upsolve’ it), and check your solution here.
If the time expires, or you don’t get full points, you can try again by downloading a fresh input.
You can directly run C++ solutions in your browser. For other languages, you need to download the input and manually run your solution. Please note that running in the browser is slower than running natively.
Do not navigate away while your solution is running.
Don’t hesitate to ask us any question about this task, programming or the website via email (info@soi.ch).
Mouse Stofl has recently been interested in the field of cryptography. After learning about different types of encryption protocols, he has decided to invent his own, Stofl’s Secret Hash (SSH). Ideally, the decryption process should be as simple as possible, so that as many mice as possible could receive secure messages. He spent so much time coming up with a complicated encoding method, that he doesn’t know if a simple decoding method even exists.
Stofl decides that a decoding method is simple if he can replace each letter of the alphabet with another letter to retrieve the decrypted cleartext from the encrypted message. This replacement policy is called the translation table of an encryption. For example, if we are given the sentence: “I like cats” by using a translation table that replaces each c with an h, we recieve the sentence: “I like hats”.
As he wants to give the decoding table to his friends, he found a nice way to write them down. He first writes down the character which a will be replaced with, then the one b will be replaced with and so on. So if his translation table is cca, then a gets replaced with c, b gets replaced with c and c gets replaced with a.
Mouse Stofl would like to know if a simple decoding exists. He decides to start with words only containing the letters a and b.
The first line contains the number of test cases . test cases follow in the following format:
The first and only line of the testcase consists of two strings. The first string is the encrypted message. The second string is the decrypted cleartext.
For the -th test case, if a valid translation table exists, output a line “Case #i: Yes”, followed by a line with a valid translation table. Otherwise, output a line “Case #i: No”.
For each translation table, only the first two letters are considered.
There are test cases. In every test case, , where is the number of letters in a word.
Each word only contains the letters a and b.
Input:
4 abb baa aaa aba aba aaa bbb bbb
Output:
Case #0: Yes ba Case #1: No Case #2: Yes aa Case #3: Yes ab
Comment:
The contest is over, you can no longer submit. But you can still solve the task (‘upsolve’ it), and check your solution here.
If the time expires, or you don’t get full points, you can try again by downloading a fresh input.
You can directly run C++ solutions in your browser. For other languages, you need to download the input and manually run your solution. Please note that running in the browser is slower than running natively.
Do not navigate away while your solution is running.
Stofl is now ready to check his encoding methods on words with any letters of the alphabet.
The first line contains the number of test cases . test cases follow in the following format:
The first and only line of the testcase consists of two strings. The first string is the encrypted message. The second string is the decrypted cleartext.
Each word consists of lowercase letters.
For the -th test case, if a valid translation table exists, output a line “Case #i: Yes”, followed by a line with a valid translation table. Otherwise output a line “Case #i: No”. Note that you need to print the whole translation table (that is, for all lowercase letters), even if some letters are unused.
There are test cases. In every test case, , where is the number of letters in a word.
Input:
4 abc cab aac abc xyz aaa abc xyz
Output:
Case #0: Yes cabaaaaaaaaaaaaaaaaaaaaaaa Case #1: No Case #2: Yes aaaaaaaaaaaaaaaaaaaaaaaaaa Case #3: Yes xyzaaaaaaaaaaaaaaaaaaaaaaa
Comment:
The contest is over, you can no longer submit. But you can still solve the task (‘upsolve’ it), and check your solution here.
If the time expires, or you don’t get full points, you can try again by downloading a fresh input.
You can directly run C++ solutions in your browser. For other languages, you need to download the input and manually run your solution. Please note that running in the browser is slower than running natively.
Do not navigate away while your solution is running.
While Stofl invented his encryption protocol, Binna independently developed her own. Both mice decide that a simple decoding method is preferable, however, they disagree on which encryption method should be used. They now want to find translation tables such that their encrypted words decrypt to the same words. Additionally, they want these words to have as many unique letters as possible.
The first line contains the number of test cases . test cases follow in the following format:
The first line contains two integers and , the number of encrypted words (here, always 2) and the length of each word. lines follow describing the encrypted word of each mouse.
Each word consists of lowercase letters.
For the -th test case, output a line “Case #i: U D”, where is an integer representing the number of unique letters in the decrypted word and is the decrypted word. After that, lines follow, with the translation table of each mouse.
There are test cases. In every test case, and , where is the number of letters in a word.
Input:
2 2 4 milk lime 2 5 motor happy
Output:
Case #0: 4 cake aaaaaaaaaaekcaaaaaaaaaaaaa aaaaeaaaaaackaaaaaaaaaaaaa Case #1: 3 caaar aaaaaaaaaaaacaaaaraaaaaaaa aaaaaaacaaaaaaaaaaaaaaaara
Comment:
The contest is over, you can no longer submit. But you can still solve the task (‘upsolve’ it), and check your solution here.
If the time expires, or you don’t get full points, you can try again by downloading a fresh input.
You can directly run C++ solutions in your browser. For other languages, you need to download the input and manually run your solution. Please note that running in the browser is slower than running natively.
Do not navigate away while your solution is running.
Mouse Binna and Stofl are so fascinated by the topic that they decide to tell all their friends. Their friends find it equally fascinating and decide to invent their own encryption protocols. Once again, they want to find translation tables and words which can be decrypted from the encrypted words. As before, they want the decodings to have as many unique letters as possible.
The first line contains the number of test cases . test cases follow in the following format:
The first line contains two integers and , the number of encrypted words and the length of each word. lines follow describing the encrypted word of each mouse.
Each word consists of lowercase letters.
For the -th test case, output a line “Case #i: U D”, where is an integer representing the number of unique letters in the decrypted word and is the decrypted word. After that, lines follow with the translation table of each mouse.
There are test cases. In every test case, and , where is the number of letters in a word.
Input:
1 3 5 motor happy ember
Output:
Case #0: 2 aaaar aaaaaaaaaaaaaaaaaraaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaara aaaaaaaaaaaaaaaaaraaaaaaaa
The contest is over, you can no longer submit. But you can still solve the task (‘upsolve’ it), and check your solution here.
If the time expires, or you don’t get full points, you can try again by downloading a fresh input.
You can directly run C++ solutions in your browser. For other languages, you need to download the input and manually run your solution. Please note that running in the browser is slower than running natively.
Do not navigate away while your solution is running.
Don’t hesitate to ask us any question about this task, programming or the website via email (info@soi.ch).
This year’s IOI will take place in Singapore and thus Mouse Binna is eager to learn about the traditional way of cutting bamboo. In particular, she wants to train cutting bamboo sticks arranged in a line to a certain height pattern. For the cutting work, she possesses a dao, a single-edged sword from Singapore whose primary use is chopping bamboo. Because there are many bamboo sticks to cut and swinging the dao costs a lot of energy, she would like to perform as few swings as possible. However, cutting the bamboo sticks to the patterned height takes up all of her concentration and she cannot figure out the minimal number of swings needed to cut down the bamboo sticks at the same time. Please help her with this calculation!
You are given the list of the heights in the pattern, . Binna is still a beginner in bamboo cutting and thus she can only perform a simple strike technique which allows her, for any , and , to cut all bamboo sticks between and down to the height . (Formally, the new height for the bamboo sticks in range is the minimum of the previous height and the cutting height .) Initially, all bamboo sticks have infinite height.
When Mouse Binna is starting her training, her endurance is still very weak and she limits the number of bamboo sticks to .
The first line contains the number of test cases . test cases follow in the following format:
For the -th test case, output a line “Case #i: S”, where is the minimal number of swings that Binna needs to accomplish her task.
There are test cases. For every test case:
Input:
2 3 3 2 3 3 5 7 1
Output:
Case #0: 2 Case #1: 3
Comment:
The contest is over, you can no longer submit. But you can still solve the task (‘upsolve’ it), and check your solution here.
If the time expires, or you don’t get full points, you can try again by downloading a fresh input.
You can directly run C++ solutions in your browser. For other languages, you need to download the input and manually run your solution. Please note that running in the browser is slower than running natively.
Do not navigate away while your solution is running.
After Mouse Binna successfully completed her first training, she would now like to concentrate on long swings. She doesn’t feel completely comfortable with the dao yet and therefore decides to set the pattern heights to either or .
Same as in subtask 1.
There are test cases. For every test case:
Input:
2 6 1 1 1 1 2 1 5 2 2 1 1 1
Output:
Case #0: 3 Case #1: 2
Comment:
The contest is over, you can no longer submit. But you can still solve the task (‘upsolve’ it), and check your solution here.
If the time expires, or you don’t get full points, you can try again by downloading a fresh input.
You can directly run C++ solutions in your browser. For other languages, you need to download the input and manually run your solution. Please note that running in the browser is slower than running natively.
Do not navigate away while your solution is running.
After her second training session, Binna got used to bamboo cutting and wants to further raise the difficulty and removes the height limit of the previous subtask. Even though she was able to improve her endurance during the training, the endurance rests her limiting factor and cutting at many different heights is very energy-sapping. Hence, she limits the number of bamboo sticks to .
Same as in subtask 1.
There are test cases. For every test case:
Input:
1 8 8 2 5 2 1 5 5 8
Output:
Case #0: 5
Comment:
The contest is over, you can no longer submit. But you can still solve the task (‘upsolve’ it), and check your solution here.
If the time expires, or you don’t get full points, you can try again by downloading a fresh input.
You can directly run C++ solutions in your browser. For other languages, you need to download the input and manually run your solution. Please note that running in the browser is slower than running natively.
Do not navigate away while your solution is running.
After all of those training sessions, Mouse Binna became a true bamboo cutting expert and she is now able to cut patterns for any number of sticks .
Same as in Subtask 1.
There are test cases. For every test case:
The contest is over, you can no longer submit. But you can still solve the task (‘upsolve’ it), and check your solution here.
If the time expires, or you don’t get full points, you can try again by downloading a fresh input.
You can directly run C++ solutions in your browser. For other languages, you need to download the input and manually run your solution. Please note that running in the browser is slower than running natively.
Do not navigate away while your solution is running.
Don’t hesitate to ask us any question about this task, programming or the website via email (info@soi.ch).
Mouse Stofl has taken his laptop with him to Singapore to practice for IOI. Unfortunately his computer was built to be resistant against the cold weather (in case he wants to go skiing) but not against the humid hot weather of Southeast Asia and therefore his battery broke. After examining the battery, he realized that he can easily fix the broken battery by connecting the poles, which are placed on a circle, with heat-resistant wires.
After some research he found the rules of the battery:
And the rules he must follow to ensure a running battery:
If there are several ways to connect the poles correctly, then Stofl can choose any of the correct ways. Help him to figure out how he should wire his broken battery!
The first line contains the number of test cases . This is followed by test cases in the following format:
The first line of the test case contains , half the number of poles. A second line follows with a list containing the potential levels . The list is guaranteed to be a permutation of \{0, 1, {\dots}, 2 \cdot N - 1}.
(Note: corresponds to the potential level at the “top” of the circle (like 12 on a clock) and the other levels are in clockwise order.)
For the -th test case, output a line “Case #i:”, followed by a description of the wires. Output lines, each describing a wire by two numbers and , meaning Stofl connects pole and pole by a wire. Of course, the wiring should follow the above stated rules. Note: and correspond to the position of the poles, not their level.
Stofl wrongly assumes that the potential levels are ordered and therefore asked you first to solve this simpler case.
There are test cases. In every test case:
Input:
2 2 0 1 2 3 1 0 1
Output:
Case #0: 0 3 1 2 Case #1: 0 1
Comment:
The contest is over, you can no longer submit. But you can still solve the task (‘upsolve’ it), and check your solution here.
If the time expires, or you don’t get full points, you can try again by downloading a fresh input.
You can directly run C++ solutions in your browser. For other languages, you need to download the input and manually run your solution. Please note that running in the browser is slower than running natively.
Do not navigate away while your solution is running.
After realizing his wrong assumption, he now asks you to solve the correct case on a smaller scale.
There are test cases. In every test case: .
Input:
2 2 3 1 2 0 4 7 1 2 6 5 0 4 3
Output:
Case #0: 0 1 2 3 Case #1: 0 1 7 6 5 4 2 3
Comment:
The contest is over, you can no longer submit. But you can still solve the task (‘upsolve’ it), and check your solution here.
If the time expires, or you don’t get full points, you can try again by downloading a fresh input.
You can directly run C++ solutions in your browser. For other languages, you need to download the input and manually run your solution. Please note that running in the browser is slower than running natively.
Do not navigate away while your solution is running.
Now Stofl asks you to solve the problem for his computer-sized battery.
There are test cases. In every test case: .
Same as Subtask 2.
The contest is over, you can no longer submit. But you can still solve the task (‘upsolve’ it), and check your solution here.
If the time expires, or you don’t get full points, you can try again by downloading a fresh input.
You can directly run C++ solutions in your browser. For other languages, you need to download the input and manually run your solution. Please note that running in the browser is slower than running natively.
Do not navigate away while your solution is running.
After fixing his computer, Stofl decides to start a battery fixing workshop (when he’s back from IOI). To ensure the safety of other computers, he asks you to prove the correctness of your algorithm. He also asks you to guarantee that your algorithm runs fast enough and uses as little memory as possible.
Describe an algorithm that can solve the task and analyze it. This is a theoretical task, so you should reason why your solution is correct and what asymptotic running time and memory usage your solution has.
See the table below in ‘Grading’ to see how many points can be achieved for a given runtime and memory usage.
Check out the wiki for more information on how to solve/write theoretical tasks: Theoretical Intro
Hand in a document (preferably PDF) that describes
For this task, we give you the option to hand in your solution earlier to receive a feedback. This includes comments on parts of your solution which are unclear and a rough estimate of points. Afterwards, you may adjust your solution and send it in again for more points.
To receive feedback, you have to submit a solution before 30.10.2020 23:59. If you have submitted a solution, you will get a feedback for it on 02.11.2020.
If everything is correct, we will give you points based on the table below.
Running time | Memory usage | Max score |
---|---|---|
15 | ||
30 | ||
40 | ||
60 | ||
70 |
If you are not familiar with the notation, you can read about it here.
Note: You can assume that the input is given as a read-only array, which means you can’t change the values. This array doesn’t count to your memory, so only additional memory counts to your memory analysis.
Write your output into an append-only-stream. This means you can produce your output using functions such as print, write or with cout <<. You have no read access to your output, but it also does not count towards your memory usage.
Try to send in your solution, even if it is incomplete or slow. We also award partial points for crucial observations which are helpful to solve the task.
The contest is over, you can no longer submit.
Note: This story is fictional. Don’t try to fix your batteries at home this way!
Don’t hesitate to ask us any question about this task, programming or the website via email (info@soi.ch).
The Singapore river is full of lily pads, all neatly ordered in a line. Frog Pepe discovered that they are very bouncy and wants to use them to jump around.
By jumping on the i-th lily pad, Frog Pepe can bounce to any lily pad that’s between to steps away from it. In other words by jumping on lily pad () he can reach all lily pads () with .
Frog Pepe starts on lily pad . Help him reach lily pad in as few as bounces as possible.
The first line contains the number of test cases . test cases follow in the following format:
For the -th test case print a line “Case #i:” followed by a single integer: the minimal number of jumps to go from to . If it is impossible to get from to , print -1 instead.
In all subtasks:
and for all .
The contest is over, you can no longer submit. But you can still solve the task (‘upsolve’ it), and check your solution here.
If the time expires, or you don’t get full points, you can try again by downloading a fresh input.
You can directly run C++ solutions in your browser. For other languages, you need to download the input and manually run your solution. Please note that running in the browser is slower than running natively.
Do not navigate away while your solution is running.
and for all .
The contest is over, you can no longer submit. But you can still solve the task (‘upsolve’ it), and check your solution here.
If the time expires, or you don’t get full points, you can try again by downloading a fresh input.
You can directly run C++ solutions in your browser. For other languages, you need to download the input and manually run your solution. Please note that running in the browser is slower than running natively.
Do not navigate away while your solution is running.
.
The contest is over, you can no longer submit. But you can still solve the task (‘upsolve’ it), and check your solution here.
If the time expires, or you don’t get full points, you can try again by downloading a fresh input.
You can directly run C++ solutions in your browser. For other languages, you need to download the input and manually run your solution. Please note that running in the browser is slower than running natively.
Do not navigate away while your solution is running.
.
The contest is over, you can no longer submit. But you can still solve the task (‘upsolve’ it), and check your solution here.
If the time expires, or you don’t get full points, you can try again by downloading a fresh input.
You can directly run C++ solutions in your browser. For other languages, you need to download the input and manually run your solution. Please note that running in the browser is slower than running natively.
Do not navigate away while your solution is running.
Don’t hesitate to ask us any question about this task, programming or the website via email (info@soi.ch).
Jewel Changi is a nature-themed entertainment complex on the landside of Changi Airport in Singapore. Its centrepiece is the world’s tallest indoor waterfall, the Rain Vortex, which is surrounded by a terraced forest setting.
While visiting Jewel Changi on her way to IOI, Mouse Binna was impressed by the architecture of the terraced forest setting, and she especially enjoyed the looks of the waterfalls. Binna was wondering if one could build an even bigger waterfall within the Jewel Changi, and suddenly she could be found mapping out the whole area and calculating the perfect location for a waterfall.
Jewel Changi consist of multiple terraces in the shape of a circle, the predominant shape in its architecture. Terraces are flat areas delimited by walls. Terraces can be nested, i.e. some platform can reside inside another platform, but they never intersect.
Mouse Binna only considers waterfalls that are not too long, meaning they can pass through at most terraces that are successively receding. Formally, let be a sequence of terraces. It is a viable location of a waterfall exactly when:
The height difference of a waterfall is the difference of altitudes from terrace to terrace .
Since Binna is already exhausted from mapping out the area, help her figure out the maximum height difference.
[1] | A terrace is directly inside another terrace iff t is inside and there is no terrace such that is inside and is inside . |
Based on a quick glance, Binna assumed that all circles have the center at the Rain Vortex at location . She thinks this can give her a good idea of the height difference already.
The first line contains the number of test cases . test cases follow. The first line of each test case contains two integers and , the number of platforms and the maximum length. The following lines contain 4 numbers each: , , and , meaning that the -th terrace has center at coordinate , its radius is and the altitude is .
Note that in this subtask, .
For the -th test case print a line “Case #i:” followed by a single integer: the maximum height difference of a viable waterfall.
Input:
3 5 3 0 0 1 3 0 0 2 2 0 0 3 1 0 0 4 4 0 0 5 1 5 3 0 0 2 4 0 0 5 3 0 0 1 1 0 0 3 1 0 0 4 2 6 4 0 0 340073108 5 0 0 355849419 20 0 0 706293447 21 0 0 809063052 72 0 0 878401727 14 0 0 999963596 29
Output:
Case #0: 3 Case #1: 3 Case #2: 67
The contest is over, you can no longer submit. But you can still solve the task (‘upsolve’ it), and check your solution here.
If the time expires, or you don’t get full points, you can try again by downloading a fresh input.
You can directly run C++ solutions in your browser. For other languages, you need to download the input and manually run your solution. Please note that running in the browser is slower than running natively.
Do not navigate away while your solution is running.
Taking a closer look, Mouse Binna noticed that not all circles actually are centered at . However, she noticed another trend: smaller circles have smaller altitude. In fact, Binna discovered that the approximately coincide, i.e. and she decides to compute the maximum height difference using that approximation.
Same as subtask 1.
The contest is over, you can no longer submit. But you can still solve the task (‘upsolve’ it), and check your solution here.
If the time expires, or you don’t get full points, you can try again by downloading a fresh input.
You can directly run C++ solutions in your browser. For other languages, you need to download the input and manually run your solution. Please note that running in the browser is slower than running natively.
Do not navigate away while your solution is running.
Mapping out the airport a second time, it turns out that none of the assumptions from before actually hold.
Same as subtasks 1 and 2.
The contest is over, you can no longer submit. But you can still solve the task (‘upsolve’ it), and check your solution here.
If the time expires, or you don’t get full points, you can try again by downloading a fresh input.
You can directly run C++ solutions in your browser. For other languages, you need to download the input and manually run your solution. Please note that running in the browser is slower than running natively.
Do not navigate away while your solution is running.
After a full day of measuring, Binna finally produced high-detail maps with up to terraces.
Before she starts computing waterfall location, Binna wants to do some preparation work: for each terrace, she wants to know the index of its adjacent outer terrace.
Similar to subtasks 1, 2 and 3, but this time the is missing, since it’s not needed.
Let’s denote the outer terrace of as . If is already the outer-most terrace, .
For each test case, output a single number, the hash of all outputs:
Since we can’t ensure that optimized brute-force solutions or heuristics won’t be able to pass, we will manually check all submissions and may retroactively give an accepted submission 0 points.
We expect a solution that runs in (for a constant ). See Introduction to Algorithm Design on what those symbols mean.
Unless you exploit how the tests are generated or were squeezing your solution through the time limit, you should be fine.
Note: We need around 20sec to generate the input (depending on your browser and machine). Please be patient.
The contest is over, you can no longer submit. But you can still solve the task (‘upsolve’ it), and check your solution here.
If the time expires, or you don’t get full points, you can try again by downloading a fresh input.
You can directly run C++ solutions in your browser. For other languages, you need to download the input and manually run your solution. Please note that running in the browser is slower than running natively.
Do not navigate away while your solution is running.
Finally, time has come to compute the perfect location for the waterfall. Mouse Binna is very excited and has already decided to call it the “Changi Falls”. Can you help Mouse Binna one last time?
The first line contains the number of test cases . test cases follow. The first line of each test case contains an two integers and , the number of platforms and the maximum length. The following lines contain 5 numbers each: , , , and , meaning that the -th terrace has center at coordinate , its radius is and the altitude is and its outer terrace has index (where if it is already outer-most).
The correspond to the output of subtask 4, looking at them is optional, but intended as help.
Same as subtasks 1, 2 and 3.
Since we can’t ensure that optimized brute-force solutions or heuristics won’t be able to pass, we will manually check all submissions and may retroactively give an accepted submission 0 points.
We expect a solution that runs in (for a constant ). See Introduction to Algorithm Design on what those symbols mean.
Unless you exploit how the tests are generated or were squeezing your solution through the time limit, you should be fine.
Note: We need around 20sec to generate the input (depending on your browser and machine) and another 20sec to verify your submission. Please be patient.
The contest is over, you can no longer submit. But you can still solve the task (‘upsolve’ it), and check your solution here.
If the time expires, or you don’t get full points, you can try again by downloading a fresh input.
You can directly run C++ solutions in your browser. For other languages, you need to download the input and manually run your solution. Please note that running in the browser is slower than running natively.
Do not navigate away while your solution is running.
Don’t hesitate to ask us any question about this task, programming or the website via email (info@soi.ch).
Satay is a traditional Singaporean dish that consists of meat stripes that are grilled on a skewer. It is often served with peanut sauce and pieces of cucumber and onion.
A group of mice hast just eaten some Satay and they’re left with just the skewers. Each mouse is holding exactly one skewer. The mice figured it would probably be easiest to hand all skewers to one mouse, so that only that mouse has to look for a waste bin.
Some pairs of mice are standing next to each other. The mice want to avoid accidentally hitting bystanders with skewers, so only mice that are standing next to each other may hand skewers to each other. It just so happens that for every pair of mice, there is a unique way of passing skewers from the first mouse to the second mouse, possibly via some other mice.
Whenever a mouse hands skewers to another mouse, there is a risk that the mouse might accidentally drop the skewers. Mouse Stofl has estimated that the risk of dropping the skewers is equal to the number of skewers that were passed. Dropping the skewers is very embarrassing, so you want to minimize the total risk. Can you figure out how to get all skewers to the same mouse?
The first line contains the number of test cases . test cases follow, each test case consists of three lines. The first line contains an integer – the number of mice in the group. The second line contains integers and the third line contains integers . For , the mice and are standing next to each other.
It is guaranteed that for every pair of distinct mice and , there is an integer and a unique sequence of distinct mice such that and are standing next to each other for all .
For the -th test case, print a line “Case #i:” followed by a single integer: the minimum total risk needed to pass all skewers to a single mouse.
Input:
2 4 0 0 0 1 2 3 6 0 1 2 3 4 1 2 3 4 5
Output:
Case #0: 3 Case #1: 9
Comment:
The contest is over, you can no longer submit. But you can still solve the task (‘upsolve’ it), and check your solution here.
If the time expires, or you don’t get full points, you can try again by downloading a fresh input.
You can directly run C++ solutions in your browser. For other languages, you need to download the input and manually run your solution. Please note that running in the browser is slower than running natively.
Do not navigate away while your solution is running.
The mice successfully managed to throw away all skewers without dropping any of them. The Satay was very delicious, so they decided to have some Satay with peanut sauce. The peanut sauce was served on a small plate, so now the mice have to deal with both the skewers and the plates. Mouse Stofl wasn’t happy with how long it took the mouse in subtask 1 to find the trash, so this time, he wants to do it himself.
At the moment, every mouse is holding a plate with a skewer on top of it, and the goal is to get all plates and skewers to Mouse Stofl. Having skewers below or between plates make the stack of plates very unstable, which would greatly increase the risk of dropping the plates, so the mice want to avoid this at all costs.
Unfortunately, the plates are quite heavy, which means the mice have to use both hands to hold the plates. This severely limits their options: If two mice are standing next to each other, the first mouse can always pass any number of skewers to the next mouse. Additionally, if the second mouse is not holding any skewers, the first mouse may pass all of its skewers and any number of plates to the second mouse. Mouse Stofl estimates that the risk of dropping something if skewers and plates are passed to another mouse is for some constants and .
Can you figure out the least risky way of getting all skewers and all plates to Stofl?
The first line contains the number of test cases . test cases follow, each test case consists of three lines. The first line contains three integers , and – the number of mice in the group and two parameters describing the risk of passing skewers and plates. The second line contains integers and the third line contains integers . For , the mice and are standing next to each other.
It is guaranteed that for every pair of distinct mice and , there is an integer and a unique sequence of distinct mice such that and are standing next to each other for all .
For the -th test case, print a line “Case #i:” followed by a single integer: the minimum total risk needed to pass all skewers and plates to mouse Stofl (mouse 0).
Input:
3 3 2 5 1 2 0 0 5 3 3 0 1 1 1 1 2 3 4 4 3 2 0 1 2 1 2 3
Output:
Case #0: 22 Case #1: 66 Case #2: 48
Comment:
The contest is over, you can no longer submit. But you can still solve the task (‘upsolve’ it), and check your solution here.
If the time expires, or you don’t get full points, you can try again by downloading a fresh input.
You can directly run C++ solutions in your browser. For other languages, you need to download the input and manually run your solution. Please note that running in the browser is slower than running natively.
Do not navigate away while your solution is running.
While mouse Stofl is busy trying to find a trash can, the remaining mice decide to have some more Satay. Can you help them figure out the least risky way of dealing with the plates and skewers afterwards?
The situation is the same as in subtask 2, but there is no mouse Stofl, so you can pick the mouse that collects all the plates and skewers.
Same as in subtask 2.
For the -th test case, print a line “Case #i:” followed by a single integer: the minimum total risk needed to pass all skewers and all plates to a single mouse.
Input:
3 3 2 5 1 2 0 0 5 3 3 0 1 1 1 1 2 3 4 4 3 2 0 1 2 1 2 3
Output:
Case #0: 22 Case #1: 48 Case #2: 38
Comment:
The contest is over, you can no longer submit. But you can still solve the task (‘upsolve’ it), and check your solution here.
If the time expires, or you don’t get full points, you can try again by downloading a fresh input.
You can directly run C++ solutions in your browser. For other languages, you need to download the input and manually run your solution. Please note that running in the browser is slower than running natively.
Do not navigate away while your solution is running.
Mouse Stofl is nowhere to be seen, but the mice are still hungry, so they go for some more Satay. This in turn gives them more skewers and plates to deal with, so they again ask you to help them minimize the risk of dropping them.
This is a theoretical subtask. Describe an algorithm that can solve subtask 3 and analyze its running time and memory usage.
You should optimize for running time first and memory usage second.
Hand in a document (preferably PDF) that describes
The contest is over, you can no longer submit.
Don’t hesitate to ask us any question about this task, programming or the website via email (info@soi.ch).
SOI participants like muffins [citation needed]. Mice Stofl and Binna have invited some participants into their apartment for training and would like to provide the necessary amount of muffins to keep them motivated while solving difficult tasks. They have set up their kitchen, but are unsure how to best coordinate the muffin baking process. You can help them by assuming the role of either Stofl or Binna and baking muffins as efficiently as possible.
The muffin baking process consists of seven different stations. Whenever your mouse is idle it can either move to a different station, work on the current station or do nothing. In the beginning, the mouse is at no station and thus first has to move to a station. The speed of a mouse working at a specific station is always proportional to their skill at that specific station. The stations are as follows:
Dough Station: Here you can fetch the basic ingredients for muffin dough. The available action is to fetch a fixed amount of dough in a fixed amount of time. Fetched ingredients are stored on the table.
Chocolate Station: Here you can fetch the chocolate for chocolate muffin dough. The available action is to fetch a fixed amount of chocolate in a fixed amount of time. Fetched ingredients are stored on the table.
Lemon Station: Here you can fetch lemons for lemon muffin dough. The available action is to fetch a fixed amount of lemons in a fixed amount of time. Fetched ingredients are stored on the table.
Bowl Filling Station: Here you can take ingredients from the table and fill them into bowls. There is a fixed number of bowls. All bowls have the same, fixed capacity. The available action is to take a 1:1 mixture of either one chocolate and one dough, or one lemon and one dough and fill it in a given bowl. The bowl must either be empty or not have been mixed yet and must not currently be in use by a different mouse. The action works by specifying the type, either chocolate or lemons and the bowl in which to fill it. The bowl will automatically be filled with one piece of chocolate/lemon and one piece of dough, so the content will increase by two.
Bowl Mixing Station: Here you can take a bowl and mix its ingredients. The available action is to select a bowl and mix it, which takes a fixed amount of time. The bowl must not currently be in use by a different mouse.
Cup Filling Station: Here you can fill the ingredients from mixed bowls into muffin cups. The available action is to select a bowl and fill one unit of its content into cups. One unit of ingredients fills exactly one cup. This takes a fixed amount of time. There is a limited number of cups available. The cups can be used for both chocolate and lemon muffins, but their sum mustn’t exceed the maximum number of cups. Only one mouse can work on this action at the same time.
Baking Station: Here you can finally bake muffins. The available action is to take all of the currently filled cups and bake them into finished muffins. Putting the muffin cups into the oven takes a fixed amount of time. The oven then takes a fixed amount of time for baking. The action can only be executed if the oven is not currently baking muffins and only one mouse can work on it at the same time. Once the action is started, all cups are emptied and can be reused. Any cups that are filled while this action is running will not be put into the oven.
The formulas for calculating the exact time taken are as follows:
Skill values, the oven’s baking time, the maximum number of cups and bowls and the bowl capacity are constant within a single game. Skill values can be different for different mice. All skill values are guaranteed to be non-negative and less than .
It takes a fixed amount of time to move to a station. This switching time is different for every station, but the same for every mouse and doesnt change during one game.
There are three different storages for muffin ingredients. The first is the table for raw dough, chocolate and lemons. You can store an infinite amount of resources on the table. The second are bowls. For one game, there’s a fixed amount of bowls, each with the same capacity. A bowl can only be filled with dough of the same type, except when it is empty, then it can be filled with any type of dough. A bowl can be either mixed or not mixed. A bowl can only be in use by one mouse at a time. The third storage type are cups. There is a limited number of total cups available. Each cup can either be filled with chocolate dough or lemon dough, or be empty.
There will never be more than bowls, the capacity of a bowl will never exceed and there will be at most cups available.
In order to keep the participants stimulated, Stofl and Binna have created a muffin schedule. Each order consists of a type of muffin, either chocolate or lemon, the amount of muffins and the time to deliver. All muffins that have finished baking are considered available for orders and will automatically be used to fill orders. Orders can be filled partially. One point is awarded for every successfully baked muffin in an order. Once the time for an order passes, all available muffins of the given type, but at most the given amount are taken for that order. Once the time for an order has passed, it’s impossible for any future muffins to be used for it.
You will never have to bake more than total muffins.
There are wrappers available to handle communication with the judge for Python and C++. These are provided with the sample bots in each language.
Each game begins with the definition of each Mouse’s skill values, the oven baking time, the number of dough, chocolate and lemons that can be fetched in one go, the maximum number of cups and bowls and the bowl capacity. The order list is also given at the beginning of the game. Then the mice take turns in order of their id. There are call-ins to inform you of the other player’s actions. Once it is your turn, you can use one of the given methods to execute an action.
You can download the sample bots for C++ and Python here.
Binna went to an international competition and Stofl wants to bake some muffins for his best friend Flappi. Flappi tells him whether he wants chocolate or lemon muffins and how hungry it is. Sometimes Flappi is very hungry, so he can ask for up to muffins. As a special condition for this subtask only, Stofl always has a whole number multiple of muffin cups as there is space in the bowls, i.e. . You have to tell Stofl how to bake a fixed amount of one type of muffins in the shortest total time possible. This means there will only be one order.
The contest is over, you can no longer submit. But you can still solve the task (‘upsolve’ it), and check your solution here.
If the time expires, or you don’t get full points, you can try again by downloading a fresh input.
You can directly run C++ solutions in your browser. For other languages, you need to download the input and manually run your solution. Please note that running in the browser is slower than running natively.
Do not navigate away while your solution is running.
Stofl was very happy that you could help him bake for Flappi. He thought of some special cases where he was unsure how he would handle them. They can contain combinations of chocolate and lemon muffins. Try to fulfill as many orders as possible, it is ok if you can’t fulfill them all. The input will always be the same. Each test case will be scored based on the following formula:
The total score is the average of the scores on each test case.
The contest is over, you can no longer submit. But you can still solve the task (‘upsolve’ it), and check your solution here.
If the time expires, or you don’t get full points, you can try again by downloading a fresh input.
You can directly run C++ solutions in your browser. For other languages, you need to download the input and manually run your solution. Please note that running in the browser is slower than running natively.
Do not navigate away while your solution is running.
Binna is back and it’s time to bake some muffins for the participants now. This time Stofl and Binna have to cooperate, you can only help one of them at a time. The other mouse will be controlled by another program. Your submission will be scored depending on how well it cooperates with all other programs.
For testing, you can try running two instances of your own bot, or running your own bot alongside the sample bot. Check the updated readme in the sample bot package on how to do so. Once you’re done, you can upload up to three different bots in a zip archive. Only your best submission will count.
The contest is over, you can no longer submit.
Don’t hesitate to ask us any question about this task, programming or the website via email (info@soi.ch).
Rank | Username | Total (500) | stairra… (100) stairracing | secretcode (100) | bamboo (100) | batteryfix (100) | lilypads (100) |
---|---|---|---|---|---|---|---|
loading ... |
Rank | Username | Total (600) | bamboo (100) | batteryfix (100) | lilypads (100) | changif… (100) changifalls | satay (100) | muffins (100) |
---|---|---|---|---|---|---|---|---|
loading ... |