#P40018. 2019 ICPC NA Qualifier Contest H - Running Routes
2019 ICPC NA Qualifier Contest H - Running Routes
题目描述
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 -sided polygon! They affectionately refer to the polygon as .
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 . 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 want 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 , compute the maximum number of students that can run in gym class simultaneously.
输入格式
The first line contains an integer (), the number of vertices in . (The vertices are numbered in increasing order around .) Then follows lines of integers each, representing a symmetric binary matrix which we’ll call . The integer on the line is if a running path exists between vertices and of the polygon, and otherwise. It is guaranteed that for all , and .
输出格式
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