# Soj 3316: Windy's dates

Source: Internet
Author: User

Description:

Http://cs.scu.edu.cn/soj/problem.action? Id = 3316

# Include <iostream>
# Include <algorithm>
Using namespace STD;

Struct Node
{
Int start, end;
Bool visit;
} Fans [100 + 10], import [100 + 10];

Bool CMP (node A, Node B)
{
If (A. End! = B. End)
Return A. End <B. end;
Else
Return A. Start <B. Start;
}

Int main ()
{
Int n, m, I, J;
While (scanf ("% d", & N, & M) = 2)
{

For (I = 0; I <m; ++ I)
{
Scanf ("% d", & import [I]. Start, & import [I]. End );
}

For (I = 0; I <n; ++ I)
{
Scanf ("% d", & fans [I]. Start, & fans [I]. End );
Fans [I]. Visit = false;
For (j = 0; j <m; ++ J)
{
If (! (Fans [I]. End <= import [J]. Start | fans [I]. Start> = import [J]. End ))
{
Fans [I]. Visit = true;
Break;
}
}
}
Sort (fans, fans + N, CMP );

Int temp =-1;
Int CNT = 0;
For (I = 0; I <n; ++ I)
{
If (! Fans [I]. Visit & fans [I]. Start> = temp)
{
Temp = fans [I]. end;
CNT ++;
}
}
Printf ("% d \ n", CNT );
}
// System ("pause ");
Return 0;
}

Related Keywords:

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.