Codeforces Round #711 Two Houses - Graphs
Solution: For all pairs of points, we sort it from largest to smallest. Query the reachability of the points with higher in-degree to lower in-degree in these pairs in turn.…
Solution: For all pairs of points, we sort it from largest to smallest. Query the reachability of the points with higher in-degree to lower in-degree in these pairs in turn.…
Solution: Just a very simple DP. The hardest part is understanding the problem description and understanding the sample data.…
Solution Compression DP. Let the particles with lifetime $i$ pass through all the planes first. And then calculate the particles with lifetime $i-1$.…
Solution: Since you can do any number of operations, in order to simplify the problem, we can specify $x$ as 1.…
A. Review Site Solution: Put all type 2 users a server. And put type 1 and type 3 users to another one. Then all type 3 users will upvote. Code:…
Solution Obviously we will immediately think of the Kruskal algorithm. Kruskal Let's consider the edge generated by GCD. We can found that:…
Define dp[i] as: after m operations, the length of result change from 1. So of course for 0<=i<=8, dp[i]=1.…
Solution: First notice this property: x&y<=x. Let's see if i=1, then we get a1=a2&a3&...…