아직 만들고 있는 페이지입니다.

이 페이지는 아직 만드는 중입니다. 보이는 내용은 바뀔 수 있습니다.

Ace Arbiter

시간 제한1초메모리 제한1024 MB

요약
탁구 경기에서 서브가 번갈아 바뀌고 11점 선취로 끝나는 규칙을 따를 때, 적힌 점수 기록이 실제로 나올 수 있는지 판정한다.
난이도

보통10점 중 4점

유형
시뮬레이션, 구현
정답자
아직 제출이 없습니다

문제

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 XX-YY, where XX is the number of points of the player who is currently serving, and YY 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 nn (1≤n≤1001 \le n \le 100), the number of lines in the log. Then follow nn lines, each containing a string of the from XX-YY (0≤X,Y≤110 \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 ii", where 1≤i≤n1 \le i \le n is the largest value such that the list of the first i−1i-1 entries is valid, but the list of the first ii entries is invalid.

예제4

  1. 예제 1

    입력
    5
    0-0
    1-0
    1-0
    2-0
    1-2
    
    예상 출력
    ok
    
  2. 예제 2

    입력
    2
    1-0
    0-0
    
    예상 출력
    error 2
    
  3. 예제 3

    입력
    4
    11-0
    11-0
    11-1
    11-11
    
    예상 출력
    error 3
    
  4. 예제 4

    입력
    4
    0-0
    1-0
    0-2
    2-1
    
    예상 출력
    error 3