#P1416. 攻击火星
攻击火星
Description
A group of aliens are going to attack Mars.
The map of Mars is an undirected graph with vertices. The aliens invade as follows: they first attack vertices of degree (equivalently, delete them from the graph), then vertices of degree , and so on up to degree .
All degree counts are updated dynamically. After a vertex is deleted, the degrees of its adjacent vertices all decrease by . When attacking vertices of a certain degree, the aliens attack them simultaneously.
You need to design the edges of the graph to maximize the number of vertices that remain un-attacked. Note: the graph you design does not allow self-loops or multiple edges.
Input Format
The input contains one line with an integer .
Output Format
Output a single integer, the maximum number of vertices that remain un-attacked in the end.
3
1
Hint
[Sample Explanation]
One possible construction is . In this case, vertices and with degree are deleted first. Then vertex has degree and will not be deleted.
[Constraints]
- For of the testdata, .
- For of the testdata, .
[Source]
Adapted by tinylic.
Translated by ChatGPT 5
京公网安备 11011102002149号