Creating p-interesting graphs

39 Views Asked by At

Let's call an undirected graph of n vertices p-interesting, if the following conditions fulfill: ? the graph contains exactly 2n + p edges; the graph doesn't contain self-loops and multiple edges; for any integer k (1 ≤ k ≤ n), any subgraph consisting of k vertices contains at most 2k + p edges.

A subgraph of a graph is some set of the graph vertices and some set of the graph edges. At that, the set of edges must meet the condition: both ends of each edge from the set must belong to the chosen set of vertices.

Your task is to find a p-interesting graph consisting of n vertices.

This a question from codeforces, https://codeforces.com/blog/entry/10972. However, I am finding the explanation impossible to understand. Does anyone understand why we are only considering 0 and 3-interesting subgraphs? To me, a triangle is a loop.