| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 2 초 | 1024 MB | 4 | 3 | 3 | 75.000% |
In our capitalist-run, dog-eat-dog world money is everything, and big sports are no exception. All participating teams have already bought enough points for the next season, and all the local hockey federation has to do now is distribute the results of the upcoming games. However, some teams felt generous and apart from buying points also bought the results of some matches. Initially the federation officials thought it would only make their life easier: the more games are fixed, the less work. It was only later that they understood their wrong and asked us to be a part of their scheme and help them distribute the results of the games in the upcoming season.
The local hockey tournament follows a round scheme: $N$ teams participate, each team plays a game against each and every other team strictly once. Teams score points for games according to the following rules:
Based on the tournament results, a team's score is calculated as the sum of its points earned in all games played.
The first line of the input file contains an integer $N$ --- the number of tournament participants (2 $\leq$ $N$ $\leq$ 100). Teams are numbered from 1 to $N$.
The following $N$ lines of the file each contain $N$ symbols and are in essence a tournament table for the given moment of time.
The symbol $a_{ij}$ in the line $i$ and position $j$ denotes the result of a game scheduled to be played by team number $i$ against team number $j$ (1 $\leq$ $i$, $j$ $\leq$ $N$). It can be one of the following:
'W' --- means that the team $i$ will win a match against $j$ in the regulation time'w' --- the team $i$ will win in a match against $j$ in the overtime'l' --- the team $i$ will lose to the team $j$ in the overtime'L' --- the team $i$ will lose to the team $j$ in the regulation time'.' --- if the result of the game between $i$ and $j$ is not yet determined'#' --- if $i$ equals $j$, it means that there is no such game, i.e. a team cannot play against itself.It is guaranteed that the table is correct. More formally:
'#' for all $i$ = $j$'.', then $a_{ji}$ = '.''W' when and only when $a_{ji}$ = 'L''w' when and only when $a_{ji}$ = 'l'The last line of the input file contains $N$ integers $p_i$ --- the number of points the $i$-th team must score (1 $\leq$ $i$ $\leq$ $N$).
The output file must contain a completely filled tournament table in the same format as that in the input file.
It is guaranteed that a solution exists. If there are several solutions, print any of them.
4 #..W .#w. .l#. L..# 8 6 3 1
#wWW l#wW Ll#w LLl#