No.753 Ultimate Champion Tournament
タグ : / 解いたユーザー数 53
作問者 :
horiesiniti
/ テスター :
はむこ
Problem Statement
16 fighters compete in a one-on-one tournament.
The fighters are assigned numbers from 1 to 16.
Fighters have matchups, and a table gives which fighter wins when any two fighters face each other.
The tournament is a complete binary tree.
A simulation is to be run in order to measure each fighter's win rate.
When every possible first-round arrangement is tried, running each one through to the end of the final, output the number of times each fighter wins the tournament, one per line, for fighters 1 to 16.
Arrangements are considered different if their order in the first round differs, even if the matchups are the same.
That is, a total of 16! first-round arrangements are considered.
Input
$a_{(1,1)}$ $\dots$ $a_{(1,16)}$
$\dots$
$a_{(j,1)}$ $\dots$ $a_{(j,16)}$
$\dots$
$a_{(16,1)}$ $\dots$ $a_{(16,16)}$
To see which fighter wins when fighter number i and fighter number j fight, look at row j, column i of the table: if it is 1, j wins, and if it is -1, i wins. The lower-left half of the table is filled with 0 as dummy data to make the input easier to read. That is, only the part of the table with j < i is meaningful. Find ansi, the number of times fighter number i wins the tournament when all first-round arrangements are tried.
Output
$ans_1$
$\dots$
$ans_i$
$\dots$
$ans_{16}$
Print a newline at the end.
Sample
Sample 1
Input
0 1 -1 -1 -1 1 -1 -1 1 1 -1 1 1 1 1 1 0 0 1 1 -1 1 1 -1 1 1 -1 -1 -1 1 1 1 0 0 0 1 -1 -1 -1 -1 -1 -1 -1 1 1 1 1 -1 0 0 0 0 -1 1 -1 1 -1 1 1 1 -1 1 -1 -1 0 0 0 0 0 1 -1 1 -1 -1 1 -1 -1 1 -1 -1 0 0 0 0 0 0 1 -1 1 -1 1 1 1 1 -1 1 0 0 0 0 0 0 0 1 1 1 1 1 1 1 -1 1 0 0 0 0 0 0 0 0 1 -1 -1 1 1 -1 1 -1 0 0 0 0 0 0 0 0 0 1 1 -1 -1 1 1 -1 0 0 0 0 0 0 0 0 0 0 1 -1 1 1 -1 1 0 0 0 0 0 0 0 0 0 0 0 1 1 -1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 -1 1 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 -1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Output
1613069320192 2902313238528 119390961664 507047542784 1339820638208 1069828669440 7688706785280 1315405791232 367798026240 590398128128 1159765950464 311637147648 146366988288 7884701696 1659518025728 123837972480
When all first-round arrangements are tried, fighter number 1 wins the tournament 1613069320192 times. The total number of wins over all fighters is 16!.
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。