{"trustable":false,"prependHtml":"\u003cstyle type\u003d\"text/css\"\u003e\n section pre {\n display: block;\n padding: 9.5px;\n margin: 0 0 10px;\n font-size: 13px;\n line-height: 1.42857143;\n word-break: break-all;\n word-wrap: break-word;\n color: #333;\n background: rgba(255, 255, 255, 0.5);\n border: 1px solid #ccc;\n border-radius: 6px;\n }\n\u003c/style\u003e\n\u003cscript\u003e\n window.katexOptions \u003d {\n delimiters: [\n {left: \u0027\\\\(\u0027, right: \u0027\\\\)\u0027, display: false},\n {left: \u0027\\\\[\u0027, right: \u0027\\\\]\u0027, display: true}\n ]\n };\n\u003c/script\u003e\n","sections":[{"title":"Problem Statement","value":{"format":"MD","content":"N个选手们将参加网球比赛。 我们用选手1, 选手2, ..., 选手N来表示他们。\n比赛采用循环赛形式,比赛总数为N*(N-1)/2。现在csa问你是否有可能在满足以下所有条件的前提下安排这些比赛?如果答案是肯定的,你还需要找出所需的最少天数。\n\n1.每个选手一天最多打一场比赛。 \n2.每个选手i按a[i][1], a[i][2],..., a[i][N - 1]的顺序与其他选手比赛。"}},{"title":"Constraints","value":{"format":"MD","content":"1.3\u003c\u003dN\u003c\u003d1000\n2.1 \u003c\u003d a[i][j] \u003c\u003d N\n3.a[i][j] !\u003d i\n4.a[i][1], a[i][2], ..., a[i][N - 1] 两两不同"}},{"title":"Input","value":{"format":"MD","content":"第一行输入一个数N,接下来输入N行,每行N-1个数,第i + 1行的第j个数代表a[i][j]。"}},{"title":"Output","value":{"format":"MD","content":"如果能在满足所有约束条件的前提下安排所有比赛,输出比赛最少的天数,否则输出“-1”。\n"}},{"title":"Sample Input 1","value":{"format":"MD","content":"\u003ch3\u003e\u003c/h3\u003e\n\u003cpre\u003e3\n2 3\n1 3\n1 2\n\u003c/pre\u003e"}},{"title":"Sample Output 1","value":{"format":"MD","content":"\u003ch3\u003e\u003c/h3\u003e\n\u003cpre\u003e3\n\u003c/pre\u003e \n\u003cp\u003e方案如下:\u003c/p\u003e \n\u003cul\u003e \n \u003cli\u003eDay1: 选手1 vs 选手2\n \u003cli\u003eDay2: 选手1 vs 选手3 \n \u003cli\u003eDay3: 选手2 vs 选手3\n\u003c/ul\u003e \n\u003cp\u003e这是最优方案.\u003c/p\u003e"}},{"title":"Sample Input 2","value":{"format":"MD","content":"\u003ch3\u003e\u003c/h3\u003e\n\u003cpre\u003e4\n2 3 4\n1 3 4\n4 1 2\n3 1 2\n\u003c/pre\u003e"}},{"title":"Sample Output 2","value":{"format":"MD","content":"\u003ch3\u003e\u003c/h3\u003e\n\u003cpre\u003e4\n\u003c/pre\u003e \n\u003cp\u003e方案如下:\u003c/p\u003e \n\u003cul\u003e \n \u003cli\u003eDay1: 选手1 vs 选手2, 选手3 vs 选手4\u003c/li\u003e \n \u003cli\u003eDay2: 选手1 vs 选手3\u003c/li\u003e \n \u003cli\u003eDay3: 选手1 vs 选手4, 选手2 vs 选手3\u003c/li\u003e \n \u003cli\u003eDay4: 选手2 vs 选手4\u003c/li\u003e \n\u003c/ul\u003e \n\u003cp\u003e这是最优方案\u003c/p\u003e"}},{"title":"Sample Input 3","value":{"format":"MD","content":"\u003ch3\u003e\u003c/h3\u003e\n\u003cpre\u003e3\n2 3\n3 1\n1 2\n\u003c/pre\u003e"}},{"title":"Sample Output 3","value":{"format":"MD","content":"\u003ch3\u003e\u003c/h3\u003e\n\u003cpre\u003e-1\n\u003c/pre\u003e \n\u003cp\u003e没有合法方案\u003c/p\u003e"}}]}