dle8 / Competitive-Programming

Programs I've coded for Competitive Programming.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Competitive-Programming

Programs I've coded for Competitive Programming.

Notes for errors made during coding:

  1. ALWAYS THINK OF DYNAMIC PROGRAMMING BEFORE USING COMBINATORICS.
  2. Calculate eps value(Don't just guess):
  • Eps value can varies depending on round error while performing arithmetic calculation.
  • Avoiding divides (if can) & sqrt() in real number processing.
  • Can compare (a / b) & (c / d) by comparing (a * d - b * c) to 0.
  1. Watch out for memset() function when test cases if large.
  • Use memset function when we don't have to memset too many times.
  • Instead of can reinitializing value in the loop that reads in the input together.
  1. Implement adjacency list by vector instead of using struct pointer.
  2. Sorting function requires strictly smaller(or larger) comparison, or else will lead to wrong answer.
  3. When calculating number of digits of of a number, using log(num) / log(10) + 1 can lead to wrong answer sometimes. Better convert the number to string & use sz(num.to_string())
  4. A NOVICE'S MISTAKE: declare global variable but mistakenly also declare it in the function -> wrong answer!!

About

Programs I've coded for Competitive Programming.


Languages

Language:C++ 91.5%Language:CMake 2.4%Language:Makefile 2.4%Language:C 2.3%Language:Python 0.9%Language:Java 0.6%Language:JavaScript 0.0%