ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1785. Lost in Localization

WA #20 ?
Posted by Tudor Siminic 16 Oct 2010 14:32
WA #20 ?
Re: WA #20 ?
Posted by Stav_team 16 Oct 2010 16:40
#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;
const float eps = 0.0001;
class circle{
    public : float x, y, r;
    circle(float _x = 0, float _y = 0, float _r = 0)
    { x = _x; y = _y; r = _r; }
};
class plate {
    public : circle a, b;
};
plate u, v;
circle t, g;
float A, B, C, h, R1, R2;
float dist(circle f1, circle f2) {
    return sqrt((f1.x - f2.x)*(f1.x - f2.x)+(f1.y - f2.y)*(f1.y - f2.y));
}
int main()
{
    cin >> A >> B >> C;
    cin >> u.a.r >> u.b.r;
    cin >> v.a.r >> v.b.r;
    R1 = u.b.r; R2 = v.b.r;
    cin >> h;
    if(h > C) u.b.r = (u.b.r + u.a.r) * C / h,
        v.b.r = (v.b.r + v.a.r) * C / h;
    t = circle(u.b.r, u.b.r, u.b.r);
    g = circle(A - v.b.r, B - v.b.r, v.b.r);
    if(t.x < 0 || t.y < 0 || g.x < 0 || g.y < 0) { cout << "NO"; return 0; }
    if(t.x > A || t.y > B || g.x > A || g.y > B) { cout << "NO"; return 0; }
    if(!(t.x - t.r > -eps && t.x + t.r - A < eps && t.y - t.r > -eps && t.y + t.r - B < eps))
        { cout << "NO"; return 0; }
    if(!(g.x - g.r > -eps && g.x + g.r - A < eps && g.y - g.r > -eps && g.y + g.r - B < eps))
        { cout << "NO"; return 0; }
    if(R1 + R2 > dist(t, g))cout << "NO";
    else cout << "YES";
     return 0;
}
Re: WA #20 ?
Posted by Nikolay 16 Oct 2010 16:58
ololo
Re: WA #20 ?
Posted by lql1993 17 Apr 2011 12:14
Such a complex program....