SMU Summer 2023 Contest Round 5 Solutions

A. Points in Segments An approach with a time complextiy of $ \mathcal{O}(n \times m) $ works well for small data ranges. The idea is to mark each point within the given intervals and then count how many points are not marked. #include <bits/stdc++.h> #define int long long using namespace std; signed main() { ios::sync_with_stdio(f ...

Posted on Sat, 01 Aug 2026 16:53:59 +0000 by minus4

AtCoder Beginner Contest 159: Complete Editorial and Solutions

A - The Number of Even Pairs Given (n) even numbers and (m) odd numbers, count the number of ways to choose two distinct numbers such that their sum is even. A sum is even only if both numbers have the same parity. The number of ways to pick two evens is (\binom{n}{2} = n(n-1)/2), and for two odds its (\binom{m}{2} = m(m-1)/2). The total is the ...

Posted on Sun, 19 Jul 2026 16:34:57 +0000 by mc2007

Solving Complex SQL Problems: A Micro-to-Macro Approach for Daily New User Retention

Problem Source This problem is from the SQL section of Niuke's Big Company Real Interview Questions, specifically scenario 02: User Growth (Baidu Information Flow), question SQL164: Calculate the next-day retention rate of new users for each day in November 2021. Shifting from Macro-to-Micro to Micro-to-Macro Previous chapters emphasized a top- ...

Posted on Sun, 19 Jul 2026 16:33:12 +0000 by rockindano30

Solutions to a Set of Algorithmic Challenges from an ACGO Ranking Contest

Six problems drawn from a competitive programming rating competition are analysed below. Every solution is accompanied by both C++ and Python implementations. Keep in mind that Python code may run slower and care should be taken with complexity constants. Problem 1 – Output a Digit Different from the Product Given two integers a and b, print an ...

Posted on Thu, 16 Jul 2026 16:13:10 +0000 by machiavelli1079

Dynamic Programming Problems

It is clear that S represents the initial magic value, k is the number of selected items, and x is given in the problem. Noting that x is large but k and n are small, we can define a state that tracks the i-th item, the number of selected items j, and the sum modulo k as l. The goal is to maximize the initial magic value, as higher values reduc ...

Posted on Thu, 09 Jul 2026 17:14:51 +0000 by Virii

SMU Spring 2023 Trial Contest Round 9

A. Incorrect Subtraction Simulate the process of subtracting 1 from the last digit of a number for k times. If the last digit is 0, remove it instead. #include <bits/stdc++.h> #define endl '\n' #define int long long using namespace std; const int N = 2e3 + 10, mod = 1e9 +7; typedef pair<int,int> PII; int n,m,t,k; vector<int& ...

Posted on Fri, 03 Jul 2026 16:28:51 +0000 by mella

Educational Codeforces Round 161 (Div. 2) - Virtual Participation Summary

Preface At first, I was stuck on Problem A for 20 minutes, which was a bit annoying. Then I noticed that more people had solved Problem E than Problem D, so I went for E, but it turned out that D was actually more suitable for me. Sorting Problems: Prioritize problems that can be solved fastest based on the effort required. (Order of answering ...

Posted on Fri, 26 Jun 2026 17:49:15 +0000 by mubashir

AtCoder ABC 001: Interval Merging and Wind Classification Problems

Problem A Subtract two itnegers and output the result. int a, b; cin >> a >> b; cout << a - b << endl; Problem B Problem Statement Given an integer (n), compute the value of (F(n)): $$F(n) = \begin{cases} 0 & n < 100 \ \lfloor \frac{n}{100} \rfloor & 100 \leq n \leq 5000 \ \lfloor \frac{n}{1000} \rfloor + 50 ...

Posted on Fri, 26 Jun 2026 17:23:41 +0000 by gamesmad

Ad-hoc Training

Difficulty range [1, 10], where ≤ 5 is easy, 6 requires thinking for ≤ 30min, 7 is barely solvable (1h). 8 means it's unsolvable but seems not difficult. 9 is currently unsolvable but can be naturally derived from the solution. 10 is extremely difficult to understand even the solution. Thinking time should be around [40, 80] min, not ≤ 30 min. ...

Posted on Sat, 20 Jun 2026 17:01:21 +0000 by philvia

Solving the Two Sum Problem in Python

Problem Statement Given an array of integers, find two distinct indices such that the corresponding elements sum to a specified target value. Each input is guaranteed to have exactly one solution, and elements cannot be reused. Example: For input array [2, 7, 11, 15] and target 9, return [0, 1] since 2 + 7 = 9. Solution Approach A brute-force s ...

Posted on Thu, 11 Jun 2026 18:03:52 +0000 by Helljumper