Skip to content

jhonber/Programming-Contest

Repository files navigation

Programming contest

Solutions for some problems

Note:

Using getSubmissions2.0 to download automatically all submissions from Codeforces

Some problems sorted by tag

C++ courses

Hackerrank

Introduction - [Solutions] : data structure

Strings - [Solutions] : getline + parser + stringstream

Classes - [Solutions] : Classes and Objects + Structs + Templates + Inheritance + Polymorphism

STL - [Solutions] : deque + map


Data structures

Babaei and Birthday Cake - [source] : dp + segment tree

Sereja and Brackets - [source] : segment tree

1082 – Array Queries - [source] : segment tree

Cows and Sequence - [source] : fenwick tree

Pasha and String - [source] : fenwick tree

Petr# - [source] : hashing

Watto and Mechanism - [source] : trie

Greedy - [source] : deque

Bit Array - [source] : Bit array + bitwise operations + cycle detection in sequence

Present - [source] : Sqrt N decomposition

Rectangle Path - [source] : Summed area table

Fountains - [source] : Maximum value in range

Prefix free subset - [source] : trie


DP

1050 – Marbles - [source] : dp

1064 –Throwing Dice - [source] : dp

1033 – Generating Palindromes - [source] : dp

1011 – Marriage Ceremonies - [source] : dp + bitmasks

1038 – Race to 1 Again - [source] : dp + expected value

Journey - [source] : expected value

Destruction Cannon - [source] : dp

Tetrahedron - [source] : dp

k-Tree - [source] : dp + trees

A and B and Interesting Substrings - [source] : dp

Modulo Sum - [source] : dp

Kefa and Dishes - [source] : dp + bitmasks

Magic Spells - [source] : dp + longest commom subsequence

Barcode - [source] : dp


Graphs

Guilds - [source] : disjoint set

The Tourist Guide - [source] : krustal

Outing - [source] : dp + krustal

New Reform - [source]: cycles in undirected graphs + disjoint set

Binary Search Tree - [source] : bst + reconstruct + preorder + inorder + postorder

Level Order Tree Traversal - [source] : bfs + reconstruct

NP-Hard Problem - [source] : bfs + Bipartite graph

Weekend - [source] : Floyd Warshall + shortest path

Directed Roads - [source] : Mod pow + disjoint set

A - Dwarves - [source] : cycles in directed graphs

News Distribution - [source] : disjoint set


Maths

Ones - [source] : mod pow + modular arithmetic

How Many Zeros and How Many Digits? - [source] : factorial + trailing zeros + digit count + prime factorization + base conversion

Quid Est Veritas? Est Vir Qui Adest! - [source] : mod pow + modular arithmetic + modular inverse + permutations + Santa Marta

Fedya and Maths - [source] : modular arithmetic

Selection of Personnel - [source] : Pascal triangle + combinatorics

Iterated Linear Function - [source] : mod pow + mod inverse + modular arithmetic

Star - [source] : Euler's totient

Molly's Chemicals - [source] : prefix sum -> Be careful using unordered_map on codeforces, in the worse case the complexity is O(n) because of collisions. Compiler used in codeforces is MinGW g++.exe (GCC) 4.9.2

Wonder Room - [source] : math

Binomial Coefficients - [source] : math + combinatorics + Parity

Odds and Evens 2.0 - [source] : math + combinatorics + Parity + Stars and Bars

13074 Fixed-point theorem - [source] : math + LCM


Geometry

Rectangle Puzzle - [source] : Sutherland Hodgman

Nearest vectors - [source] : geometry

Volatile Kite - [source] : geometry


Matrices

1065 – Number Sequence - [source] : matrices


Big integer

Factorial Sum - [source] : Big integer


Base conversion

Simple Base Conversion - [source] : hexa + dec

Base Conversion - [source] : hexa + dec + bin


Implementation

Roman Numerals for Page Numbers - [source] : Roman numerals

Chasing the Cheetahs - [source] : Ternary Search + doubles

Sequence analysis - [source] : cycle detection in sequence + floyd + tortoise and hare

Friends and Presents - [source] : Binary Search

The Meeting Place Cannot Be Changed - [source] : Binary Search + intersection between N ranges [l, r]

Perform the Combo - [source] : Prefix sum

About

Solutions for some problems

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages