QOJ.ac

QOJ

Time Limit: 1 s Memory Limit: 1024 MB Total points: 100

#4988. 王牌裁判

Statistics

Alice 和 Bob 正在进行一场友好的乒乓球比赛。比赛由若干轮组成。每一轮结束时,恰好有一名选手获得一分。先达到 11 分的选手获胜。当这种情况发生时,比赛立即结束。Alice 在第一轮开始时发球,然后 Bob 发接下来的两轮,接着 Alice 发两轮,然后 Bob 发两轮,依此类推。

在比赛的任何时刻,当前比分记为 $X-Y$,其中 $X$ 是当前发球方的得分,$Y$ 是另一方的得分。这种不断切换比分记录的方式很容易出错。Eve 是裁判,她记录了比赛中几个不同时刻的比分日志。但由于 Eve 有些不可靠,你担心她记录的分数有误。请编写一个程序,根据 Eve 记录的比分列表,检查该列表是否可能出现在一场真实的比赛中。

输入格式

第一行包含一个整数 $n$ ($1 \le n \le 100$),表示日志中的行数。接下来有 $n$ 行,每行包含一个形如 $X-Y$ ($0 \le X, Y \le 11$) 的字符串,表示 Eve 按时间顺序记录的比分列表。

输出格式

如果输入是某场比赛(不一定已结束)的有效日志,输出 “ok”。否则,输出 “error $i$”,其中 $1 \le i \le n$ 是最大的索引值,使得前 $i-1$ 条记录组成的列表是有效的,但前 $i$ 条记录组成的列表是无效的。

样例

样例输入 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

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.