Блог пользователя Shaved_Chewbacca

Автор Shaved_Chewbacca, история, 4 года назад, По-английски

Hey guys,

After watching this excellent video from Errichto, I decided to implement it to debug my python submissions. Code is available here.

It is quite simple really, just have a few programs:

gen.py:
Has a few function to generate random integers, list of integers and strings. Use this to generate test cases

timer.sh:
Should be used to check real time of execution

compare.sh:
Should be used to compare your solution vs a brute force (or a different implementation)

How to use it? Every time you have a bug, you do the following:
1. Add the file you want to test in that folder and call it tested.py
2. Code a brute force version and call it brute_force.py
3. Change the parameters in compare.sh : you want to chose the typical size of your "big" test cases and "small" test cases. This is explained in the video, but basically you want to test your solution against really big input obviously, but also smallish inputs that will be more likely to generate corner cases.

And that's it. Funny thing is that sometimes I will find my bug just by writing the code to generate test cases...

Полный текст и комментарии »

  • Проголосовать: нравится
  • +29
  • Проголосовать: не нравится

Автор Shaved_Chewbacca, история, 4 года назад, По-английски

Hey guys,

I am having a lot of fun doing contest on Codeforces, but I am still quite bad lol. My main language is Python, and I am trying to get better. That's why I created a github repo with a list of all algos we need to use for CP. Maybe some of you guys would be interested in it too:

https://github.com/IAbeteEtMechante/Algorithms_for_Competitive_Programming_in_Python

It is very much a work in progress, I am happy to discuss any algo/problems with you guys if you want to get better at Python and algos/data structures too. Feel free to reach out and we can improve together:)

We can even make a small study group of Python coders, why not?

Полный текст и комментарии »

  • Проголосовать: нравится
  • +10
  • Проголосовать: не нравится