Preparing algo competition

frequent question types

Figuring out what algo should be used and which standard library to use

Depending on input number N, We have to figure out complexity to select correct methods that will satisfy time and memory limit.
Python calculates about 20,000,000 per sec.
2^10 ~ 1000 : OK
2^20 ~ 1M : OK 2^30 ~ 10 Billion (1,000,000,000) : TLE

Languages

Error Types

VS Code setup

Most of free online IDE such as repl.it are generally open to public. This means that your solutions can be caught as cheating in competetion. (Paid account may have private sessions). Therefore, I will use VS Code for solving problems.
In Windows, I/O redirection is not supported. Install WSL2(Windows Subsystem for Linux 2) for I/O redirection support in VS Code. Linux and Mac does not need any optional action.

  1. Install Python extension.
  2. In VS Code, press cntl + p or cmd + p and search for launch.json and add args line for I/O redirection.
    launch.json:
    "version": "0.2.0",
     "configurations": [
         {
             "name": "Python: Current File",
             "type": "python",
             "request": "launch",
             "program": "${file}",
             "console": "integratedTerminal",
             "args": ["<", "in.txt", ">", "out.txt"]
         }
     ]
    

    Now I/O redirection is activated for your VS Code system.

  3. Create input.txt and output.txt. Open both files and locate them as shown in the picture. This will allow you to check the output immediately.