포럼
문제 ICPC00266

I. Incremental Induction

설명

The Nordic Collegiate Pong Championship (NCPC) is an insanely competive tournament where every contestant plays exactly one game of Pong against every other contestant. The last game of the tournament just finished, so only one item now remains on the programme: the traditional diploma ceremony, where all this year's participants get inducted into the NCPC Hall of Fame.

According to the ancient customs, contestants who have not been inducted into the Hall of Fame yet (the pathetic nobodies) must stay on the left side of the stage, whereas contestants who have been inducted (the awesome legends) must be on the right side of the stage. Then, when a contestant is receiving their diploma, they will symbolically walk from the left to the right side of the stage and thus become an awesome legend. Only one contestant is inducted into the Hall of Fame at a time, and every contestant starts on the left side initially.

The NCPC Head of Jury believes it reflects badly on her if too many of the awesome legends on the right have lost matches against pathetic nobodies on the left, but she quickly realizes that it might be impossible to avoid this at every point in time during the diploma ceremony. However, she certainly wants to keep such atrocities at a minimum. Specifically, she wants to find the smallest number \(k\) for which there exists an order of handing out diplomas to the contestants, such that at no point there were more than \(k\) games played where an awesome legend lost against a pathetic nobody.

제약
입력 형식

The first line of input contains a single integer \(n\) (\(1 \leq n \leq 5\,000\)), the number of contestants. Then follows \(n-1\) lines, the \(i^{\text{th}}\) of which contains a binary string of length \(i\). The \(j^{\text{th}}\) character on the \(i^{\text{th}}\) line is \(1\) if contestant \(i+1\) defeated contestant \(j\), and \(0\) if contestant \(j\) defeated contestant \(i+1\).

출력 형식

Output a single integer \(k\), the smallest number according to the requirements above.

예제 1
입력
4
1
01
100
출력
1
예제 2
입력
5
0
00
100
1100
출력
3
문제 정보

생성자가 기록되지 않았습니다.

출처 ICPC NCPC 2019

평가 및 의견

I. Incremental Induction

개요
출제자 난이도 Unrated 레이팅 미적용 의견 0 / 1 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.

풀이 제출

I. Incremental Induction

게스트로 둘러보고 있습니다. 로그인하면 풀이를 제출하고 진행 상황을 확인할 수 있습니다. 로그인하고 제출하기
공개
C++20 Tab 들여쓰기 · Ctrl+/ 주석 토글 · Enter 자동 들여쓰기
1 1 1 0 공백: 4 · UTF-8