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

30288번 - Rally 서브태스크스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
0.5 초 1024 MB61252240.741%

문제

Byteland has N cities. Some of the cities are connected by roads.

Byteland rally organisers asked you to set up a track that would consist of exactly four roads and that would start and end in the same city. A road can not be added to the track more than once.

Figure 1: Four marked roads make a valid track

Knowing the road map of Byteland, set up a rally track.

입력

The first line contains the number of cities N and the number of roads M. Cities are numbered from 1 to N.

The following M lines describe M roads. Each line contains 2 integers from 1 to N – the numbers of the cities the road connects.

Roads connect distinct cities, and any pair of cities is connected by at most one road.

출력

If it is possible to set up a track, output TAIP on the first line. On the second line output four numbers – the city numbers the track goes through.

If several solutions are possible, output any of them.

If it is impossible to set up a track, output NE.

제한

  • 1 ≤ N ≤ 5 000
  • 0 ≤ M ≤ 500 000
  • M ≤ N(N - 1)/2

서브태스크

번호배점제한
110

1 ≤ N ≤ 100

230

1 ≤ N ≤ 400

325

1 ≤ N ≤ 1 100

435

1 ≤ N ≤ 5 000

예제 입력 1

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

예제 출력 1

TAIP
4 3 2 1

Example is shown in the figure above. There are different possible solutions.

예제 입력 2

5 4
1 2
2 3
3 4
4 5

예제 출력 2

NE

It is impossible to set up a track.

힌트

출처

Olympiad > Lithuanian Olympiad in Informatics > Lithuanian Olympiad in Informatics 2015/2016 > National Round (2) > 7-9 Classes 1번

Olympiad > Lithuanian Olympiad in Informatics > Lithuanian Olympiad in Informatics 2015/2016 > National Round (2) > 10-12 Classes 1번

채점 및 기타 정보

  • 예제는 채점하지 않는다.
(追記) (追記ここまで)

출처

대학교 대회

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

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