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

14412번 - Ronald 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 64 MB129988376.852%

문제

There are N cities in one country that are connected with two-way air links. One crazy airline president, Ronald Krump, often changes the flight schedule. More precisely, every day he does the following:

  • chooses one of the cities,
  • introduces flights from that city towards all other cities where these flights do not currently exist, and at the same time cancels all existing flights from that city

For instance, if from city 5 flights exist towards cities 1 and 2, but not towards cities 3 and 4, after Krump’s change, there will exist flights from city 5 towards cities 3 and 4, but not towards cities 1 and 2.

The citizens of this country are wondering if a day could come when the flight schedule will be complete. In other words, when between each two different cities a (direct) flight will exist. Write a programme that will, based on the current flight schedule, determine whether it is possible to have a Complete Day, or whether this will never happen, no matter what moves Krump makes.

입력

The first line of input contains the integer N (2 ≤ N ≤ 1000), the number of cities. The cities are labeled with numbers from 1 to N.

The second line contains the integer M (0 ≤ M < N*(N-1)/2), the number of current flights.

Each of the following M lines contains two different numbers, the labels of the cities that are currently connected.

출력

The first and only line of output must contain DA (Croatian for “yes”) or NE (Croatian for “no”).

제한

예제 입력 1

2
0

예제 출력 1

DA

예제 입력 2

3
2
1 2
2 3

예제 출력 2

NE

예제 입력 3

4
2
1 3
2 4

예제 출력 3

DA

힌트

​In the first step, Krump will introduce the (only possible) line 1-2.

출처

Contest > Croatian Open Competition in Informatics > COCI 2016/2017 > Contest #5 4번

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

출처

대학교 대회

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

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