This is a creation in Article, where the information may have evolved or changed.
Let's go to play
Time limit:3000/1000ms (java/other) Memory limit:65535/32768k (Java/other)
Total submission (s): 773 Accepted Submission (s): 213
Font:times New Roman | Verdana | Georgia
Font size:←→
Problem Description
Mr.lin would a party and invite he friends to the party. He has n friends and each of them can come in a specific range of days of the year from AI to bi.
Mr.lin wants to arrange a day, he can invite more friends. But he has a strange request, the number of male friends should equal to the number of femal friends.
Input
Multiple sets of test data.
The first line of all input contains a single integer n (1<=n<=5000)
then follow n lines. Each line starts with a capital letter ' F ' for female and with a capital letter ' M ' for male. Then follow-integers AI and bi (1<=ai,bi<=366), providing that the i-th friend can come to the party from day AI To day bi inclusive.
Output
Print The maximum number of people.
Sample Input
4M 151 307F 343 352F 117 145M 1286M 140 130F 131F 131 140F 131 141M 131 200M 200
Sample Output
24
See this question has been thinking how to use greed .... See other people's work after only suddenly dawned, simulate a bit on the line.