Glenforest Spring Open 2015 (Senior)

Welcome to the GFSS Spring Open 2015! Luckily for you, master ImbaCalvin has noticed your coding skills and decided to take you into his gang! If you think you still need some time before taking on this difficult task, go ahead and visit the junior contest.

The problem writers for this contest will be Awaykened and 635289

The senior contest this time will include completely different topics than from our first contest, and is meant for learning experience. On the day after the contest, we will release detailed explanations and solutions to each of the problems.

This is a rated contest. The duration of the contest is 4 hours and 30 minutes.

The contest consists of 5 questions with a wide range of difficulties, and you can get partial marks for partial solutions in the form of subtasks. If you cannot solve a problem fully, we encourage you to go for these partial marks. The difficulty of a problem may be anywhere from CCC Senior to CCO level.

After joining the contest, you proceed to the Problems tab to begin. You can also go to Users if you wish to see the rankings.

We have listed below some advice as well as contest strategies:

Start from the beginning. Ties will be broken by the sum of times used to solve the problems starting from the beginning of the contest. The last submission time of your highest score will be used.

It is strongly advised to run your code on your own computer with the sample input we provide before submitting. It's faster to find and fix mistakes at this stage rather than submitting and waiting only to find out that your solution doesn't compile.

Remove all extra debugging code and/or input prompts from your code before submitting. The judge is very strict — most of the time, it requires your output to match exactly.

Do not pause program execution at the end. The judging process is automated. You should use stdin / stdout to perform input / output, respectively.

Just because your program works with the sample input doesn’t guarantee that it will earn full points. Read the problem statement very carefully to look for things you may have missed on the first read-through. It is not forbidden — in fact, even encouraged to make your own test cases to debug your program on.

The test data is guaranteed to fit within the constraints given. You do not have to perform any extra checks to make sure of this fact.