#abc261b. B - Tournament Result
B - Tournament Result
Score : points
问题描述
名选手进行了一场循环赛。
给定一个 × 的表格 ,其中记录了比赛结果。令 表示 中第 行第 列的元素。
若 ,则 为 -
;否则, 可以为 W
、L
或 D
。
若 为 W
,表示选手 击败了选手 ;若为 L
,表示选手 输给了选手 ;若为 D
,表示选手 与选手 战平。
判断给定的表格是否存在矛盾。
当满足以下任一条件时,该表格被认为存在矛盾:
- 存在一对 ,使得选手 击败了选手 ,但选手 并未输给选手 ;
- 存在一对 ,使得选手 输给了选手 ,但选手 并未击败选手 ;
- 存在一对 ,使得选手 与选手 战平,但选手 并未与选手 战平。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
players played a round-robin tournament.
You are given an -by- table containing the results of the matches. Let denote the element at the -th row and -th column of .
is -
if , and W
, L
, or D
otherwise.
is W
if Player beat Player , L
if Player lost to Player , and D
if Player drew with Player .
Determine whether the given table is contradictory.
The table is said to be contradictory when some of the following holds:
- There is a pair such that Player beat Player , but Player did not lose to Player ;
- There is a pair such that Player lost to Player , but Player did not beat Player ;
- There is a pair such that Player drew with Player , but Player did not draw with Player .
Constraints
- is
-
. - is
W
,L
, orD
, for .
Input
Input is given from Standard Input in the following format:
Output
If the given table is not contradictory, print correct
; if it is contradictory, print incorrect
.
Sample Input 1
4
-WWW
L-DD
LD-W
LDW-
Sample Output 1
incorrect
Player beat Player , while Player also beat Player , which is contradictory.
Sample Input 2
2
-D
D-
Sample Output 2
correct
There is no contradiction.
update @ 2024/3/10 11:03:25