HDU let's go to play

Source: Internet
Author: User
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

2

4

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.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.