Catalan Numbers and Generating Uniform Balanced Bracket Sequences

This was written jointly by errorgorn and me and published on errorgorn’s blog, and the original post is here. You can also check out his personal blog here. Hi everyone! Today nor sir and I would like to talk about generating uniform bracket sequences. Over the past few years when preparing test cases, I have had to generate a uniform bracket sequence a few times. Unfortunately I could not figure out how, so I would like to write a post about this now. Hopefully this post would be useful to future problem setters :) Scroll down to the end of the post to copy our generators. ...

May 27, 2022 · 24 min · 5007 words · nor

InterviewForces Contest #1 (Div. 7) Editorial with Behind The Scenes and Bonus Problems

We ended up making a meme contest, here’s the editorial for the contest. The original editorial is here. Thank you for participating in this round! We hope you found the problems interesting and/or funny. Special thanks to dorijanlendvaj for helping with Polygon related issues. Preparing good tests for certain problems was in fact a good problem in itself (in fact, sometimes they were hard enough for usual CF rounds), and we will mention these problems for the interested reader. ...

May 25, 2022 · 5 min · 1019 words · nor

InterviewForces Contest #1 (Div. 7)

We ended up making a meme contest, here’s the announcement for the contest; the original announcement is here. Hi Codeforces! We are pleased to invite you to [contest:383377], which will take place on [contest_time:383377]. You will be given 9 problems and 2 hours to solve them. Please follow this link in order to register for the contest. Note that this contest is not an official Codeforces round. The round will be unrated for all participants. It will be held according to modified ICPC rules. ...

May 22, 2022 · 2 min · 303 words · nor

Generalized Möbius Inversion on Posets

This post was originally written on Codeforces; relevant discussion can be found here. This post will be more about developing ideas about certain structures rather than actually coding up stuff. The ideas we’ll be developing here have many applications, some of which involve: Number Theoretic Möbius Inversion Principle of Inclusion-Exclusion Directed Acylic Graphs Subset Sum Convolution Finite Difference Calculus (and prefix sums) Note that some of the terminology used below might be non-standard. Also, some parts of the post make a reference to abstract algebra without much explanation; such parts are just for people who know some algebra, and can safely be skipped by those who don’t know those concepts at all. ...

December 27, 2021 · 16 min · 3272 words · nor

Binary search and other "halving" methods

This post was originally written on Codeforces; relevant discussion can be found here. As a certain legendary grandmaster once said (paraphrased), if you know obscure techniques and are not red yet, go and learn binary search. The main aim of this tutorial is to collect and explain some ideas that are related to binary search, and collect some great tutorials/blogs/comments that explain related things. I haven’t found a comprehensive tutorial for binary search that also explains some intuition about how to get your own implementation right with invariants, as well as some language features for binary search, so I felt like I should write something that covers most of what I know about binary search. ...

November 7, 2021 · 27 min · 5555 words · nor

GCC Optimization Pragmas

This post was originally written on Codeforces; relevant discussion can be found here. Introduction A while ago ToxicPie9 and I made and posted this meme: To my surprise, many people are quite confused about it. In fact, I realized there are a lot of misconceptions about pragmas. Most C++ users on Codeforces put a few lines of pragmas at the start of every submission. However, I believe many of them don’t fully understand what they’re doing or how pragmas work; the only thing people seem to think is that “add pragmas -> code go brr”. ...

October 26, 2021 · 12 min · 2466 words · nor

Traversing the complement graph in linear/near-linear time in multiple ways

This post was originally written on Codeforces; relevant discussion can be found here. In this post, I will focus on the following problem: 920E. More generally, we will look at how to do efficiently traverse the complement graph of a given graph in both dfs and bfs orders. In particular, the bfs order also allows us to find a shortest-path tree of the complement graph. This is my first post, so please let me know of any errors/typos that might have crept in. ...

August 12, 2021 · 8 min · 1539 words · nor
>