luogu#P3845. [TJOI2007] 球赛
[TJOI2007] 球赛
Background
Description
Super fan H watches football on TV every Saturday night and never misses a match.
But last weekend, H suddenly had an important date, so he taught his three-year-old brother, little H, to write down the scores of all matches. When he came back, he found that little H not only recorded the final score of each match, but also some intermediate scores. Worse, little H did not distinguish between the two teams; the same match could be recorded as 1-2 or 2-1. Therefore, if the final score of a match was 5-3, little H might actually have written down the following scores:
1-0 3-2 2-3 3-4 5-3
Now H has all the scores recorded by little H. He wants to know the minimum number of matches he must have missed this weekend due to the date. Note that the recorded scores are in no particular order.
Output Format
For each testdata, output a single integer , the minimum number of matches that H must have missed.
2
4
1-0
2-0
0-3
2-1
4
5-0
1-3
2-2
0-0
2
3
Hint
In the first testdata, two matches may correspond to 1-0 2-0 0-3 and 2-1.
In the second testdata, three matches may correspond to 0-0, 5-0 3-1, and 2-2.
Constraints: For 100% of the testdata, , , and every score fits in longint(Pascal) / long(C++) ().
Translated by ChatGPT 5