File Extension
C++ files must use the.cpp extension:
Compilation
C++ files are compiled usingg++ with the following command:
Compilation Flags
-std=c++17- Uses C++17 standard-Wall- Enables all compiler warnings-DONLINE_JUDGE=1- Defines theONLINE_JUDGEmacro for conditional compilation-o .qt/main- Outputs the compiled binary to.qt/main
The
ONLINE_JUDGE macro allows you to write code that behaves differently in local testing vs online judges.Execution
After compilation, the binary is executed with:Example Code
Here’s a typical C++ solution for competitive programming:Usage with Quick Test
Compare Mode (cmp)
Compare your solution against a brute-force correct solution:Stress Testing Mode
Test your solution’s performance:Checker Mode
For problems with multiple valid answers:Requirements
Verify your installation:Common Headers
The#include <bits/stdc++.h> header is a non-standard GCC header that includes most C++ standard library headers. While convenient for competitive programming, it’s not recommended for production code.
Platform Support
- Linux: Full support
- Windows: Full support
- macOS: Full support