Fading Coder

One Final Commit for the Last Sprint

Implementing Solutions for CSP 2020 Problems

Power Decomposition Given an integer n, output its representation as a sum of distinct powers of two in descending order, or -1 if n is odd. #include <iostream> using namespace std; int main() { int val; cin >> val; if (val % 2 != 0) { cout << "-1"; return 0; } for (int e...

Advanced Tree Structures for Path Aggregation and Sequence Manipulation

Dynamic Segment Tree Merging Combining two dynamically allocated segment trees enables efficient aggregation of information across disjoint sets or hierarchical structures. The operation recursively merges corresponding nodes from both trees. When one subtree is empty, the non-empty counterpart is r...

Solutions to the 2024 Blue Bridge Cup Provincial C++ Intermediate/Advanced Group Programming Problems

T1 - Reading Plan Problem: A book has (n) pages. On the first day, a person reads (x) pages. Each subsequent day, they read (y) pages more than the previous day. How many days are needed to finish the book? Input: Three integers (n), (x), (y) ((20 \le n \le 5000, 1 \le x, y \le 20)) separated by spa...

Computing the Minimum MEX of Subarray LCMs

Given a sequence (a) of (n) positive integers, a positive integer (x) is considered non-humor if there exists a contiguous subarray whose least common multiple (LCM) equals (x). The task is to find the smallest positive integer that is not non-humor, i.e., the minimum excluded value (MEX) from the s...