Can you help me what is wrong in this code . I’m getting only one subtask as WA
Here is question link CodeChef: Practical coding for everyone
#include <iostream>
using namespace std;
#define ll long long int
#include<vector>
#include<algorithm>
int main() {
ll n,x,y;
cin>>n>>x>>y;
vector<pair<ll,ll>> v;
for(ll i=0;i<n;i++)
{
ll a,b;
cin>>a>>b;
v.push_back({a,b});
}
ll t=1e9;
sort(v.begin(),v.end());
ll vv[x],w[y];
for(ll i=0;i<x;i++)
cin>>vv[i];
sort(vv,vv+x);
for(ll i=0;i<y;i++)
cin>>w[i];
sort(w,w+y);
for(ll i=0;i<n;i++)
{
ll lb = upper_bound(vv,vv+x,v[i].first)-vv;
if(vv[lb]!=v[i].first && lb>0)
lb--;
ll ub = lower_bound(w,w+y,v[i].second)-w;
if(ub==y)
continue;
t=min(t,w[ub]-vv[lb]+1);
// cout<<lb<<" "<<ub<<endl;
}
cout<<t<<endl;
return 0;
}