I'm not sure how to explain the general process, but try defining what you're trying to calculate into simpler things, even if it means defining new things to store. For e.g. in triplets, either they'll be completely on left or right side, or 2 will be on one side, one on the ...
With C++11, we finally received a hash set and hash map in std::unordered_set and std::unordered_map. Unfortunately, I've seen a lot of people on Codeforces get hacked or fail system tests when using these. In this post I'll explain how it's possible to break these data structures ...
Or because of any other reason, but still, don't solve the easiest problems on Codeforces and expect to become good. Do you want to participate in a virtual round? Sure, go and do this. Don't do this if you are sure that you'd solve them. Do this if you want to check if you...
In bridge-finding, dfs[u]dfs[u] is simply an obfuscated way to check whether one vertex is an ancestor of another in the DFS tree. Meanwhile it is even kind of hard to clearly explain what low[u]low[u] is supposed to represent. Here's how to find bridges in an undirected connected...