Your school has decided to organize a research trip for a class of
Input Format | Description |
---|---|
FRIENDS a b |
Students |
ENEMIES a b |
Students |
PARTNERS a b |
Students |
GROUP a b |
Students |
In addition, there are
Constraints
For this problem, you will NOT be required to pass all the samples in order to receive points. In addition, all subtasks are disjoint, and you are NOT required to pass previous subtasks to earn points for a specific subtask.
Subtask | Points | Additional Constraints | |
---|---|---|---|
None | |||
All rules will be PARTNERS rules | |||
All rules will be FRIENDS or PARTNERS rules | |||
None | |||
None |
For all subtasks:
Input Specification
The first line contains 3 integers,
The next
The next
Output Specification
This problem is graded with an identical
checker. This includes whitespace characters. Ensure that every line of output is terminated with a \n
character and that there are no trailing spaces.
Output YES
if all the rules are followed and the school trip happens and NO
otherwise.
If and only if the answer is YES
, on the next line, print a string of 0
s, 1
s, and ?
s. If the 1
. If the 0
. Otherwise, if it cannot be determined whether the ?
.
If (and only if) the answer is NO
, then do not print anything else.
Sample Input 1
3 3 1
1
GROUP 1 2
GROUP 1 3
ENEMIES 2 3
Sample Output 1
YES
1??
Sample Explanation 1
Student
Sample Input 2
4 3 0
PARTNERS 1 2
PARTNERS 1 3
PARTNERS 4 2
Sample Output 2
YES
????
Sample Explanation 2
Either students
Sample Input 3
3 3 0
PARTNERS 1 2
PARTNERS 1 3
PARTNERS 3 2
Sample Output 3
NO
Sample Input 4
4 6 1
4
PARTNERS 1 3
PARTNERS 3 4
PARTNERS 4 2
PARTNERS 2 1
FRIENDS 2 3
FRIENDS 4 1
Sample Output 4
YES
1001
Sample Explanation 4
For all students, it can be determined for sure whether they will attend the trip or not.
Comments