#abc356c. C - Keys
C - Keys
Score : points
问题陈述
你有 把钥匙,编号为 。 其中一些是真正的钥匙,而其他的是假钥匙。
有一扇门,门 X,你可以插入任意数量的钥匙。门 X 只有在至少插入了 把真正的钥匙时才会打开。
你已经对这些钥匙进行了 次测试。第 次测试的步骤如下:
- 你插入了 把钥匙 到门 X。
- 测试结果由一个英文字母 表示。
-
o
表示在第 次测试中门 X 打开了。 -
x
表示在第 次测试中门 X 没有打开。
-
有 种可能的组合,哪些钥匙是真正的,哪些是假钥匙。在这些组合中,找出不与任何测试结果相矛盾的组合数量。 有可能给定的测试结果是错误的,没有任何组合满足条件。在这种情况下,报告 。
以上为大语言模型 kimi 翻译,仅供参考。
Problem Statement
You have keys numbered .
Some of these are real keys, while the others are dummies.
There is a door, Door X, into which you can insert any number of keys. Door X will open if and only if at least real keys are inserted.
You have conducted tests on these keys. The -th test went as follows:
- You inserted keys into Door X.
- The test result is represented by a single English letter .
-
o
means that Door X opened in the -th test. -
x
means that Door X did not open in the -th test.
-
There are possible combinations of which keys are real and which are dummies. Among these, find the number of combinations that do not contradict any of the test results.
It is possible that the given test results are incorrect and no combination satisfies the conditions. In such a case, report .
Constraints
- , , , , and are integers.
- if .
- is
o
orx
.
Input
The input is given from Standard Input in the following format:
Output
Print the answer as an integer.
Sample Input 1
3 2 2
3 1 2 3 o
2 2 3 x
Sample Output 1
2
In this input, there are three keys and two tests were conducted.
Two correct keys are required to open Door X.
- In the first test, keys were used, and Door X opened.
- In the second test, keys were used, and Door X did not open.
There are two combinations of which keys are real and which are dummies that do not contradict any of the test results:
- Key is real, key is a dummy, and key is real.
- Key is real, key is real, and key is a dummy.
Sample Input 2
4 5 3
3 1 2 3 o
3 2 3 4 o
3 3 4 1 o
3 4 1 2 o
4 1 2 3 4 x
Sample Output 2
0
As mentioned in the problem statement, the answer may be .
Sample Input 3
11 4 9
10 1 2 3 4 5 6 7 8 9 10 o
11 1 2 3 4 5 6 7 8 9 10 11 o
10 11 10 9 8 7 6 5 4 3 2 x
10 11 9 1 4 3 7 5 6 2 10 x
Sample Output 3
8