Educational Codeforces Round 158 (Rated for Div. 2) - Virtual Participation Notes
A. Line Trip
The fuel tank must be sufficient to cover the distance between every pair of consecutive gas stations, and must also allow returning from the destination back to the start point without refueling at the final station.
Click to view solution code
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_st ...
Posted on Mon, 21 Sep 2026 16:54:37 +0000 by bubbadawg
SMU Summer 2023 Programming Contest: Solutions
This document provides solutions for problems from the SMU Summer 2023 Contest, Round 6.
A. Burger Optimization
This problem involves maximizing profit from selling two types of burgers with different ingredients and prices, given a limited number of buns. The strategy is to iterate through all possible counts of the first burger type, up to th ...
Posted on Sat, 12 Sep 2026 16:45:31 +0000 by ccx004
Minimum Cowphabet Sing-throughs for an Observed String
A cow's language, known as Cowphabet, consists of the 26 lowercase letters. However, the order in which a cow recites these letters is a permutation of the standard alphabet sequence. Bessie repeats this song, and Farmer John notes down a string of letters he remembers hearing. The task is to determine the minimum number of complete Cowphabet r ...
Posted on Sun, 06 Sep 2026 16:17:46 +0000 by Bit343
ABC 046 Solutions: Counting, Coloring, Votes and RPS
A – Distinct Count
Input three integers. Output how many different values appear.
#include <bits/stdc++.h>
using namespace std;
int main() {
set<int> bag;
for (int i = 0; i < 3; ++i) {
int x; cin >> x;
bag.insert(x);
}
cout << bag.size() << '\n';
}
B – Coloring a Line of Balls
G ...
Posted on Sat, 05 Sep 2026 16:05:44 +0000 by adrian_quah
Bulb Switcher IV Solution
Problem Analysis
Given a target string of '0's and '1's representing the desired state of bulbs, the goal is to determine the minimum number of flips required to transform an initial state of all '0's to the target state. Each flip operation selects a bulb at position i and flips all bulbs from i to the end of the array.
Key Insight
The problem ...
Posted on Fri, 04 Sep 2026 16:36:31 +0000 by blr32
Finding the Minimum Sum of a K-Avoiding Array
Problem Overview
This article explores an algorithm to find the minimum possible sum of a k-avoiding array with n elements.
Problem Statement
Given two integers n and k, a k-avoiding array is defined as an array of distinct positive integers where no pair of different elements sums to k.
Return the minimum possible sum of such an array with exa ...
Posted on Thu, 03 Sep 2026 16:44:02 +0000 by maxmo
Huffman Tree Construction Algorithm for Programming Competitions
Problem Description
Huffman trees are widely used in encoding applications. This problem focuses only on the construction process of a Huffman tree.
Given a sequence of numbers {pi} = {p0, p1, …, pn-1}, the process to construct a Huffman tree is as follows:
Find the two smallest numbers in {pi}, denote them as pa and pb. Remove pa and pb from ...
Posted on Sat, 22 Aug 2026 16:29:06 +0000 by phpmania1
LeetCode Daily Challenge: Minimum Cost to Make All Characters Equal
Problem Statement
Given a binary string s of length n, we can perform two types of operations:
Select index i and flip all characters from index 0 to i (inclusive), with cost i + 1. Select index i and flip all characters from index i to n - 1 (inclusive), with cost n - i.
Return the minimum cost to make all characters in the string equal.
Examp ...
Posted on Fri, 21 Aug 2026 16:19:02 +0000 by livepjam
Constructing Lexicographically Minimal Strings with Minimized Maximum Prefix Borders
Given a string $s$, the goal is to find a permutation $t$ such that the maximum value of the border length $f(i)$ across all prefixes $i$ of $t$ is minimized. Among all permutations that achieve this minimum, $t$ must be the lexicographically smallest.
Character Analysis and Minimum Border Criteria
For any string containing at least two distinc ...
Posted on Tue, 18 Aug 2026 16:21:49 +0000 by shoz
Counting Segments After Cutting a Sequence Based on a Given Set
Problem
We are given a sequence (a_1, a_2, \ldots, a_n) of length (n) and (m) distinct integers (b_1, b_2, \ldots, b_m). We perform a fierce cut on sequence (a) based on the numbers in (b). Specifical, for each position (i) where (a_i) equals some (b_j), we remove the element at that position, splitting the current sequence/fragment into two fr ...
Posted on Sun, 09 Aug 2026 16:28:13 +0000 by ashebrian