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

26024번 - Ace Arbiter 다국어

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

문제

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

예제 출력 1

ok

예제 입력 2

2
1-0
0-0

예제 출력 2

error 2

예제 입력 3

4
11-0
11-0
11-1
11-11

예제 출력 3

error 3

예제 입력 4

4
0-0
1-0
0-2
2-1

예제 출력 4

error 3

힌트

출처

ICPC > Regionals > Europe > Northwestern European Regional Contest > Nordic Collegiate Programming Contest > NCPC 2022 A번

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

출처

대학교 대회

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

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