#P1993. 小 K 的农场
小 K 的农场
Description
Xiao K has built many farms in MC (Minecraft), a total of , to the point that he has forgotten the exact amount of crops planted in each farm. He only remembers some vague information (a total of pieces), described in the following three forms:
- Farm has planted at least more units of crops than farm .
- Farm has planted at most more units of crops than farm .
- Farm and farm have planted the same number of crops.
However, because Xiao K’s memory may be inaccurate, he wants to know whether there exists a configuration such that the number of crops in the farms is consistent with all the pieces of information he remembers.
Input Format
The first line contains two integers and , representing the number of farms and the number of pieces of information remembered by Xiao K.
The next lines:
- If the first number of a line is , then three integers follow, meaning farm has planted at least more units of crops than farm .
- If the first number of a line is , then three integers follow, meaning farm has planted at most more units of crops than farm .
- If the first number of a line is , then two integers follow, meaning farm has planted the same number of crops as farm .
Output Format
If there exists a configuration consistent with Xiao K’s memory, output Yes, otherwise output No.
3 3
3 1 2
1 1 3 1
2 2 3 2
Yes
Hint
For of the testdata, it is guaranteed that .
Translated by ChatGPT 5
京公网安备 11011102002149号