Logo
(追記) (追記ここまで)

8158번 - Blockade 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB100342533.784%

문제

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⋅(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.

입력

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.

출력

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.

제한

예제 입력 1

5 5
1 2
2 3
1 3
3 4
4 5

예제 출력 1

8
8
16
14
8

힌트

출처

Olympiad > Polish Olympiad in Informatics > POI 2007/2008 > Stage 2 1번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /