Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cstdio>
- #include <cmath>
- #include <algorithm>
- using namespace std;
- inline bool befer( long long a, long long b, long long c, long long d ) {
- if( (c < a) && (d < b) ) return true;
- if( a <= c ) return false;
- long long atlo = c*c + d*d;
- if( atlo >= a*a+b*b ) return false;
- double x = ( b - sqrt(atlo - a*a) );
- double y = ( a - sqrt(atlo - b*b) );
- if( 4.0*c*c > x*x + y*y ) return false;
- return true;
- }
- int main() {
- int t;
- long long a, b, c, d;
- scanf("%d", &t);
- while( t-- ) {
- scanf("%lld %lld %lld %lld", &a, &b, &c, &d);
- if( b < a ) { std::swap(a,b); }
- if( d < c ) { std::swap(c,d); }
- if( befer(a, b, c, d) ) printf("Escape is possible.\n");
- else printf("Box cannot be dropped.\n");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment