hiho week 223 register

Ended

Participants:148

Verdict:Wrong Answer
Score:10 / 100
Submitted:2018-10-11 22:18:29

Lang:G++

Edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include<iostream>
using namespace std;
int main()
{
    long long int n,x,y,num=1000005,a,b,s;
    cin>>n>>x>>y;
    while(n--)
    {
        cin>>a>>b;
        if((a>=x)&&(b<=y))
        {
            s=b-a+1;
            if(num>s)
                num=s;
        }
    }
    if(num!=1000005)
        cout<<num<<endl;
    else
        cout<<"-1"<<endl;
    return 0;
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX