Welcome to the Pre-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.
Contest ends at 2124-08-01T00:00:00+02:00
Task | Total | Subtask 1 | Subtask 2 | Subtask 3 | Subtask 4 | Subtask 5 |
---|---|---|---|---|---|---|
addition | ‒/100 | ‒/100 | ||||
books | ‒/100 | ‒/100 | ||||
cheeseparty | ‒/100 | ‒/50 | ‒/50 | |||
directions | ‒/100 | ‒/20 | ‒/20 | ‒/60 | ||
endurance | ‒/100 | ‒/20 | ‒/20 | ‒/20 | ‒/20 | ‒/20 |
You may use any programming language to solve the tasks of the pre-round. To solve a task, you have to design a program which solves the problem. If your solution is written in C++ you can directly submit your program on the website, which will grade your submission and display the number of points that you’ve earned as well as an explanation if you did not get all the possible points. If you used another programming language, you have to download an input file, run the program on the data in that file, write the results in another file and upload it along with the source code to the website.
In order to read the data in the input file, make sure that your program either reads directly in that file or redirect the standard input to it (in a terminal running on Linux, Windows or OS X, you can do that by using the command ‘yourprogram < inputfile’, replacing ‘yourprogram’ and ‘inputfile’ by the paths to the actual program and input file).
More elaborate explanations about how to solve the tasks of the pre-round await you on our wiki and our training page. Note that in case you get stuck on the tasks, you can move to next task and try again later: no need to solve them in order.
Don’t hesitate to contact us at info@soi.ch if you have any question about programming or the tasks.
Mouse Stofl is planning to visit the pyramids together with Mouse Binna during their trip to Egypt. However, they both would like to bring a number of friends with them. Help Stofl figure out how many tickets he has to buy, such that every friend gets one, but he doesn’t waste money unnecessarily by buying too many tickets.
You are given two integers, and , containing the size of Stofl’s friend group (including Stofl), and containing the size of Binna’s friend group (including Binna). Output the sum of the numbers and .
The first line contains two numbers, and .
Output a line containing a single number, the sum of and .
Both numbers and are smaller than 1000.
Input:
10 5
Output:
15
Comment:
To submit for this subtask, please log in.
Don’t hesitate to ask us any question about this task, programming or the website via email (info@soi.ch).
Mouse Stofl likes books, and therefore, each of his friends gives him some books as gifts. He’d like to know how many books there are in total.
Please help Mouse Stofl to calculate the total number of books.
The first line contains an integer , representing the number of Mouse Stofl’s friends.
The second line contains integers (), each representing the number of books that one friend gives to Mouse Stofl.
A single number, the total number of books that Mouse Stofl has received.
Input:
5 1 2 3 1 2
Output:
9
Comment:
To submit for this subtask, please log in.
Don’t hesitate to ask us any question about this task, programming or the website via email (info@soi.ch).
Mouse Stofl is in the process of organising his annual Cheeseparty. He wants to invite mouse families. Each family Stofl wants to invite consist of the same family members: 2 parent mice and children.
Stofl of course needs to make sure there is enough cheese for all mice at the party. Each mouse which comes to the party, that means every family member and Stofl, would like pieces of cheese.
Help Stofl calculate how many pieces of cheese he has to order at the cheese dairy in order for there to be exactly pieces for every mouse coming.
You get three integers, , and . is the amount of families that Stofl wants to invite, the amount of children in each family and the amount of pieces of cheese every mouse would like at the party.
You need to calculate the amount of pieces of cheese Stofl needs to order.
The first and only line contains three integers, , and .
Print a single number, the amount of pieces of cheese Stofl needs to order.
The numbers , and are less than 100.
Input:
4 3 6
Output:
126
Comment:
To submit for this subtask, please log in.
You get four integers, , , and . is the amount of families that Stofl wants to invite, the amount of children in each family, the amount of pieces of cheese every mouse would like at the party and is the result that Stofl has calculated.
You need to check whether Stofl’s calculation was correct or not.
The first and only line contains four integers, , , and .
Print YES if Stofl’s calculation was correct, otherwise print NO.
The numbers , and are less than 100. is less than
,
Input:
4 3 6 120
Output:
NO
Input:
4 3 6 126
Output:
YES
To submit for this subtask, please log in.
Don’t hesitate to ask us any question about this task, programming or the website via email (info@soi.ch).
Mouse Binna and Mouse Stofl got lost on their vacation and don’t find their hotel anymore. Both of them asked a stranger for directions how to get back. Each of them were told a series of instructions, either “l” for left or “r” for right. However, as Mouse Stofl doesn’t have a very good memory, it is possible that he forgot the last few instructions he was told. Now they wonder whether they can trust the instructions or if one of the strangers was a liar! They only want to know if all the directions Stofl remembers match the directions of Binna. Can you help them?
Formally, you need to output “YES” if the directions Mouse Stofl remembers are a prefix of the directions Mouse Binna got. Otherwise, you should output “NO”.
The first line contains the number of test cases . The test cases follow in the following format:
It is guaranteed that both strings and contain only the letters “l” standing for left and “r” standing for right.
For the -th test case, output a line “Case #i: YES” if Stofl’s directions match exactly the beginning of Binna’s directions, or “Case #i: NO” otherwise.
In this subtask Stofl tried very hard to focus and managed to remember all of the instructions. The length of Binna’s directions is equal to the length of Stofl’s directions.
There are test cases. In each test case we have:
where is the length of and is the length of .
Input:
3 rrlr rrrr lrrrl lrrrl rrll llrr
Output:
Case #0: NO Case #1: YES Case #2: NO
To submit for this subtask, please log in.
In this subtask, Mouse Stofl was only able to remember the first instruction he was told.
There are test cases. In each test case we have:
where is the length of and is the length of .
Input:
3 llrlrr l llrlrr r rrl r
Output:
Case #0: YES Case #1: NO Case #2: YES
Comment:
To submit for this subtask, please log in.
In this subtask there are no further restrictions.
There are test cases. In each test case we have:
where is the length of and is the length of .
Input:
4 rrlrl rrl lrrrl llrr lr lrrr llrr llrr
Output:
Case #0: YES Case #1: NO Case #2: NO Case #3: YES
To submit for this subtask, please log in.
Don’t hesitate to ask us any question about this task, programming or the website via email (info@soi.ch).
In anticipation of the Olympic games, Mouse Binna decided she wants to organise a marathon for herself and her friends. The conditions for this idea seemed perfect – in her village there is a very long road. However, upon further investigation, she discovered that the road is not in a very good shape and there are a lot of holes. Since Mouse Binna doesn’t want someone to trip and hurt themselves while running, there cannot be any holes on the track. Your task is to help her organise the longest marathon possible.
Mouse Binna wants to use only a short part of the road. Your first program should help her figure out the maximum possible length of the race.
The first line contains the number of test cases . test cases follow in the following format:
You should output T lines, one for each test case. For the -th test case output “Case #i: l”, where is equal to the maximum length of the marathon Mouse Binna can organise.
Input:
2 3 1 0 0 3 0 1 0
Output:
Case #0: 2 Case #1: 1
Comment:
To submit for this subtask, please log in.
Your task here is the same as in subtask 1, but with a longer road.
The input format is the same as in subtask 1.
The output format is the same as in subtask 1.
Your task here is the same as in subtask 1, but with an even longer road.
The input format is the same as in subtask 1.
The output format is the same as in subtask 1.
While Mouse Binna was thinking of the possible marathons she could organise, a friend of hers who is working in construction proposed to fix some of the holes on the road. However she only has enough material to fix holes. Help Mouse Binna find out what is the longest marathon she can organise now by fixing at most holes.
The first line contains the number of test cases . test cases follow in the following format:
The output format is the same as in subtask 1
Input:
2 10 3 0 0 0 1 1 1 0 0 0 0 12 3 0 1 0 0 1 1 0 1 0 0 1 0
Output:
Case #0: 10 Case #1: 8
Comment:
To submit for this subtask, please log in.
Same as in subtask 4, but with a longer road and more material to fix holes.
The input format is the same as in subtask 4.
The output format is the same as in subtask 1.
Don’t hesitate to ask us any question about this task, programming or the website via email (info@soi.ch).