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

17592번 - Running Routes 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
12 초 (추가 시간 없음) 1024 MB148514032.258%

문제

The administrators at Polygonal School want to increase enrollment, but they are unsure if their gym can support having more students. Unlike a normal, boring, rectangular gym, the gym floor at Polygonal is a regular n-sided polygon! They affectionately refer to the polygon as P.

The coach has drawn several running paths on the floor of the gym. Each running path is a straight line segment connecting two distinct vertices of P. During gym class, the coach assigns each student a different running path, and the student then runs back and forth along their assigned path throughout the class period. The coach does not wan students to collide, so each student’s path must not intersect any other student’s path. Two paths intersect if they share a common point (including an endpoint).

Given a description of the running paths in P, compute the maximum number of students that can run in gym class simultaneously

Figure H.1: Illustrations of the two sample inputs, with possible solutions highlighted in thick red lines. Solid black lines represent running paths that are not assigned to a student, and dashed black lines are used to show the boundary of P in places where no running path exists.

입력

The first line contains an integer n (3 ≤ n ≤ 500), the number of vertices in P. (The vertices are numbered in increasing order around P.) Then follows n lines of n integers each, representing a n × n symmetric binary matrix which we’ll call M. The jth integer on the ith line Mij is 1 if a running path exists between vertices i and j of the polygon, and 0 otherwise. It is guaranteed that for all 1 ≤ i, jn, Mij = Mji and Mii = 0.

출력

Print the maximum number of students that can be assigned to run simultaneously on the running paths, given the above constraints.

제한

예제 입력 1

3
0 1 1
1 0 1
1 1 0

예제 출력 1

1

예제 입력 2

6
0 0 0 1 0 0
0 0 0 0 1 1
0 0 0 0 1 1
1 0 0 0 0 0
0 1 1 0 0 0
0 1 1 0 0 0

예제 출력 2

2

힌트

출처

ICPC > Regionals > North America > North America Qualification Contest > ICPC North America Qualifier 2019 H번

  • 문제를 만든 사람: Nathan Mytelka
(追記) (追記ここまで)

출처

대학교 대회

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

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