eolymp
bolt
Try our new interface for solving problems
Problems

Tourist

published at 1/24/24, 4:42:19 pm

include <iostream>

using namespace std; int main() { int k,w,x1,x2,y1,y2,z1,z2; cin>>k>>w>>x1>>x2>>y1>>y2>>z1>>z2; if((x1+y1+z1<=w)&&(x2+y2+z2<=k)){ cout<<"YES"; } else if((x1+y1<=w)&&(x2+y2>=k)){ cout<<"YES"; } else if((x1+z1<=w)&&(x2+z2>=k)){ cout<<"YES"; //123 } else if((y1+z1<=w)&&(y2+z2>=k)){ cout<<"YES"; } else if((y1<=w)&&(y2>=k)){ cout<<"YES"; } else if((x1<=w)&&(x2>=k)){ cout<<"YES"; } else if((z1<=w)&&(z2>=k)){ cout<<"YES"; } else{ cout<<"NO"; }

}