포럼
문제 ICPC00286

A. Ace Arbiter

설명

Alice and Bob are playing a friendly game of ping pong. The game consists of several rounds. At the end of each round, exactly one player gets one point. The first player to 11 points wins. When that happens, the game immediately ends. Alice start serving the first round, then Bob serves for the next two rounds, then Alice serves twice, then Bob serves twice, and so on.

At any time in the game, the current score is written \(X\)-\(Y\), where \(X\) is the number of points of the player who is currently serving, and \(Y\) is the number of points of the other player. This constant switching of the scores back and forth can be a little bit error-prone. Eve is the umpire, and she wrote down a log of the current scores at a few different times during the game. But since Eve is a bit unreliable, you worry that she wrote down the wrong scores. Write a program which, given the list of scores Eve wrote down, checks whether or not this list of scores can appear in an actual game.

제약
입력 형식

The first line of input contains an integer \(n\) (\(1 \le n \le 100\)), the number of lines in the log. Then follow \(n\) lines, each containing a string of the from \(X\)-\(Y\) (\(0 \le X,Y \le 11\)), the list of scores Eve wrote down, in chronological order.

출력 형식

If the input is a valid log of a not necessarily finished game, output "ok". Otherwise, output "error \(i\)", where $1 \le i \le
n\( is\ the\ largest\ value\ such\ that\ the\ list\ of\ the\ first \)i-1\( entries\ is\ valid, but\ the\ list\ of\ the\ first \)i$ entries is invalid.

예제 1
입력
5
0-0
1-0
1-0
2-0
1-2
출력
ok
예제 2
입력
2
1-0
0-0
출력
error 2
예제 3
입력
4
11-0
11-0
11-1
11-11
출력
error 3
예제 4
입력
4
0-0
1-0
0-2
2-1
출력
error 3
문제 정보

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

출처 ICPC NCPC 2022

평가 및 의견

A. Ace Arbiter

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

Log in to rate problems.

개별 의견

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

풀이 제출

A. Ace Arbiter

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