XCPC Nanjing Regional Problem Solutions: B, G, and H

Problem B: What, More Kangaroos? Operations 1 and 2 nullify eachother, as do operations 3 and 4. The problem reduces to applying positive integer operations on two buttons only, yielding four enumeration cases. With operations 1 and 3 chosen, let operation 1 execute x times and operation 3 execute y times (x, y > 0). The goal is maximizing i ...

Posted on Mon, 06 Jul 2026 17:09:43 +0000 by jgetner

SMU Summer 2023 Contest Round 3 Solutions

A. Curriculum Vitae The problem requires finding the longest subsequence where digit 1 is never followed by digit 0. This is equivalent to finding the longest non-decreasing subsequence in a binary sequence. An alternative approach uses prefix sums to count zeros and suffix sums to count ones. #include <bits/stdc++.h> #define endl '\n' # ...

Posted on Tue, 30 Jun 2026 18:04:49 +0000 by daz1034

Solving AtCoder Beginner Contest 367 Problems with C++

A - Shout Everyday This problem involves checking if a specific hour falls within a given time range spanning across midnight. We handle the wrap-around by adjusting the end time. #include <cstdio> int main() { int target, start, end; scanf("%d %d %d", &target, &start, &end); if (end <= start) en ...

Posted on Tue, 09 Jun 2026 16:32:03 +0000 by $var

Solution: COCI 2015-2016 #6 Problem SAN

Problem Analysis: Digit DP Before explaining the correct solution, let's first discuss the partial score approach. For 50% of the data, where (1 \le L, R \le 10^6), a brute force simulation might be feasible. However, since we don't know the exact positions where each number appears, directly simulating with a 2D array is likely to cause memory ...

Posted on Thu, 28 May 2026 19:36:55 +0000 by Fawkman

Maximum Balanced Subrectangle in a Binary Matrix

Given a (n \times m) matrix where each cell contains either 0 (white) or 1 (black), a subrectangle is considered balanced if the number of black cells equals the number of white cells inside it. The task is to find the area (total number of cells) of the largest balanced subrectangle, or 0 if none exists. Both (n) and (m) are at most 10, which ...

Posted on Sun, 24 May 2026 20:53:20 +0000 by KPH71