Here are the problems we designed for the Shaker 2019 Coding Battle. These problems have been designed and written by INSAlgo.
-
Pre-contest (to try out the contest platform)
- A. Bus ride: Simple test, divide two numbers.
- B. Mayan treasure: Find the 3 closest integers in a list.
- C. Words puzzle: String manipulation.
-
Coding Battle (theme: super heroines)
- A. Boats and ferries: Find how many people can fit in some vehicles.
- B. Timing issue: Convert hours from a foreign system to the terrestrian one.
- C. Bomb alert 1: Given list of positions, find the ones in which you can insert a reference position while maintaining constraints.
- D. Asteroid rain: Optimize the total size of asteroids you can throw in a portal when maintaining balance in it
- E. Bomb alert 2: The concept is the same than for the exercice C, but this time in a discrete environnement, with walls and red lights complicating the task.
- F. Perilous move: Find a repartition of people on ships so that the total number of travellers is maximized.
The solutions available are the ones we wrote and solutions from contributors that we approved. There are often many ways to solve a problem. Our solutions are not perfect but adapted to the skills we wanted to evaluate at each task. Please feel free to add the solutions in the missing languages, or better solutions than the ones we did.
If you translate an existing solution in a new language, please try to follow the structure, naming conventions and comments of the existing solution. Thanks for contributing :)
We won't reopen the platform, because it is costly to host and you can test your solutions locally or import the contest on your own platform.
To test your solutions, you can use piping in a terminal. For example, on Linux (if you don't use a Unix shell, you can find tutorials online):
# Python
python solution.py < ../input/input0.txt
# C++
./sol < ../input/input0.txt
# JavaScript
js sol.js < ../input/input0.txt
# etc
We read a lot of your submissions in the last few contests, and received many questions. Here is some advice if you want to avoid common mistakes:
- Learn to manage input / output. You can't afford to lose time on something like that when doing competitive programming. Most of the contests have the same format of input and output: reading space-separated lists of integers, strings, floats, or read multiple lines.
- Read carefully the format of input and output: a typo can ruin your solution.
- You don't have to check that the input is within the given bounds. The input is within the given bounds. Otherwise, why would we even provide the bounds?
This repo is under MIT license (see details below). However, some of the pictures used in the statements are not in the public domain or under a free license. We obtained the consent from their authors to use them, and you need to do the same.
MIT License
Copyright (c) 2019 INSAlgo
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.```