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

5237번 - Connected or Not Connected 다국어

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

문제

Sam and Quorra are trying to build a map of a secret base in the Grid world that contains a number of (virtual) sites interconnected by (virtual) pathways. Although they know the number of sites (n), their knowledge of interconnections between the sites is sparse. Several different programs that have been inside the base are able to give them some information about the connections between the sites, and Sam and Quorra need to put it together. In particular, they would like to make sure that they have enough information to know how to go from every site to every other site.

Your goal is to help them decide if a specified set of connections is enough to ensure that there is a path from every site to every other site. Assume that the connections are bi-directional, i.e., if we know that there is a connection between site 1 and site 2, then we can go from site 1 to site 2, and vice versa.

입력

The first line in the test data file contains the number of test cases (≤ 50). After that, each line contains a test case. The first number in each test case is the number of sites, n (≤ 100). The sites are numbered from 0 to n − 1. The second number is the number of connections between the sites, k (≤ 200). After that there are k pairs of numbers, one for each connection. The connections might repeat and further, there may be self-connections (i.e., a connection from a site to itself).

출력

For each test case, you are to check whether there is path from every site to every other site, and output “Connected.” or “Not connected.” accordingly.

제한

출력 형식

정확한 출력 형식은 제출에서 언어를 Java로 설정하면 확인할 수 있다.

예제 입력 1

3
5 4 0 1 1 2 2 3 3 4
6 6 0 1 1 2 2 0 3 4 4 5 5 3
5 9 0 1 1 2 2 3 3 4 1 0 2 1 3 2 2 3 4 3 

예제 출력 1

Connected.
Not connected.
Connected.

힌트

출처

School > University of Maryland High School Programming Contest > HSPC 2011 연습 세션 P3번

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

출처

대학교 대회

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

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