QOJ.ac

QOJ

Límite de tiempo: 1 s Límite de memoria: 1024 MB Puntuación total: 100

#8444. 虎胆龙威

Estadísticas

John 和 Hans 正在玩一个涉及 3 个骰子的游戏。尽管它们都是 6 面的,但不能保证它们完全相同。

首先,John 从中选择一个骰子,然后 Hans 从剩下的两个骰子中选择一个。接着,他们两人同时掷出自己选择的骰子。如果掷出的点数相同,他们两人都会重新掷骰子。否则,掷出点数较大者获胜。

如果 John 和 Hans 选择的骰子无法分出胜负,他们不会无限期地重掷,此时判定为没有赢家。

你能帮 John 选出一个骰子,使得他获胜的概率至少为 $\frac{1}{2}$ 吗?

Miwin’s dice by Dr.M.Winkelmann, public domain

输入格式

输入包含三行。第 $i$ 行包含 6 个正整数 $x_j$ ($1 \le x_j \le 1000$),描述第 $i$ 个骰子的各个面。

输出格式

输出最小的 $i \in \{1, 2, 3\}$,使得 John 选择第 $i$ 个骰子后,无论 Hans 如何选择剩下的骰子,John 获胜的概率都至少为 $\frac{1}{2}$。如果不存在这样的骰子,输出 “No dice”。

样例

样例输入 1

1 2 3 4 5 6
1 2 3 4 5 6
1 2 3 4 5 6

样例输出 1

1

样例输入 2

1 1 1 1 1 1
2 2 2 2 2 2
3 3 3 3 3 3

样例输出 2

3

样例输入 3

2 2 4 4 9 9
1 1 6 6 8 8
7 7 5 5 3 3

样例输出 3

No dice

样例输入 4

1 1 1 1 1 1
2 2 2 2 2 2
2 2 2 2 2 2

样例输出 4

No dice

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.