Tag intro

First Post

Welcome to my blog! I go by smax on Codeforces and most other competitive programming sites, and this is a fun personal project for me that I’ve always wanted to...

Tag tutorial

Simulating Cost Flow

This post assumes knowledge of min/max cost flow and a rough understanding of the high-level methods for solving (successive shortest path and cycle canceling). Knowledge of specific algorithms and implementation...

Segment Tree Merging

Segment tree merging often serves as an alternative to small-to-large while also cutting an extra log factor, or can be used for “directed” merging (i.e. the merging is not symmetric...

Transition Then State

When we think about the classic model for dynamic programming, typically we think about first enumerating the state, and then enumerating the transitions from that state. But sometimes that perspective...

Kruskal Reconstruction Tree

The Kruskal Reconstruction Tree (KRT) is something that is prevalent in folklore but scarcely documented, and most high rated users have probably either used this trick inadvertently or know of...

A Shift in Perspective

I’ve seen numerous problems recently where the solution comes from a shift in perspective, and I’ve found them amusing enough to write a whole blog around this topic. I wouldn’t...

Historic Information on Segment Trees

It’s been a while, but I’m back with some more estoric knowledge! Historic information is a concept I’ve only seen briefly mentioned in this tutorial on segment tree beats, and...

Trivialize Linear Recurrence Problems with Berlekamp-Massey!

Berlekamp-Massey is a powerful tool that can knock out almost all linear recurrence problems, but it’s often explained in the context of BCH decoding in many online tutorials, making it...

How to Understand Hard Tutorials

Hooray, it’s my first post of October, meaning I’ve kept this blog running for at least a month!

Solutions to SPOJ GSS Series

SPOJ has a series of problems with problem codes GSS1, GSS2, …, GSS8. The problems are intended as educational range query problems, and while they are a bit outdated, they...

Applications of Divide and Conquer

Divide and conquer (D&Q for short) is a common and powerful problem solving paradigm in the world of algorithms. There are numerous well-known examples such as merge sort and fast...

Burnside's Lemma

Disclaimer: I typed this up a few months prior to making this website as personal notes for myself, so it’s possible that the article may be unclear in certain sections....

Tag math

Trivialize Linear Recurrence Problems with Berlekamp-Massey!

Berlekamp-Massey is a powerful tool that can knock out almost all linear recurrence problems, but it’s often explained in the context of BCH decoding in many online tutorials, making it...

Burnside's Lemma

Disclaimer: I typed this up a few months prior to making this website as personal notes for myself, so it’s possible that the article may be unclear in certain sections....

Tag opinion

September 2022 Update

Hey everyone, it’s been too long since I last took the time to sit down and write a blog post. There’s a multitude of reasons why I haven’t written anything...

Maintaining a CP Library

I love maintaining a competitive programming library. You get to implement things attuned to your own personal style, and it’s super satisfying when you use something from your library to...

Self Reflection and What's Next?

It’s been a month since my last major milestone in CP, and high time for some self reflection. There are two major CP competitions I competed in this month: Facebook...

How to Understand Hard Tutorials

Hooray, it’s my first post of October, meaning I’ve kept this blog running for at least a month!

How Fair are Facebook Hacker Cup's Rules?

Facebook Hacker Cup is different from many other competitive programming competitions due to its submission format: instead of automatically judging competitiors’ submissions via an online judge, competitors are given the...

Long Challenges are Awesome

Short contests are fun, although not without its fair share of frustrating moments. Have you ever come so close to solving a problem, but ran out of time? If only...

What Makes a Problem Hard?

Just go to the comment section of any announcement blog for a contest, and you’ll likely see a comment like “A < C < B” or “E was much easier...

Tag algo

Simulating Cost Flow

This post assumes knowledge of min/max cost flow and a rough understanding of the high-level methods for solving (successive shortest path and cycle canceling). Knowledge of specific algorithms and implementation...

Segment Tree Merging

Segment tree merging often serves as an alternative to small-to-large while also cutting an extra log factor, or can be used for “directed” merging (i.e. the merging is not symmetric...

Transition Then State

When we think about the classic model for dynamic programming, typically we think about first enumerating the state, and then enumerating the transitions from that state. But sometimes that perspective...

Kruskal Reconstruction Tree

The Kruskal Reconstruction Tree (KRT) is something that is prevalent in folklore but scarcely documented, and most high rated users have probably either used this trick inadvertently or know of...

Historic Information on Segment Trees

It’s been a while, but I’m back with some more estoric knowledge! Historic information is a concept I’ve only seen briefly mentioned in this tutorial on segment tree beats, and...

Solutions to SPOJ GSS Series

SPOJ has a series of problems with problem codes GSS1, GSS2, …, GSS8. The problems are intended as educational range query problems, and while they are a bit outdated, they...

Applications of Divide and Conquer

Divide and conquer (D&Q for short) is a common and powerful problem solving paradigm in the world of algorithms. There are numerous well-known examples such as merge sort and fast...

Tag personal

September 2022 Update

Hey everyone, it’s been too long since I last took the time to sit down and write a blog post. There’s a multitude of reasons why I haven’t written anything...

2022 ICPC North American Championship

Yay the blog has been revived!

My First Ever ICPC Regionals Experience!

This past weekend, I attended my first ever ICPC regionals! It was an incredibly fun and enlightening experience for me, so I’d like to share with you some takeaways I...

A Competitive Winter Break

Happy new year! It’s been a minute since I last posted, but here’s my first post of 2022. I was trying to go for a title similar to Petr’s blog...

Self Reflection and What's Next?

It’s been a month since my last major milestone in CP, and high time for some self reflection. There are two major CP competitions I competed in this month: Facebook...

Tag ds

Segment Tree Merging

Segment tree merging often serves as an alternative to small-to-large while also cutting an extra log factor, or can be used for “directed” merging (i.e. the merging is not symmetric...