/// Raihan Ruhin /// CSE, Jahangirnagar University. /// Dhaka-Bangladesh. /// id: raihanruhin (topcoder / codeforces / codechef / uva / uvalive / spoj), 3235 (lightoj) /// mail: raihanruhin@ (yahoo / gmail / facebook) /// blog: ruhinraihan.blogspot.com #include<bits/stdc++.h> using namespace std; #define SET(a) memset(a,-1,sizeof(a)) #define CLR(a) memset(a,0,sizeof(a)) #define PI acos(-1.0) #define MOD 1000000007 #define MX 100000 int main() { ios_base::sync_with_stdio(0);cin.tie(0); int tc, kk=1, nx,ny; double w, x; vector<double> d; while(cin>>nx>>ny>>w && nx) { bool flag=true; d.clear(); d.push_back(-w/2.0); d.push_back(75.0 + w/2.0); for(int i=0;i<nx;i++) { cin>>x; d.push_back(x); } sort(d.begin(), d.end()); for(int i=0;i<=nx;i++) if((d[i+1]-d[i])>w) { //cout<<d[i+1]<< " "<<d[i]<<endl; flag=false; } d.clear(); d.push_back(-w/2.0); d.push_back(100.0 + w/2.0); for(int i=0;i<ny;i++) { cin>>x; d.push_back(x); } sort(d.begin(), d.end()); for(int i=0;i<=ny;i++) if((d[i+1]-d[i])>w) flag=false; if(flag) cout<<"YES\n"; else cout<<"NO\n"; } return 0; }
Sunday, 6 March 2016
Lawn mower (UVALive 4954, UVA 12269, Regionals 2010 >> Europe - Southwestern)
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment