CF1264A Beautiful Regional Contest

题目描述

### 题意简述 一场有 $n$ 名选手参加的比赛结束了。第 $i$ 位的参赛者解决了 $p_i$ 个问题。组委会已经将 $p_i$ 降序排序,也就是说,$p_1 \geq p_2 \geq ··· \geq p_n$。 您需要给选手颁发奖牌 —— $g$ 枚金牌、$s$ 枚银牌和$b$ 枚铜牌,但要满足如下条件: - 三种奖牌必须至少颁发一枚。也就是说,$g>0,s>0,b>0$。 - 金牌的数量必须严格小于银牌和铜牌的数量,也就是说 $g

输入格式

第一行一个正整数 $t(1\leq 1000)$,表示数据组数。 对于每组数据,第一行一个正整数 $n(1\leq n \leq 4·10^5)$。 接下来一行 $n$ 个非负整数 $p_1,p_2,···,p_n(0\leq p_i \leq 10^6)$。 保证 $n$ 之和不超过 $4·10^5$。

输出格式

如果无解,请输出 `0 0 0`。 否则请输出三个正整数 $g,s,b$。您应当在**满足合法**的情况下最大化 $g,s,b$ 之**和**。 翻译贡献者 U108949

说明/提示

In the first test case, it is possible to reward $ 1 $ gold, $ 2 $ silver and $ 3 $ bronze medals. In this case, the participant solved $ 5 $ tasks will be rewarded with the gold medal, participants solved $ 4 $ tasks will be rewarded with silver medals, participants solved $ 2 $ or $ 3 $ tasks will be rewarded with bronze medals. Participants solved exactly $ 1 $ task won't be rewarded. It's easy to see, that in this case, all conditions are satisfied and it is possible to reward participants in this way. It is impossible to give more than $ 6 $ medals because the number of medals should not exceed half of the number of participants. The answer $ 1 $ , $ 3 $ , $ 2 $ is also correct in this test case. In the second and third test cases, it is impossible to reward medals, because at least one medal of each type should be given, but the number of medals should not exceed half of the number of participants.