#P2474. [SCOI2008] 天平
[SCOI2008] 天平
Description
You have weights, each of which is gram, grams, or grams. You do not know the exact mass of each weight, but you know some pairwise weight comparisons. You place two weights and on the left pan of a balance scale, and you need to choose two other weights to place on the right pan. How many unordered choices are there that make the left pan heavier (), balance (), or the right pan heavier ()? (Only count choices for which the outcome is uniquely determined.) The choice is unordered; that is, choosing weights and is the same as choosing and .
Input Format
The first line contains three positive integers ().
The following lines contain the weight relation matrix. In row , the -th character is a plus + if weight is heavier than weight , a minus - if weight is lighter than weight , an equals = if weight and weight are equal, and a question mark ? if their relation is unknown.
It is guaranteed that there exists at least one configuration consistent with this matrix.
Output Format
Output a single line containing three integers: .
6 2 5
?+????
-?+???
?-????
????+?
???-?+
????-?
1 4 1
14 8 4
?+???++?????++
-??=?=???????=
??????????=???
?=??+?==??????
???-???-???-??
-=????????????
-??=???=?-+???
???=+?=???????
??????????????
??????+???????
??=???-????-??
????+?????+???
-?????????????
-=????????????
18 12 11
Hint
Constraints: .
Translated by ChatGPT 5
京公网安备 11011102002149号