AtCoder Beginner Contest 448
G
征服
Conquest
AtCoder
⌀ 3305
原题

征服AI (CI翻译)

Problem Statement

题目描述

AI (CI翻译)

Takahashi and Aoki play a card game. The game proceeds according to the following rules.

高桥和青木在玩一场卡牌游戏。游戏按照以下规则进行。AI (CI翻译)

  • Takahashi presents decks $A_1, A_2, \dots, A_N$. Here $N \geq 3$.
  • Aoki presents decks $B_1, B_2, B_3$.
  • Takahashi chooses one deck from Aoki's decks and bans it. Aoki also chooses one deck from Takahashi's decks and bans it. These two ban operations are performed simultaneously. (That is, neither player can act based on the other's choice.)
  • Then, Takahashi and Aoki each simultaneously declare which deck from their own presented decks they will use. However, the banned deck cannot be declared.
  • Then, the two players battle exactly once using their declared decks. As a result, one of them wins.
  • 高桥提出 $N$ 套牌 $A_1, A_2, \dots, A_N$。其中 $N \geq 3$。
  • 青木提出 3 套牌 $B_1, B_2, B_3$。
  • 高桥从青木提出的牌组中选择一套并将其禁用。青木也从高桥提出的牌组中选择一套并将其禁用。这两次禁用操作同时进行。(也就是说,双方都不能根据对方的选择来行动。)
  • 接着,高桥和青木各自同时宣布自己要使用所提出牌组中的哪一套。不过,被禁用的牌组不能被选择。
  • 随后,两人使用各自宣布的牌组进行一场对战。对战结果是其中一方获胜。
AI (CI翻译)

You are given integers $X_{i,j}$ $(1 \leq i \leq N, 1 \leq j \leq 3)$. Let $p_{i,j} = \dfrac{X_{i,j}}{10^6}$. $p_{i,j}$ is Takahashi's win rate when Takahashi uses deck $A_i$ and Aoki uses deck $B_j$. Both Takahashi and Aoki know the values of $p_{i,j}$ in advance. Find Takahashi's win rate when both players act to maximize their own win rate.

给定整数 $X_{i,j}$ $(1 \leq i \leq N, 1 \leq j \leq 3)$。令 $p_{i,j} = \dfrac{X_{i,j}}{10^6}$。当高桥使用牌组 $A_i$、青木使用牌组 $B_j$ 时,高桥的胜率为 $p_{i,j}$。高桥和青木都提前知道所有 $p_{i,j}$ 的值。 求双方都采取使自己胜率最大化的行动时,高桥的胜率。AI (CI翻译)

$T$ test cases are given; solve each of them.

给定 $T$ 组测试用例,请分别求解。AI (CI翻译)

What is Takahashi's win rate when both players act to maximize their own win rate? At each stage, each player assigns probabilities summing to $1$ to the available choices based on the information revealed up to that point, and randomly selects one choice according to those probabilities. Each player chooses a strategy that maximizes "the minimum possible win rate," that is, "the win rate when the opponent chooses a strategy that minimizes the player's win rate." If there are multiple strategies satisfying this condition, any of them may be chosen. When both players act according to this policy, Takahashi's win rate is uniquely determined regardless of the specific strategy chosen. Find this value.

双方都采取使自己胜率最大化的行动时,高桥的胜率是多少?在每个阶段,双方都会根据截至该阶段已知的信息,为所有可选行动分配总和为 $1$ 的概率,并按照这些概率随机选择行动。每名玩家都选择使“最坏情况下的胜率”最大的策略,也就是说,假设对手选择使该玩家胜率最小的策略,玩家要最大化此时的胜率。如果有多个满足条件的策略,可以任选其一。双方都遵循这一策略时,无论具体选择哪种满足条件的策略,高桥的胜率都唯一确定。求出该值。AI (CI翻译)

Constraints

约束条件

AI (CI翻译)
  • $1 \leq T \leq 500$
  • $3 \leq N \leq 5 \times 10^4$
  • $0 \leq X_{i,j} \leq 10^6$
  • The sum of $N$ over all test cases is at most $5 \times 10^4$.
  • All input values are integers.
  • $1 \leq T \leq 500$
  • $3 \leq N \leq 5 \times 10^4$
  • $0 \leq X_{i,j} \leq 10^6$
  • 所有测试用例中 $N$ 的总和不超过 $5 \times 10^4$。
  • 所有输入值均为整数。
AI (CI翻译)

Input

输入格式

AI (CI翻译)

The input is given from Standard Input in the following format, where $\mathrm{case}_i$ denotes the $i$-th test case.

输入从标准输入给出,格式如下,其中 $\mathrm{case}_i$ 表示第 $i$ 组测试用例。AI (CI翻译)

T
\mathrm{case}_1
\mathrm{case}_2
\vdots
\mathrm{case}_T

T
\mathrm{case}_1
\mathrm{case}_2
\vdots
\mathrm{case}_T
AI (CI翻译)

For each test case, the input is given in the following format.

每组测试用例的输入格式如下。AI (CI翻译)

N
X_{1,1} X_{1,2} X_{1,3}
X_{2,1} X_{2,2} X_{2,3}
\vdots
X_{N,1} X_{N,2} X_{N,3}

N
X_{1,1} X_{1,2} X_{1,3}
X_{2,1} X_{2,2} X_{2,3}
\vdots
X_{N,1} X_{N,2} X_{N,3}
AI (CI翻译)

Output

输出格式

AI (CI翻译)

Output $T$ lines. The $i$-th line should contain the answer to the $i$-th test case. For each test case, output Takahashi's win rate when both players act to maximize their own win rate. The output is considered correct if the absolute or relative error from the true value is at most $10^{-6}$.

输出 $T$ 行。第 $i$ 行应包含第 $i$ 组测试用例的答案。 对于每组测试用例,输出双方都采取使自己胜率最大化的行动时高桥的胜率。若答案与正确值的绝对误差或相对误差不超过 $10^{-6}$,则输出被视为正确。AI (CI翻译)

样例

Input #1
1
3
600000 500000 100000
400000 700000 300000
800000 200000 900000
Output #1
0.5272727272727272
Takahashi's win rate when both players act to maximize their own win rate is $0.5272727 \cdots$.
Input #2
3
6
402522 269943 705465
529104 292257 262398
598965 708517 393767
10680 760196 459175
163269 555933 100458
252724 762224 143581
4
720086 398924 165990
446155 678065 592893
674921 176800 484411
222632 81476 633357
5
212176 543920 484352
23874 760886 95861
291354 504948 790821
523486 327166 289413
621589 178581 628701
Output #2
0.5136657634439492
0.5120053615937050
0.5396248345565982
Input #3
6
3
600000 300000 100000
0 400000 600000
700000 400000 100000
3
700000 700000 200000
0 0 900000
500000 600000 900000
5
1000000 658525 1000000
867635 1000000 259903
727305 342912 1000000
995128 432824 1000000
69492 105991 1000000
6
900000 700000 300000
600000 300000 500000
900000 100000 900000
900000 1000000 0
800000 200000 900000
700000 800000 900000
7
300000 900000 800000
600000 1000000 700000
700000 200000 1000000
1000000 200000 200000
200000 400000 1000000
500000 800000 900000
900000 500000 800000
5
500000 500000 41274
270488 520436 605863
247128 522516 149943
502751 491747 516407
503752 488744 31814
Output #3
0.3520000000000000
0.5571428571428572
0.9951279999999999
0.8478260869565216
0.8336956521739129
0.4988562153245037
题目信息
题号
abc448_g
时间限制
2 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(gpt-6.1-sol),如有出入请以原文为准。