#P6269. Maximum Number of Bridges
Maximum Number of Bridges
Maximum Number of Bridges
In a futuristic aerial city, there are many small islands (districts). Bridges can be built between two islands, but there is a rule: if there is a bridge between and , and a bridge between and , then a bridge between and is not allowed. In other words, for any three islands, it is forbidden to have bridges built between every pair (i.e. a triangle is not allowed). Under this constraint, your task is to build as many bridges as possible between the islands without considering any spatial issues.
Note: This problem is equivalent to finding the maximum number of edges in a triangle-free graph with vertices. By Mantel's theorem, the maximum number of edges is ( \lfloor \frac{n^2}{4} \rfloor ).
inputFormat
The input consists of a single integer () representing the number of islands.
outputFormat
Output a single integer denoting the maximum number of bridges that can be constructed under the given constraints.
sample
1
0