Skip to content
This repository was archived by the owner on Jun 13, 2025. It is now read-only.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

27 Commits

Folders and files

Repository files navigation

Competitive Programming Exercises

This repository contains competitive programming exercises and solutions developed during my Bachelor's degree in Computer Science at the University of Trento.

Repository Structure

  • Categories/: Solutions organized by algorithmic topic. Each subdirectory corresponds to a category, such as:

    • Super_easy: Beginner-level problems.
    • Ad_hoc: Ad hoc problem-solving.
    • 7 - Simulation: Simulation problems.
    • String_processing: String manipulation tasks.
    • Maths: Mathematical and number theory problems.
    • Data_structures: Data structure implementations and problems.
    • Graphs: Graph algorithms and problems.
    • Dynamic_programming: Dynamic programming problems.
    • Backtracking: Backtracking and exhaustive search.
    • Grid: Grid-based puzzles and problems.
  • Doc_files/: Code templates and snippets (e.g., Fenwick tree, segment tree for RMQ/RSQ, priority queue examples, string splitting) for quick reference.

  • Work_in_progress/: In-progress or experimental problem solutions.

Usage

Each solution is implemented in C++ (typically C++11 or newer). Sample input (*.in) and expected output (*.ans) files are provided alongside many solutions. To compile and test a solution against its sample:

# Compile the solution
g++ -std=c++17 -O2 -o <problem> <problem>.cpp

# Run with sample input and compare the output
./<problem> < <problem>.in > output.ans

diff -u <problem>.ans output.ans

Adjust compiler flags and standard version as needed.

Templates (Doc_files)

The Doc_files directory contains reusable templates:

File Description
base.cpp Base template with fast I/O setup and main entry point.
dyn_RMQ-RSQ.cpp Segment tree for range minimum/maximum queries (RMQ/RSQ).
fenwick_tree.cpp Fenwick (BIT) tree implementation.
priority_queue.cpp Examples of custom comparators with priority queues.
split.cpp String splitting utility using stringstream.

Problem Notes

Many categories include a README.md file with problem-specific notes and tips (often written in Italian).

Contributing

Feel free to explore the solutions and templates. If you notice any improvements or corrections, please fork this repository and submit a pull request.

License

This repository is for personal reference. Please do not redistribute without permission.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages