题目地址:http://codeforces.com/contest/738/problem/C
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,b) for(int i=a;i<=(int)(b);++i)
#define REPD(i,a,b) for(int i=a;i>=(int)(b);--i)
const int INF=0x3f3f3f3f,maxn=200000+5;
int dist[maxn],n,k,s,t;
struct Car
{int c,v;bool operator < (const Car& src) const {return v<src.v;}
}c[maxn];
bool Check(int v){int totm=0;REP(i,0,k) {if(dist[i]>v) return false; //忘记写了if(v>=dist[i]*2) totm+=dist[i];else totm+=3*dist[i]-v;if(totm>t) return false;}return true;
}
int main(int argc, char const *argv[])
{scanf("%d%d%d%d",&n,&k,&s,&t);REP(i,1,n) scanf("%d%d",&c[i].c,&c[i].v);REP(i,1,k) scanf("%d",&dist[i]); dist[k+1]=s; dist[0]=0;sort(dist,dist+2+k);sort(c+1,c+1+n);REP(i,0,k) dist[i]=dist[i+1]-dist[i];int L=1,R=n;while(L<R){int mid=(L+R)>>1;if(R!=mid&&Check(c[mid].v)) R=mid;else L=mid+1;}if(!Check(c[R].v)) {printf("-1\n");return 0;}int MinP=INF;REP(i,R,n) MinP=min(MinP,c[i].c);printf("%d\n", MinP);return 0;
}