QOJ.ac

QOJ

时间限制: 1 s 内存限制: 1024 MB 总分: 100

#10683. 掷骰子

统计

Alice 和 Bob 正在讨论点球大战及其随机性:“我们还不如掷骰子来决定胜负呢!”,Alice 说道。于是他们开始模拟点球大战:每人掷骰子,将各自骰子上的点数相加,并比较这些总和。总和较大者获胜;若总和相等,则为平局。

但即使在这种情况下,由于所掷骰子的不同,某一方也可能比对手更有优势。因此,Alice 和 Bob 想通过观察他们即将掷出的骰子,来确定谁更有优势。

Alice 有 $M$ 枚公平的骰子,分别有 $A_1, A_2, \dots, A_M$ 个面。对于所有满足 $1 \le k \le M$ 和 $1 \le \ell \le A_k$ 的整数 $k$ 和 $\ell$,Alice 的第 $k$ 枚骰子以 $1/A_k$ 的概率显示数字 $\ell$。Alice 的得分是她 $M$ 枚骰子显示数字之和。同样,Bob 有 $N$ 枚公平的骰子,分别有 $B_1, B_2, \dots, B_N$ 个面。

给定这些骰子,Alice 获得严格大于 Bob 的分数的概率为 $\mathbb{P}_A$,Bob 获得严格大于 Alice 的分数的概率为 $\mathbb{P}_B$。请问哪个概率更大?

输入格式

输入包含三行,每行包含空格分隔的整数。第一行包含数字 $M$ 和 $N$。第二行包含数字 $A_1, A_2, \dots, A_M$。第三行包含数字 $B_1, B_2, \dots, B_N$。

输出格式

输出应包含一行,由一个大写单词组成:若 $\mathbb{P}_A > \mathbb{P}_B$ 则输出 ALICE,若 $\mathbb{P}_A = \mathbb{P}_B$ 则输出 TIED,若 $\mathbb{P}_A < \mathbb{P}_B$ 则输出 BOB

数据范围

  • $1 \le M \le 100\,000$
  • $1 \le N \le 100\,000$
  • $4 \le A_k \le 1\,000\,000\,000$(对于所有 $k \le M$)
  • $4 \le B_k \le 1\,000\,000\,000$(对于所有 $k \le N$)

样例

输入 1

8 1
4 4 4 4 4 4 4 4
6

输出 1

ALICE

说明 1

由于 Alice 有 8 枚骰子,她的得分总是 8 或以上;Bob 的得分总是 6 或以下。因此,Alice 击败 Bob 的概率 $\mathbb{P}_A = 100\%$,而他击败 Alice 的概率 $\mathbb{P}_B = 0\%$。因此,$\mathbb{P}_A > \mathbb{P}_B$。

输入 2

2 2
6 4
4 6

输出 2

TIED

说明 2

Alice 击败 Bob 的概率 $\mathbb{P}_A = 125/288$;Bob 击败她的概率 $\mathbb{P}_B = 125/288$。

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.