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

19178번 - (Smurf)Land protection 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
5 초 512 MB25111045.455%

문제

In SmurfLand there are $n$ Smurf villages and $m$ roads connecting them. Each road can be used to transport goods only in one direction. Some roads may lead from some village to itself and there might be more than one road connecting a pair of villages. The Smurfs have developed trade unions. Each trade union is a maximal subset of villages with the property that it is possible to transport goods from any village to any other village inside that trade union. Gargamel is planning to destroy one of the villages. It would be a disaster if after the village is destroyed the number of trade unions would have to increase. Help Smurfs decide which villages will need to be protected to ensure that the disaster doesn't happen.

입력

The first line of input contains two integers $n$ and $m$ (1ドル \leq n \leq 2\cdot 10^5,ドル 1ドル \leq m \leq 5\cdot 10^5$) -- the number of villages and roads. The next $m$ lines describe the roads: each line contains two integers $u, v$ (1ドル \leq u,v \leq n$) specifying that there is a road directly connecting villages with numbers $u$ and $v$.

출력

Ouput $n$ lines: $i$th line should contain the word "YES" (without quotes) if Smurfs must protect $i$th village or the word "NO" otherwise.

제한

예제 입력 1

7 9
1 2
3 1
2 3
1 3
3 5
3 4
4 1
5 6
6 5

예제 출력 1

YES
NO
YES
NO
NO
NO
NO

힌트

출처

Camp > Petrozavodsk Programming Camp > Winter 2015 > Day 5: U of Wroclaw Contest L번

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

출처

대학교 대회

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

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