QOJ.ac

QOJ

Time Limit: 2 s Memory Limit: 32 MB Total points: 100

#11057. Blockade

統計

There are exactly $n$ towns in Byteotia. Some towns are connected by bidirectional roads. There are no crossroads outside towns, though there may be bridges, tunnels and flyovers. Each pair of towns may be connected by at most one direct road. One can get from any town to any other-directly or indirectly.

Each town has exactly one citizen. For that reason the citizens suffer from loneliness. It turns out that each citizen would like to pay a visit to every other citizen (in his host's hometown), and do it exactly once. So exactly $n\cdot (n-1)$ visits should take place. That's right, should. Unfortunately, a general strike of programmers, who demand an emergency purchase of software, is under way. As an act of protest, the programmers plan to block one town of Byteotia, preventing entering it, leaving it, and even passing through. As we speak, they are debating which town to choose so that the consequences are most severe.

Write a programme that:

  • reads the Byteotian road system's description from the standard input,
  • for each town determines, how many visits could take place if this town were not blocked by programmers,
  • writes out the outcome to the standard output.

Input

In the first line of the standard input there are two positive integers: $n$ and $m$ ($1 ≤ n ≤ 100\,000$, $1 ≤ m ≤ 500\,000$) denoting the number of towns and roads, respectively. The towns are numbered from $1$ to $n$. The following $m$ lines contain descriptions of the roads. Each line contains two integers $a$ and $b$ ($1 ≤ a < b ≤ n$) and denotes a direct road between towns numbered $a$ and $b$.

Output

Your programme should write out exactly $n$ integers to the standard output, one number per line. The ith line should contain the number of visits that could not take place if the programmers blocked the town no. $i$.

Example

Input

5 5
1 2
2 3
1 3
3 4
4 5
problem_11057_1.gif

Output

8
8
16
14
8
About Issues

We understand that our problem archive is not perfect. If you find any issues with the problem, including the statement, scoring configuration, time/memory limits, test cases, etc.

You may use this form to submit an issue regarding the problem. A problem moderator will review your issue and proceed it properly.

STOP! Before you submit an issue, please READ the following guidelines:

  1. This is not a place to publish a discussion, editorial, or requests to debug your code. Your issue will only be visible by you and problem moderators. Other users will not be able to view or reply your issues.
  2. Do not submit duplicated issues. If you have already submitted one, please wait for an moderator to review it. Submitting multiple issues will not speed up the review process and might cause your account to be banned.
  3. Issues must be filed in English or Chinese only.
  4. Be sure your issue is related to this problem. If you need to submit an issue regarding another problem, contest, category, etc., you should submit it to the corresponding page.

Active Issues 0

No issues in this category.

Closed/Resolved Issues 0

No issues in this category.