luogu#P7923. 「EVOI-RD2」昕昕的不等式组
「EVOI-RD2」昕昕的不等式组
Problem Description
Xinxin worked on a math problem about solving a system of linear inequalities in one variable.
This system contains linear inequalities in one variable. She has found the solution set of each inequality, and she now needs to merge them into the solution set of the whole system.
Each inequality's solution set has been simplified to the simplest form, such as (or , etc.), where is a constant term and is the unknown. The unknown is a lowercase English letter and appears on the left side of the inequality sign; the constant term is an integer and appears on the right side.
All inequality signs used are only one of the four types: . In this problem's input and output, and are written as <= and >=, respectively.
Now you need to find the solution set of this system of inequalities.
Input Format
The first line contains a positive integer and a lowercase English letter , representing that there are simplified inequality solution sets, and the unknown variable in the system is .
The next lines each contain a simplified linear inequality in one variable, i.e., the solution set of that inequality.
For each solution set, it consists of the unknown, an inequality sign, and the constant term in order, where the unknown is the given in the first line.
Output Format
Output one line: the solution set of the system of inequalities, in a form like "" or "", etc. Here are or <=, and can be <, <=, >, >=, or . Note that there must be no extra spaces.
If the system has no solution, output No Answer!.
2 x
x>-3
x<=1
-3<x<=1
3 y
y>=5
y>4
y>=-2
y>=5
4 q
q>=114514
q>-200810
q<-1022
q<=-23333
No Answer!
Hint
[Sample Explanation]
As shown in the figure, the common part of the solution sets of all inequalities on the number line is the solution set of the system, which is . Note that is replaced by <= in the output.

[Constraints and Notes]
This problem uses bundled testdata.
- Subtask 1 (5 pts): .
- Subtask 2 (25 pts): .
- Subtask 3 (10 pts): , .
- Subtask 4 (20 pts): , .
- Subtask 5 (10 pts): .
- Subtask 6 (20 pts): .
- Subtask 7 (10 pts): no special constraints.
For of the data, , . The unknown in each inequality is a lowercase English letter.
[Notes]
Below is some math knowledge related to this problem.
- Inequality: a relation using an inequality sign.
- Solution of an inequality: a value of the unknown that makes the inequality true.
- Solution set of an inequality: the set of all solutions of the inequality.
- Solution set of a system of inequalities: the common part (intersection) of the solution sets of all inequalities in the system.
- Solving a system of inequalities: the process of finding the solution set of the system.
Translated by ChatGPT 5