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

5239번 - Chess Puzzle 다국어

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

문제

Jake and Sully are playing around with a chessboard one night after working with their avatars all day. They decide it would be interesting to place some rooks on the chessboard in a way that no rook can threaten another rook. Since rooks move along rows and columns, this means two rooks may not be on the same row or column. Your goal is to write a program to determine whether any rooks are threatened.

입력

Chessboards are 8x8 boards with positions between (1,1) and (8,8). The input begins with the number of chess boards. Each chessboard is on a separate line and begins with the number of rooks, followed by the column and row positions of each rook.

출력

For each chessboard, your program should output the words ”SAFE” or ”NOT SAFE” on a single line.

제한

출력 형식

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

예제 입력 1

2
3 1 1 2 6 8 8
2 2 3 1 3

예제 출력 1

SAFE
NOT SAFE

힌트

출처

School > University of Maryland High School Programming Contest > HSPC 2010 2번

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

출처

대학교 대회

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

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