/coding-battle2020

Primary LanguagePythonMIT LicenseMIT

Shaker 2020 - Coding Battle

Problem statements and solutions for the 2020 Coding Battle, hosted by Le Shaker, a programming contest designed and written by INSAlgo, a student union from INSA Lyon.

How to contribute

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 for the missing languages, or better solutions than the ones we did, by forking this repository and submitting a pull request. Add your solution under the sol/ folder in the problem directory. Add your name on the first line as a comment

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 :)

How to test your program with the given input / output

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 also provide a way to automatically run your script against the solutions : test_solution.sh and test_all_solutions.sh. Usage : ./test_solution.sh <path_to_solution>. Supported languages : Python 3, Python 2, C, C++, Rust, Haskell, Java, Elixir, Groovy. You must have the language interpreter/compiler installed in order for the script to work.

Because it can run unverified programs, use this script at your own risk.

Common mistakes

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?

License

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) 2020 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.