Codeforces Round #EDR118 Editorial
A - Long Comparison
To compare two numbers represented as x1 * 10^p1 and x2 * 10^p2, first compare their total digit lengths: len(x1) + p1 vs len(x2) + p2. If unequal, the result is immediate. Otherwise, reduce both exponents by their minimum to ensure at least one becomes zero. Then scale the base integers accordingly and compare directly. Sin ...
Posted on Wed, 07 Oct 2026 16:44:20 +0000 by omniuni
CodeForces 1406 - Codeforces Round #670 (Div. 2) Editorial
Contest Overview
This round was relatively straightforward, so this editorial will focus on both the technical problem solutions and the interesting sequence of events during the contest.
Problem A - Subset Mex
Problem Statement: Given a set a with |a| = n, partition it into two sets A and B to maximize mex(A) + mex(B). Multiple test cases.
Con ...
Posted on Tue, 06 Oct 2026 16:45:21 +0000 by Brendan Nolan
Implementing Heap Sort and Quick Sort Algorithms
Heap Sort Implementation
Heap sort utilizes a binary heap structure to sort elements. A heap is a complete binary tree where each node satisfies the heap property - either being a max-heap (parent >= children) or min-heap (parent <= children). The algorithm consists of two phases: heap construction and element exrtaction.
Heap Constructio ...
Posted on Mon, 05 Oct 2026 16:43:36 +0000 by brokencode
Solutions to Programming Contest Problems
Problem Solutions
Problem 1: Commute Calculation
#include <iostream>
using namespace std;
int main() {
int base, bonus1, bonus2;
cin >> base >> bonus1 >> bonus2;
cout << base + min(bonus1, bonus2) << endl;
return 0;
}
Problem 2: Adoration Count
#include <cstdio>
#include <algorithm& ...
Posted on Mon, 05 Oct 2026 16:36:31 +0000 by ca87
Two Pointer and Sliding Window Techniques for Competitive Programming
Two Pointers
Two pointers is a fundamental technique that uses two references to traverse data structures simultaneously. There are two primary variants:
Collision Pointers (Converging Pointers): Both pointers start from opposite ends and move toward each other.
Fast and Slow Pointers: Both pointers move in the same direction but at different s ...
Posted on Mon, 05 Oct 2026 16:20:51 +0000 by maxf
C++ STL Algorithms and Fundamental Programming Practice
Exercise 1: Modern C++ Programming Basics
Task 1: STL Algorithm Deomnstration - reverse, reverse_copy, rotate
Source code:
#include <bits/stdc++.h>
using namespace std;
// Template function declaration
template<typename T>
void printContainer(const T& container);
// Regular function declarations
void demoReverseOperations();
v ...
Posted on Sun, 04 Oct 2026 16:49:06 +0000 by dabaR
Programming Contest Solutions and Analysis
Contest Overview
Total Score: 290
Ranking: 3
Problems Solved: 2
Problem Solutions
Problem 1: Interview Screening
Score: 100
**Analysis:**This is a relatively straightforward problem that resembles bucket sorting. The key is to properly handle the conditional checks without mixing them up.
Implementation:
// Store possible outcomes
string result ...
Posted on Sun, 04 Oct 2026 16:07:53 +0000 by dswain
AtCoder Beginner Contest 059 Problem Solutions
Problem A: Enitial Letter Extraction
Given three space-separated lowercase strings, output their initial letters in uppercase.
std::string s; std::getline(std::cin, s);
for (int i = 0; i < (int)s.size(); i++) {
if (i == 0 || s[i - 1] == ' ') std::cout << char(s[i] - 'a' + 'A');
}
std::cout << "\n";
Problem B: Large ...
Posted on Fri, 02 Oct 2026 16:54:42 +0000 by joshmpratt
Core Algorithm Exercises in Java: Sorting, Searching, and Array Manipulation
Merging and Sorting Two Arrays
To combine two integer arrays into a single sorted list, one must first determine the total capacity required to hold elements from both sources. A new array is instantiated with this combined length. Elements from the first array are copied sequentially into the new container, followed by elements from the second ...
Posted on Fri, 02 Oct 2026 16:50:12 +0000 by s2day
Exploring Modern C++ through Standard Library Algorithms
Task 1: Sequence Manipulation with Iterators
This task demonstrates the manipulation of container elements using standard algorithms. We will explore how to reverse sequences and perform cyclic rotations on both strings and vectors.
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include < ...
Posted on Fri, 02 Oct 2026 16:22:18 +0000 by HeinekenBeer