I started doing Codeforces contest in 2015 summer vacation while participating in 2015CPSTC(competitive programming summer training camp) @NCTU. Thanks to the teacher and student mentors there. :)
This is a repository that I use for backing up my Codeforces code. I am still new to this competitive programming field, so my code may be really bad. Please don't take it too seriously.
clang-format-3.7 -style=LLVM -i main.cpp && astyle --style=linux main.cpp && g++ -Wall -Wextra -o main.o main.cpp
#List format
The following lists will be written as followed.
- (h1 title) Contest name(type)
- Division(if present)
- Round / contest name
- solved problem
- Round / contest name
- Division(if present)
#Contest
- Div 2
- Round 312 (The first ever contest that I participated in!)
- A, B
- Round 313
- A, B, C
- Round Pi
- A, B, C
- Round 315
- A, B, C
- Round 316
- A, B, C
- Round 317
- A, B, C
- Round 318
- A, B, C
- Round 319
- A, B, C
- Round 320
- A, B, D
- Round 321
- A, B, C
- Round 322
- A, B (Test case 53!!), C
- Round 323
- A, B
- Round 324
- A, B
- Round 325
- A, B, C
- Round 326
- A, B, C
- Round 327
- A, B
- Round 328
- A, B
- Round 329
- A, B
- Testing Round #12
- A, B
- Educational Round #1
- A, B, C
- Round 332
- A, B, C
- Round 333
- A, B, C
- Educational Round #2
- A, B
- Educational Round #3
- A, B, C
- Round 336
- A, B, C
- Educational Round #4
- A, B, C, D
- Educational Round #5
- A
- Goodbye 2015
- A, B
- Round 339
- A, B, C
- Round 228
- A, B, C, D, E
- Educational Round #6
- A, B, C, D
- Round 234
- A, B, C
- Round 244
- A, B, C (SCC), E
- Round 271
- A, B
- Round 340
- A, B, C, D
- Round 247
- A, B, C (無限背包), D (unsolved)
- Round 338
- B
- Wunder Fund Round 2016 (Div. 1 + Div. 2 combined)
- A, B
- Round 341
- A, B
- Round 311
- B
- AIM Tech Round (Div. 2)
- A, B
- Round 342
- A, B, C
- Educational Round 7
- A, B, C, D, E
- 8VC Venture Cup 2016 - Elimination Round
- A, B, C, D
- Educational Round 8
- A, B, C
- Round 343
- A, B
- Educational Round 9
- A, B, C
- Round 345
- A, B, C (You will never forget to use long long to do (x * (x - 1) / 2))
- Round 312 (The first ever contest that I participated in!)
- Acm Aamman Collegiate Programming Contest (3-star)
- C, E, J, K
- 2013-2014 Samara SAU ACM ICPC Quarterfinal Qualification Contest (3-star)
- A, B, H (F TLE)
- 2014-2015 Samara SAU ACM ICPC Quarterfinal Qualification Contest
- A, E, F, G, I, M
- 2015-2016 Samara SAU ACM ICPC Quarterfinal Qualification Contest
- B, D, F, I, J
- 2015-2016 ACM ICPC Baltic Selection Contest
- A, D, F, G, H, K, L
- 2014 Nordic Collegiate Programming Contest
- H, K
- Test for upper/lower bound input that's given by the problem statement. (Hacks may come from here! Ex: Round 316 Div2 problem B)
*Think of
long long int
before coding. - Does the problem need a linear scan? Or just look at its left and right? (Round 316 Div2 problem C)
- Read the problem statements carefully. Use pen and paper to finalize thoughts before actually coding them! (Try all test cases first)
- Don't rush! Double check the source code and rethink the program flow before submitting the code. (Rubber duck debugging)
- If
long long int
is required, declare all of the variables usinglong long int
in case you miss any of them. (2013-2014 Samara SAU ACM ICPC Quarterfinal Qualification Contest problem C, forgot to uselong long int
forsum_so_far
, stupid) - Use
scanf("%s", input)
when there is no spaces in the string. Mix usage offgets
andscanf
will have\n
problem. scanf()
>fgets()
- UVa 11988: when using global variables, don't forget to INITIALIZE it before starting reading in new test cases!!
- Test the special cases, such as 0, -1, 1, or max_value, before even submitting the code.
- When using
double
, don't make mistakes likeint x = 1, y = 2; double s = y / x;
- Not all the restrictions are actually possible!! (Round 333 Problem C, Round 327 C)
- Be aware while working with long long int. See
Educational Round 6 problem D
- Don't use
memset
unless it's necessary!. SeeEducational Round 6 problem E
ans -= tmp_cnt * (tmp_cnt - 1LL) / 2LL;
, this way can avoid problems when forget to use ll for tmp_cnt. SeeRound 345 Problem C
find . -type f -name '*.orig' -delete
- Add
gcc5
in/usr/local/bin
toPATH
inbash_profile