My C++ algorithms implementations library

Правка en1, от sslotin, 2018-05-24 17:35:58

This is my repo. There are many like it, but this one is mine. My repo is my best friend. It is my life. I must master it as I must master my life. Without me, my repo is useless. Without my repo, I am useless. I must maintain my repo true. I must commit faster than my collaborator who is trying to open issue. I must assign issue to him before he assigns issue to me. I will...

I will keep my repo clean and ready, even as I am clean and ready. We will become part of each other. We will...

Before Codeforces, I swear this creed. My repo and myself are the defenders of good solutions. We are the masters of our problemset. We are the saviors of my rating. So be it, until there is no WA, but AC. Amen.

Maintainer's Creed

Hi. I am sharing my algorithms repo to the community and calling you to enrich it. Few keynotes:

  • It is designed to be minimalistic and copy-pastable. There are two kinds of source files there:
  1. Designed to be used as a template for solution. For example, Centroid Decomposition problems are usually very similar in implementation, so there is a template solution for them where you only need to fill some sections.

  2. Designed to be copied as a part of a program. Typically some structure or function definitions. My use case: I code in vim, and when I need something from the library I just type something like ":r ../algo/geometry.cpp" (paste this snippet into the current file) and then integrate it (most of these won't even compile — they are not designed to — so you need to tweak it a bit).

  • It is mostly not commented. Again, it is designed to be minimalistic and copy-pastable.

  • Code readability is more important than boosting performance by few percents.

  • Though typedef long long ll and similar is ok, I do not generally approve of most #DEFINE-s used in competitive programming.

  • I use g++ --std=c++11, which implies I also use #include <bits/stdc++.h>, __gcd(), __builtin_popcount() etc.

  • I use 4 spaces over tabs. My if looks like if () { and if it is something short, I may write something like if (2+2==4) ans++;. My function definitions looks like int f () {. I tend to avoid templates, because during a contest you do not have for thoughts about polymorphism. I write simple formulas without spacing (dp[n-k+1]). I can be persuaded to change the code style.

  • My friends reported that it is actually a bit buggy. There are no unit tests, people just try to implement solutions based on it. I can guarantee that about 90% of it is safe to use.

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en4 Английский sslotin 2018-05-24 20:59:19 19
en3 Английский sslotin 2018-05-24 17:58:13 6 Tiny change: 'd to copy it and tweak a bit.' -> 'd to copy and tweak it a bit.'
en2 Английский sslotin 2018-05-24 17:55:00 1580
en1 Английский sslotin 2018-05-24 17:35:58 2886 Initial revision (published)