1406. Left 4 Dead 2

Elitedj and his three roommates like to play Left 4 Dead 2. Left 4 Dead 2 is a shooting game withfour special monsters.

  • Tank, it’s huge body with thick arms, HP is 98000
  • Boomer, fat as a ball, it will spray bile when killed, HP is 9800
  • Witch, likes crying alone, HP is 980
  • Smoker, attacks humans with extremely long tongues, HP is 98

There is a contest of Left 4 Dead 2 in this weekend. There are n teams in the competition, every two teams will play a match, each team will have 4 numbers indicating the team’s performance, whichare the number of four monsters killed by the player.The ranking of the game is as follows

  • Sort by the number of wins from the most to the least. The definition of wins is that the total HP of monsters killed is strictly greater than the opponent.
  • If the number of wins is the same, sort byhurt difference from largest to smallest. The definition of hurt difference is that the sum of hp of monsters killed by the team minus the sum of hp of monsters killed by the opponent.
  • If multiple teams have the most wins and the largest hurt difference, print ”No winner”, else print the index of the winning team.

输入

The first line contains a single integer T \ (1≤T≤10) — the number of test cases.

For each case, the first line contains a single integer n \ (1≤n≤100) — the number of teams.

Next is an n \times n matrix a, the row number and column number of the matrix start from 1, therow number from top to bottom, and the column number from left to right. Each item of the matrix consists of 4 integers — t, b, w, s \ (0≤t, b, w, s≤10^5), which are separated by spaces. The a[i][j][t], a[i][j][b], a[i][j][w], a[i][j][s] represents the number of Tank, Boomer, Witch and Smoker killed by team i in the match between team i and team j. Items in the same row of the matrix are separated by character ’|’.

输出

The output contains T rows, and the output of the i−th row represents the result of case i . If multiple teams have the most wins and the largest hurt difference, print ”No winner” (without the quotes), else print the index of the winning team

样例

标准输入 复制文本
2
2
0 0 0 0 | 1 2 3 4
2 1 4 3 | 0 0 0 0
2
0 0 0 0 | 1 1 1 1
1 1 1 1 | 0 0 0 0
标准输出 复制文本
2
No winner

提示

For the first case, there are two teams, the sum of HP of the monsters killed by the first team is 1 \times 98000 + 2 \times 9800 + 3 \times 980 + 4 \times 98 = 120932, the sum of HP of the monster killed by the second team is 2 \times 98000 + 1 \times 9800 + 4 \times 980 + 3 \times 98 = 210014, so the number of wins for the first team is 0, for the second team is 1, so the second team is the winner, print 2 .

For the second case, there are two teams, the sum of HP of the monsters killed by the first team andby the second team is the same, so the number of wins for these two team is 0. The hurt differencefor the first team is (1 \times 98000 + 1 \times 9800 + 1 \times 980 + 1 \times 98)−(1 \times 98000 + 1 \times 9800 + 1 \times 980 + 1 \times 98) = 0 ,the hurt difference for the second team is also 0, so print ”No winner” (without the quotes) in this case.

来源

SCNUCPC 2020 现场赛

登录以提交代码。
单点时限 1 秒
内存限制 256 MB
提交 84
通过 10