Two-Dimensional Data Structures for K-th Largest Queries

Problem Overview This problem involves efficiently handling two types of queries on a dynamic collection of elmeents: 1. Insert elements into specified ranges 2. Find the K-th largest value within a specified range We explore several advanced data structure approaches to solve this problem efficiently. ### Binary Indexed Tree with Dynamic Segme ...

Posted on Tue, 01 Sep 2026 16:11:48 +0000 by johnnyblaze9

Essential Algorithm Templates for Competitive Programming

Data Structures Segment Tree #include <iostream> #include <vector> #include <algorithm> using namespace std; typedef long long ll; const int MAXN = 100010; int n, m; vector<ll> arr; vector<ll> tree; vector<ll> lazy; inline ll read() { ll x = 0, f = 1; char ch = getchar(); while (ch < '0' || ...

Posted on Tue, 28 Jul 2026 16:49:08 +0000 by Daggeth

Fenwick Tree Mastery: Core Operations and Practical Applications

Core Functinos 1. Point Update Operation void update(int idx, int delta) { while (idx <= arrSize) { tree[idx] += delta; idx += idx & -idx; // Propagate to parent nodes } } 2. Prefix Sum Query long long query(int pos) { long long result = 0; while (pos > 0) { result += tree[pos]; pos -= pos & -pos; // Move ...

Posted on Sat, 13 Jun 2026 18:23:20 +0000 by rupam_jaiswal

Competition Analysis and Problem Solutions - August 10, 2022

Score: 260 points | Rank: 3rd T1: 100 points T2: 100 points T3: 60 points T4: 0 points Problem Solutiosn T1 - Sequence Generaiton Standard simulation problem. For each sequence iteration, count consecutive digits from the previous sequence. #include <bits/stdc++.h> using namespace std; string sequence[30]; int main() { int n; ...

Posted on Thu, 11 Jun 2026 17:00:42 +0000 by BigMonkey