<!DOCTYPE html> AlgoDuck - Competitive Programming and Algorithm Resources

Introduction Getting Started My Template

Introduction to Competitive Programming

⚠️⚠️WARNING⚠️⚠️ : THE SITE IS UNDER CONSTRUCTION👨‍💻👨‍💻

STAY TUNED quack-

#include <iostream>
#include <string>
using namespace std;
int main() {
    string Author = "WeakBlood";
    cout << "Hello there!!!" << '\n';
    cout << "From: " << Author << '\n';
    return 0;
} 
$ g++ -Wall -Wextra -std=gnu++17 greetings.cpp -o greetings
$ ./greetings
$ Hello there !!! 
$ From: WeakBlood

This site is meant to help anyone who wants to learn some simple or more complex algorithms and with this project i also help myself by forcing to find a good explanation for some concepts.

Getting Started:

For moving your first steps into the competitive programming world you will need this handbook ( which i personally call:) The Bible of Competitive Programming.

It contains:

If you don’t know the meaning of some of the terms mentioned earlier, don’t worry, i gotch u:

For starting doing some pratice, you can sign up to and try to solve as many problems as possible most of which will be easily solvable by reading the early mentioned The Bible of Competitive Programming. CSES.

EVEN IF YOU ARE NOT ABLE TO INSTANTLY GET TO A SOLUTION RIGHT, KEEP PUSHING, KEEP TRYING, YOU WILL IMPROVE QUICKLY BY NOT GIVING UP EASILY.

This does not mean that you should stay on a single problem for weeks, but at your discretion understand when you are completely stalled an start reading some parts of the solution, if still nothing comes to your mind then read the full solution and try as hard as you can to understand it.

For CSES solutions i would recommend this well made repository of an Italian OII champion, GITHUB SOLUTION do not abuse this repo. You got this!

Here are some great platforms for competitive programming:

A simple template:

#include <bits/stdc++.h> // including the header stl mentioned earlier

#define ll long long int // setting some macros for fast writing 
#define inf 1e9
using namespace std; 

int main(){
    ios_base::sync_with_stdio(false); // this and the other line will speed up I/O operations
    cin.tie(NULL);
    #ifdef LOCAL // compiler command for executing parts of code only locally 
    ifstream cin("input.txt"); // reading by file.txt 
    #endif
    return 0;
}

In this template:

  • I am adding the library for getting lots of pre-coded algorithms out of the box, the library it self is not an heavyweight library.
  • I am adding macros “#define” that allows me to write a custom shortcut for simplicity and speed. ( You can even create macros with arguments ).
  • The namespace std; allows me to skip the syntax needed before using any element from a library for example vector without it would be std::vector<> instead of vector<>
  • In the main function, i added some lines for fast I/O and check if the code is being compiled locally or not which is a really useful thing for debugging.