#P13277. 「CZOI-R4」改编
「CZOI-R4」改编
Description
Little W enjoys adapting problems.
There are two types of adaptations: problem statement adaptation and solution approach adaptation.
There are candidate problems, each with an initial quality and two attributes and . If , it means the problem is a problem statement adaptation; if , it means the problem is a solution approach adaptation.
When reviewing a problem:
- If it is a problem statement adaptation, its perceived quality decreases by
- If it is a solution approach adaptation, its perceived quality decreases by
- If it is both adaptations, it is discarded
- If the perceived quality becomes negative, it is discarded

Find the maximum perceived quality among remaining problems. If all are discarded, output -1.
Input Format
First line: three integers , ,
Next lines: three integers each (, , )
Output Format
Single integer: the maximum perceived quality, or -1 if all discarded
4 1 2
6 0 0
7 0 0
6 1 1
9 1 0
8
Hint
Sample Breakdown:
- Problem 1: (no adaptations)
- Problem 2: (no adaptations)
- Problem 3: discarded (both adaptations)
- Problem 4: (statement adaptation)
Maximum quality among remaining:
Data Range
For all data , ,,No bundled testing.
京公网安备 11011102002149号