I'm happy to see that this year there were 3 people who managed to solve all 7 problems! Unfortunately, only 1097 participants solved at least one problem, which is less than in 2014.
This problem asked to figure out an integer sequence from two samples and problem title. It turned out to be surprisingly hard, a lot harder than I anticipated. A quick search through OEIS shows that while there are a lot of sequences which have these two numbers in them, only one is related to Leonardo da Vinci (and if you're looking for da Vinci, there are only two sequences overall). http://oeis.org/A221180 is an erroneous series of powers of 2, written down by da Vinci in his diaries and available as part of "Codex Madrid I".
Just one word: typoglycemia. The urban legend (unsupported by any known research) claims that people can easily read text even if letters in each word are scrambled, as long as the first and the last letters stay in place. Looked like a fun thing to verify on a small (and strongly biased) sample of competitive programmers. Judging from the results, it's really not much of an obstacle :-)
When un-scrambled, the lengthy statement becomes a story about two roommates who are trying to figure out a fair way to split dishes washing duty. (Fun fact: this problem idea is actually inspired not by any real-life events but by a theater play.) "You agree on two arrays of integers M and R, number upcoming days (including the current one) with successive integers (the current day is zero), and you wash the dishes on day N if and only if there exists an index i such that N % M[i] = R[i], otherwise your roommate does it... Calculate the percentage of days on which you end up doing the washing."
To find the answer, you can find least common multiple of numbers in array M. The infinite number of days ahead can be split into identical blocks of M days, so the percentage of all days on which you end up with the chore will be the same as the percentage of the first LCM days. Iterate over days 0..LCM-1 and for each day check who gets to do the chore on it (since each element is at most 16, LCM will be at most 720720, and iteration will be sufficiently fast).
A much simpler approach would be just to iterate over a lot of days regardless of LCM and calculate the answer based on them — the absolute error will be small enough for this solution to pass.
One more statement-less problem (and one more problem which turned out to be harder than I thought), but at least this one has a picture! By this time anyone with a history of participation in my contests should recognize a program regardless of the language in which it is written. In this case it is Sanscript, a visual dataflow language. The image doesn't represent the whole program, just the body of the main loop, but it contains most of the logic.
Individual elements of the program (functions) are fairly well annotated, so it shouldn't be too hard to figure out the overall purpose of the "code". The whole mess of the blocks and arrows calculates sum of indices of uppercase letters in English alphabet (A is 1, B is 2 etc.) minus sum of indices of lowercase letters in alphabet. Non-letter characters are ignored.
I love so many unusual programming languages that one language per problem just can't cover all of them. The solution is simple: have several languages per problem! Unfortunately, most people on Codeforces don't share my passion for languages, and this problem, while being trivial to implement, turned out to be the hardest in the whole contest.
Each paragraph of the statement is a short program in one of esoteric languages. If you recognize each one, find an interpreter for it and execute the program, you'll get a piece of statement. Put them together to find out what is it that you need to do to solve the actual problem:
- Print number (Brainfuck) — http://ideone.com
- of ones in (Malbolge) — http://www.malbolge.doleczek.pl/
- base 8 (Piet) — http://www.rapapaing.com/blog/?page_id=6
- notation of a (Befunge) — http://www.quirkster.com/iano/js/befunge.html
This problem was the first and the last one to tell you clearly and without doubt what you have to do: write a solution to a simple graph problem (likely using a Floyd-Warshall algorithm) without any traditional reserved words for loops and conditional statements.
There is a number of workarounds possible, which strongly depend on the language you use. Three main approaches were:
- Honestly rewrite the solution in a recursive way.
- Add some other characters in the middle of each forbidden keyword (/*..*/ in C++ or @ in Python with eval)
- Use built-in functions like map, each etc.
- I suspect the few Haskell users were not inconvenienced at all :-)
This problem was contributed by kit1980.
One of the most common tricks in April Fool's day contests is OEIS lookup. Most statement-less problems can be solved by thoroughly searching the website. In this problem, you were given OEIS sequence numbers, and if you checked them on the website, you could notice that the answer is the first element of the given sequence. Now it's just a matter of encoding this lookup process, given that Codeforces doesn't allow solutions to visit external websites...
Ok, it's about time to shout "April Fool!" and burst into laughter. Forget about OEIS. This problem was carefully forged to look very much like what I've described (and I hope it did!), but the actual solution is much, much simpler. The input represents a hand of cards in a game of blackjack, and you have to calculate the sum of points for it. A stands for Ace, worth 1 point (the minimal sum of the 6 digits part of the hand is 12, so if Ace is counted as 11, you're guaranteed to go bust), digits 2..9 correspond to matching cards, and pair of digits 10 represents, well, a ten. The reference to "validity" in the statement meant that 1 or 0 will never appear alone, but will always form a valid card.
This problem was a kind of tribute to a story called "The Expert" (https://www.youtube.com/watch?v=BKorP55Aqvg). You are given a simple task, but the checker, a.k.a. the customer, keeps throwing new requirements at you. First, you have to rewrite your solution in any other language (that's when you don't want C++ to be the only programming language you know!) regardless of what was your original language. Next, the solution turns out to be too long (again, regardless of its original length). Finally, you have to add a kitten to it (just put a word "kitten" anywhere in the code). Turned out to be much easier than decoding weird programming languages!