Problem:
Problem F: Strawberry Cake
会津大学附属小学校 (会津大小) に入学したシャ、ネロ、エリ、コーは競技プログラマとして活躍するために IPPC というプログラミングコンテストに出場することにした。しかし IPPC は 3 人 1 組でチームとしてコンテストに出場する決まりで、4 人でチームを組むことはできない。そこで彼らは 2 人ずつに分かれてチームを組み、2 人 1 組で参加できる IPOCH というプログラミングコンテストに出場することにした。
チームは分かれてしまったが、実力は拮抗しており互いに良い練習相手になっている。
ある日彼らのコーチが差し入れにホールケーキを買ってきた。彼らはそれをシャの家で食べることにした。しかし家に着いて箱を開けてみるとケーキが変形していて、形は上から見ると円形ではなく凸多角形のようになっていた。ネロに運ばせたのが悪かったようだ。
ケーキの上にはイチゴが 1 つ乗っている。とりあえず 2 チームで分けるために、いまこのケーキをイチゴを通る直線にそって半分になるようにナイフで切ることが決定した。ケーキを切る前にイチゴを先にとってしまうのは彼らの美意識に反する。
あなたの仕事は 2 次元平面上に与えられる凸多角形 K を原点 (0, 0) を通る直線 L で分割したとき、分割で出来た 2 つの凸多角形の面積が等しくなるように直線 L を定めることである。もし複数あるならいずれかひとつで構わない。
Input
入力は複数のテストケースからなる。各テストケースは以下の形式に従う。
N
x
1
y
1
x
2
y
2
...
x
N
y
N
N は与えられる凸多角形 K の頂点数である。点 (x
i
, y
i
) ( 1 ≤ i ≤ N ) はすべて凸多角形 K を成す頂点の座標であり、互いに異なる。これらは反時計回りの順で与えられる。また、凸多角形 K のどの辺上の点も原点との距離が 1 以上で、凸多角形 K は常に原点を内包する。入力の終了はひとつの0を含む１行で示される。原点を含む、入力で与えられる異なる 3 点は共線となりうることに注意して欲しい。
Constraints
入力はすべて整数
3 ≤ N ≤ 20
-100 ≤ x
i
≤ 100 ( 1 ≤ i ≤ N )
-100 ≤ y
i
≤ 100 ( 1 ≤ i ≤ N )
テストケースの数は 1,000 を超えない。
Output
以下の形式で直線 L 上の点 A (A
x
, A
y
) を出力せよ。ただし点 A と原点との距離は 1 以上でなければならない。
A
x
A
y
原点とこの点 A を通る直線で凸多角形 K を分割したとき 2 つの凸多角形の面積の差が 10
-5
未満でなければならない。点 A の座標は小数点以下 15 桁出力して欲しい。
Sample Input
4
-100 -100
100 -100
100 100
-100 100
4
-99 -100
100 -100
100 100
-99 100
4
-100 -99
100 -99
100 100
-100 100
14
-99 -70
-92 -79
10 -98
37 -100
62 -95
77 -69
88 -47
92 -10
96 28
100 91
42 92
-62 92
-88 91
-98 64
0
Sample Output
100.000000000000000 0.000000000000000
100.000000000000000 0.000000000000000
0.000000000000000 100.000000000000000
-96.983291994836122 66.745111613942484

Submitted solutions:

code_snippet: #pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
ll myRand(ll B) { return (ull)rng() % B; }

// https://onlinejudge.u-aizu.ac.jp/courses/library/4/CGL/all
////////////////////////////////////////////////////////////////////////////////
typedef double Real;
const Real eps = 1e-8; // 1000 : 10^-8, 10000 : 10^-7
inline int sgn(Real a, Real b = 0) { return (a - b < -eps) ? -1 : (a - b > eps) ? 1 : 0; }
inline Real _sqrt(Real a) { return sqrt(max(a, (Real)0)); }
struct Point {
    Real x, y;
    Point() {}
    Point(Real x, Real y) : x(x), y(y) {}
    Point &operator-=(const Point &p) {
        x -= p.x;
        y -= p.y;
        return *this;
    }
    Point &operator+=(const Point &p) {
        x += p.x;
        y += p.y;
        return *this;
    }
    Point &operator*=(Real d) {
        x *= d;
        y *= d;
        return *this;
    }
    Point &operator/=(Real d) {
        x /= d;
        y /= d;
        return *this;
    }
    Point operator+(const Point &p) const {
        Point res(*this);
        return res += p;
    }
    Point operator-(const Point &p) const {
        Point res(*this);
        return res -= p;
    }
    Point operator*(Real d) const {
        Point res(*this);
        return res *= d;
    }
    Point operator/(Real d) const {
        Point res(*this);
        return res /= d;
    }
    bool operator<(const Point &p) const { return (sgn(x, p.x) < 0 or (sgn(x, p.x) == 0 and sgn(y, p.y) < 0)); }
    bool operator==(const Point &p) const { return (sgn(x - p.x) == 0 and sgn(y - p.y) == 0); }
    friend istream &operator>>(istream &is, Point &p) {
        is >> p.x >> p.y;
        return (is);
    }
    Real norm() { return _sqrt(x * x + y * y); }
    Real norm2() { return (x * x + y * y); }
    Point vec() { return (*this); }
    Point unit() { return (*this) / this->norm(); } // 単位ベクトル
    Point rotate(Real theta) { return {x * cos(theta) - y * sin(theta), x * sin(theta) + y * cos(theta)}; }
    Point perpendicular() { return {-y, x}; }
    Point normal() { return perpendicular().unit(); } // 法線ベクトル
};

Point vec(Point a, Point b) { return (b - a); }
Real dist(Point a, Point b) { return vec(a, b).norm(); }
Real dot(Point a, Point b) { return a.x * b.x + a.y * b.y; }
Real cross(Point a, Point b) { return a.x * b.y - a.y * b.x; }

// 線分
struct Segment : array<Point, 2> {
    Segment() {}
    Segment(Point a, Point b) { at(0) = a, at(1) = b; }
    Point vec() { return (at(1) - at(0)); }
    Real length() { return vec().norm(); }
    friend istream &operator>>(istream &is, Segment &s) {
        is >> s[0] >> s[1];
        return (is);
    }
};
// 直線
struct Line : Segment {
    Line() {}
    Line(Point a, Point b) : Segment(a, b) {}
    Line(Segment s) : Line(s[0], s[1]) {}
};

int ccw(Point a, Point b, Point c) {
    b -= a;
    c -= a;
    if (sgn(cross(b, c)) == 1) return 1;          // a,b,c 反時計回り
    if (sgn(cross(b, c)) == -1) return -1;        // a,b,c 時計周り
    if (sgn(dot(b, c)) == -1) return 2;           // c,a,b 一直線上
    if (sgn(c.norm() - b.norm()) == 1) return -2; // a,b,c 一直線上
    return 0;                                     // a,c,b 一直線上
}

// 垂直判定
template <typename T> bool is_orthogonal(T s, T t) { return sgn(dot(s.vec(), t.vec())) == 0; }
// 並行判定
template <typename T> bool is_parallel(T s, T t) { return sgn(cross(s.vec(), t.vec())) == 0; }
// 同一直線判定
template <typename T> bool is_same_line(T s, T t) { return abs(ccw(s[0], s[1], t[0])) != 1 and abs(ccw(s[0], s[1], t[1])) != 1; }
// 線分上の点判定
bool is_on_segment(Point p, Segment l) { return ccw(l[0], l[1], p) == 0; }
// 線分の交差判定(AOJ-2172)
bool is_intersect(Segment s, Segment t) {
    return ccw(s[0], s[1], t[0]) * ccw(s[0], s[1], t[1]) <= 0 and ccw(t[0], t[1], s[0]) * ccw(t[0], t[1], s[1]) <= 0;
}
// 2直線の交点(AOJ-2596)
pair<bool, Point> line_intersection(Line s, Line t) {
    if (is_same_line(s, t)) return {true, s[0]};
    else if (is_parallel(s, t)) return {false, Point()};
    else return {true, s[0] + s.vec() * cross(t[0] - s[0], t.vec()) / cross(s.vec(), t.vec())};
}
// 2線分の交点
pair<bool, Point> segment_intersection(Segment s, Segment t) {
    if (is_same_line(s, t)) {
        if (is_on_segment(s[0], t)) return {true, s[0]};
        else if (is_on_segment(s[1], t)) return {true, s[1]};
        else if (is_on_segment(t[0], s)) return {true, t[0]};
        else return {false, Point()};
    }
    if (!is_intersect(s, t)) return {false, Point()};
    else return line_intersection(Line(s), Line(t));
}
// 点と直線の距離
Real point_line_distance(Point p, Line l) { return abs(cross(p - l[0], l.vec())) / l.length(); }
// 点と線分の距離
Real point_segment_distance(Point p, Segment l) {
    if (sgn(dot(p - l[0], l.vec())) == -1) return dist(p, l[0]);
    else if (sgn(dot(p - l[1], l.vec())) == 1) return dist(p, l[1]);
    else return point_line_distance(p, l);
}
// 線分と線分の距離(AOJ-1157)
Real segment_segment_distance(Segment s, Segment t) {
    if (is_intersect(s, t)) return 0;
    double res = point_segment_distance(s[0], t);
    res = min(res, point_segment_distance(s[1], t));
    res = min(res, point_segment_distance(t[0], s));
    res = min(res, point_segment_distance(t[1], s));
    return res;
}

// 多角形ライブラリ
struct Polygon : public vector<Point> {
    Polygon() {}
    Polygon(int n) { this->resize(n); }
    Polygon(vector<Point> init) {
        this->resize(init.size());
        for (int i = 0; i < (int)init.size(); ++i) {
            (*this)[i] = init[i];
        }
    }
    Polygon(initializer_list<Point> init) : Polygon(vector<Point>(init.begin(), init.end())) {}
    void rev() {
        if (sgn(area()) == -1) reverse(this->begin(), this->end());
    }
    // 多角形の符号付き面積(反時計回りが正)
    Real area() {
        int n = this->size();
        Real s = 0;
        for (int i = 0; i < n; ++i) {
            s += cross((*this)[i], (*this)[(i + 1) % n]);
        }
        return s * 0.5;
    }
    // 多角形の凸性判定(反時計周りを仮定)
    bool is_convex() {
        int n = this->size();
        for (int i = 0; i < n; ++i) {
            if (ccw((*this)[i], (*this)[(i + 1) % n], (*this)[(i + 2) % n]) == -1) return false;
        }
        return true;
    }
    enum Type { OUT, ON, IN };
    // 点の包含判定 O(N) (凸性を仮定しない)
    int is_in_polygon(Point p) {
        int n = this->size();
        bool in = false;
        for (int i = 0; i < n; ++i) {
            Point a = (*this)[i], b = (*this)[(i + 1) % n];
            if (is_on_segment(p, Line(a, b))) {
                return Type::ON;
            }
            a -= p, b -= p;
            if (a.y > b.y) std::swap(a, b);
            if (sgn(a.y) <= 0 and 0 < sgn(b.y) and sgn(cross(a, b)) < 0) in ^= 1;
        }
        return in ? Type::IN : Type::OUT;
    }
    // 凸多角形の直径 {{直径を成す2点},直径}
    pair<pair<int, int>, Real> diameter() {
        assert(is_convex());
        int n = this->size();
        pair<int, int> arg_max = {-1, -1};
        Real max_dist = -1;
        for (int i = 0, j = 0; i < n; ++i) {
            Real cur_dist = dist((*this)[i], (*this)[j]);
            while (j + 1 < n) {
                Real nxt_dist = dist((*this)[i], (*this)[j + 1]);
                if (nxt_dist > cur_dist) j++, cur_dist = nxt_dist;
                else break;
            }
            if (max_dist < cur_dist) max_dist = cur_dist, arg_max = {i, j};
        }
        return {arg_max, max_dist};
    }
};

// 凸包 (線分上の点を含めるかどうか)
Polygon convex_hull(vector<Point> ps, bool ONSEG = false) {
    int n = (int)ps.size();
    if (n <= 2) return ps;
    sort(ps.begin(), ps.end());
    int k = 0;         // 凸包の頂点数
    Polygon qs(2 * n); // 構築中の凸包
    auto check = [&](int _ccw) { return ONSEG ? _ccw == -1 : _ccw <= 0; };
    for (int i = 0; i < n; qs[k++] = ps[i++]) {
        while (k >= 2 and check(ccw(qs[k - 2], qs[k - 1], ps[i])))
            k--;
    }
    for (int i = n - 2, t = k + 1; i >= 0; qs[k++] = ps[i--]) {
        while (k >= t and check(ccw(qs[k - 2], qs[k - 1], ps[i])))
            k--;
    }
    qs.resize(k - 1);
    return qs;
}
// 凸多角形を直線(l.a->l.b)で切断して左側に出来る多角形を求める
Polygon convex_cut(Polygon &ps, Line l) {
    assert(ps.is_convex());
    int n = ps.size();
    Polygon res;
    for (int i = 0; i < n; ++i) {
        Point cur = ps[i], nxt = ps[(i + 1) % n];
        if (ccw(l[0], l[1], cur) != -1) res.emplace_back(cur);
        if (ccw(l[0], l[1], cur) * ccw(l[0], l[1], nxt) < 0) {
            res.emplace_back(line_intersection(l, Line(cur, nxt)).second);
        }
    }
    return res;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    while (cin >> n, n) {
        Polygon g(n);
        for (int i = 0; i < n; ++i) {
            cin >> g[i];
        }
        Real S = g.area();
        Real L = 0, R = acos(-1.0);
        auto calc = [&](Real theta) -> Real {
            Line l(Point(0, 0), Point(cos(theta), sin(theta)));
            return S / 2.0 - convex_cut(g, l).area();
        };
        auto fl = calc(L);
        for (int i = 0; i < 100; ++i) {
            Real mid = (L + R) / 2;
            auto f = calc(mid);
            if (sgn(f * fl) >= 0) L = mid;
            else R = mid;
        }
        printf("%.15f %.15f\n", cos(L) * 2, sin(L) * 2);
    }
}
accuracy: 1
time_ms: 20
memory_kb: 3872
final_rank: 9

code_snippet: #include <bits/stdc++.h>
using namespace std;
#define rep(i, a) for (int i = 0; i < (a); i++)
#define pb push_back
#define EPS 1e-10
#define PI acos(-1.0)
const double INF = 1e9;
typedef complex<double> P;
typedef vector<P> G;

inline double cross(const P &a, const P &b) { return imag(conj(a) * b); }
inline double dot(const P &a, const P &b) { return real(conj(a) * b); }

struct L
{
    P a, b;
    L(const P &a, const P &b) : a(a), b(b) {}
};

int ccw(P a, P b, P c)
{
    b -= a;
    c -= a;
    if (cross(b, c) > 0)
        return +1; // +1 : 反時計回り
    if (cross(b, c) < 0)
        return -1; // -1 : 時計回り
    if (dot(b, c) < 0)
        return +2; // +2 : 線上(c--a--b)
    if (norm(b) < norm(c))
        return -2; // -2 : 線上(a--b--c)
    return 0;
}

P crosspointLL(const L &l, const L &m)
{
    double A = cross(l.b - l.a, m.b - m.a);
    double B = cross(l.b - l.a, l.b - m.a);
    if (abs(A) < EPS && abs(B) < EPS)
        return m.a; // 重なっている
    if (abs(A) < EPS)
        return P(INF, INF); // 交差しない
    return m.a + B / A * (m.b - m.a);
}

G convex_cut(const G &g, const L &l)
{
    G Q;
    rep(i, g.size())
    {
        P A = g[i], B = g[(i + 1) % g.size()];
        if (ccw(l.a, l.b, A) != -1)
            Q.push_back(A);
        if (ccw(l.a, l.b, A) * ccw(l.a, l.b, B) < 0)
            Q.push_back(crosspointLL(L(A, B), l));
    }
    return Q;
}

#define curr(g, i) g[i]
#define next(g, i) g[(i + 1) % g.size()]
double areaG(const G &g)
{
    double A = 0;
    for (int i = 0; i < g.size(); ++i)
        A += cross(curr(g, i), next(g, i));
    return A / 2.0;
}

int main()
{
    int n;
    while (cin >> n, n)
    {
        G g;
        rep(i, n)
        {
            double x, y;
            cin >> x >> y;
            g.pb(P(x, y));
        }
        double S = areaG(g) / 2;
        double lb = 0, ub = PI;
        double th, tS;

        if (tS = areaG(convex_cut(g, L(P(0, 0), P(1, 0)))) + EPS > S)
        {
            ub = 0;
            lb = PI;
        }

        while (abs(tS - S) >= EPS)
        {
            th = (lb + ub) / 2;
            tS = areaG(convex_cut(g, L(P(0, 0), P(cos(th), sin(th)))));
            if (abs(tS - S) < EPS)
                break;
            else if (tS - S > 0)
                ub = th;
            else
                lb = th;
        }
        printf("%.15f %.15f\n", cos(th), sin(th));
    }
    return 0;
}
accuracy: 1
time_ms: 30
memory_kb: 3680
final_rank: 6

code_snippet: #include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
//#define EPS 0.000000001
using namespace std;

#define EPS 0.00000001

struct Point{
	Point(double arg_x,double arg_y){
		x = arg_x;
		y = arg_y;
	}

	Point(){
		x = y = 0.0;
	}

	Point operator + (Point p){ return Point(x+p.x,y+p.y); }
	Point operator - (Point p){ return Point(x-p.x,y-p.y);}
	Point operator * (double a){ return Point(a*x,a*y); }
	Point operator / (double a){ return Point(x/a,y/a); }

	double abs(){ return sqrt(norm()); }
	double norm(){ return x*x + y*y; }

	bool operator<(const Point &p) const{
		return x != p.x? x < p.x: y < p.y;
	}

	bool operator == (const Point &p) const{
		return fabs(x-p.x) < EPS && fabs(y-p.y) < EPS;
	}

	double x,y;
};

typedef Point Vector;
typedef vector<Point> Polygon;

struct Line{
	Line(){

	}
	Line(Point a,Point b){
		p[0] = a;
		p[1] = b;
	}
	Point p[2];
};

int N;


double calc_dist(Point A,Point B){

	return sqrt((A.x-B.x)*(A.x-B.x)+(A.y-B.y)*(A.y-B.y));
}

double norm(Vector a){
	return a.x*a.x+a.y*a.y;
}

double abs(Vector a){
	return sqrt(norm(a));
}

double cross(Vector a,Vector b){
    return a.x*b.y-a.y*b.x;
}

double dot(Vector a,Vector b){
    return a.x*b.x + a.y*b.y;
}

int func(double x1,double y1,double x2, double y2, double xp, double yp){
	double naiseki,norm1,norm2,gaiseki;
	norm1 = sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));
	norm2 = sqrt((xp-x1)*(xp-x1)+(yp-y1)*(yp-y1));
	naiseki = (xp-x1)*(x2-x1)+(yp-y1)*(y2-y1);
	gaiseki = (x2-x1)*(yp-y1)-(xp-x1)*(y2-y1);
	if(gaiseki > EPS){
		return 1;
	}else if(gaiseki < -EPS){
		return -1;
	}
	if(naiseki < -EPS){
		return 2;
	}

	if(norm1 < norm2){
		return -2;
	}
	return 0;
}


//★★直線ではなく、線分の交差判定★★
bool is_Cross(Line a,Line b){

	if(func(a.p[0].x,a.p[0].y,a.p[1].x,a.p[1].y,b.p[0].x,b.p[0].y)*
			func(a.p[0].x,a.p[0].y,a.p[1].x,a.p[1].y,b.p[1].x,b.p[1].y) <= 0 &&
			func(b.p[0].x,b.p[0].y,b.p[1].x,b.p[1].y,a.p[0].x,a.p[0].y)*
			func(b.p[0].x,b.p[0].y,b.p[1].x,b.p[1].y,a.p[1].x,a.p[1].y) <= 0){
		return true;
	}
	return false;
}
//交点を求める関数
Point calc_Cross_Point(double x1,double x2,double x3,double x4,double y1,double y2,double y3,double y4){
	Point ret;
	ret.x = ((x2-x1)*(y3*(x4-x3)+x3*(y3-y4))-(x4-x3)*(y1*(x2-x1)+x1*(y1-y2)))/((y2-y1)*(x4-x3)-(y4-y3)*(x2-x1));
	if(x1 != x2){
		ret.y = ((y2-y1)*ret.x+y1*(x2-x1)+x1*(y1-y2))/(x2-x1);
	}else{
		ret.y = ((y4-y3)*ret.x+y3*(x4-x3)+x3*(y3-y4))/(x4-x3);
	}
	return ret;
}

//インタフェース関数
Point calc_Cross_Point(Point a,Point b,Point c,Point d){
	return calc_Cross_Point(a.x,b.x,c.x,d.x,a.y,b.y,c.y,d.y);
}

Point calc_minus(Point a,Point b){
    Point ret;

    ret.x = a.x-b.x;
    ret.y = a.y-b.y;

    return ret;
}

double calc_len(Vector a){
    return sqrt(a.x*a.x+a.y*a.y);
}


//線分ではなく直線と点の距離
double getDistanceLP(Line l,Point p){
    return fabs(cross(calc_minus(l.p[1],l.p[0]),calc_minus(p,l.p[0]))/calc_len(calc_minus(l.p[1],l.p[0])));
}

//点と線分の距離
double getDistanceSP(Line l,Point p){
	if(dot(calc_minus(l.p[1],l.p[0]),calc_minus(p,l.p[0])) < 0.0)return calc_len(calc_minus(p,l.p[0]));
	if(dot(calc_minus(l.p[0],l.p[1]),calc_minus(p,l.p[1])) < 0.0)return calc_len(calc_minus(p,l.p[1]));
	return getDistanceLP(l,p);
}

//線分と線分の距離
double getDistance(Line A,Line B){
	if(is_Cross(A,B))return 0.0;
	return min(min(getDistanceSP(A,B.p[0]),getDistanceSP(A,B.p[1])),
			min(getDistanceSP(B,A.p[0]),getDistanceSP(B,A.p[1])));
}

Point calc_Cross_Point(Line A,Line B){

	if(getDistanceSP(B,A.p[0]) < EPS){

		return A.p[0];

	}else if(getDistanceSP(B,A.p[1]) < EPS){

		return A.p[1];

	}else if(getDistanceSP(A,B.p[0]) < EPS){

		return B.p[0];

	}else if(getDistanceSP(A,B.p[1]) < EPS){

		return B.p[1];
	}

	return calc_Cross_Point(A.p[0],A.p[1],B.p[0],B.p[1]);
}

static const int COUNTER_CLOCKWISE = 1;
static const int CLOCKWISE = -1;
static const int ONLINE_BACK = 2;
static const int ONLINE_FRONT = -1;
static const int ON_SEGMENT = 0;

int ccw(Point p0,Point p1,Point p2){

	Vector a = p1 - p0;
	Vector b = p2 - p0;

	if(cross(a,b) > EPS)return COUNTER_CLOCKWISE;
	if(cross(a,b) < -EPS)return CLOCKWISE;
	if(dot(a,b) < -EPS)return ONLINE_BACK;
	if(a.norm() < b.norm())return ONLINE_FRONT;

	return ON_SEGMENT;
}

Polygon ConvexCut(Polygon g,Point a,Point b){

	Polygon ret;
	int N = g.size();

	for(int i = 0; i < g.size(); i++){
		Point A = g[i], B = g[(i+1)%N];
		if(ccw(a,b,A) != -1)ret.push_back(A);
		if(ccw(a,b,A)*ccw(a,b,B) == -1)ret.push_back(calc_Cross_Point(a,b,A,B));
	}

	return ret;
}

double calc_S(Polygon g){

	int N = g.size();
	double ret = 0;

	for(int i = 0; i < g.size(); i++){
		ret += cross(g[i],g[(i+1)%N]);
	}
	return ret/2.0;
}

void func(){

	Polygon pol;

	for(int i = 0; i < N; i++){
		Point point;

		scanf("%lf %lf",&point.x,&point.y);
		pol.push_back(point);
	}

	double base_S = calc_S(pol)/2;

	double L_S = calc_S(ConvexCut(pol,Point(-1000,0),Point(1000,0)));

	double ans_x,ans_y;

	if(fabs(L_S-base_S) < EPS){

		ans_x = 2;
		ans_y = 0;

		printf("%.15lf %.15lf\n",ans_x,ans_y);
		return;
	}

	double left = 0,right = M_PI,mid = (left+right)/2;

	if(L_S > base_S){

		left = -M_PI;
		right = 0;
	}

	for(int loop = 0; loop < 100; loop++){

		L_S = calc_S(ConvexCut(pol,Point(0,0),Point(cos(mid),sin(mid))));

		if(L_S > base_S){

			right = mid;

		}else{

			left = mid;
		}
		mid = (left+right)/2;
	}

	ans_x = 2*cos(mid);
	ans_y = 2*sin(mid);

	printf("%.15lf %.15lf\n",ans_x,ans_y);
}


int main(){

	while(true){
		scanf("%d",&N);
		if(N == 0)break;

		func();
	}

	return 0;
}
accuracy: 1
time_ms: 40
memory_kb: 3620
final_rank: 4

code_snippet: #include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
//#define EPS 0.000000001
using namespace std;

#define EPS 0.00000001

struct Point{
	Point(double arg_x,double arg_y){
		x = arg_x;
		y = arg_y;
	}

	Point(){
		x = y = 0.0;
	}

	Point operator + (Point p){ return Point(x+p.x,y+p.y); }
	Point operator - (Point p){ return Point(x-p.x,y-p.y);}
	Point operator * (double a){ return Point(a*x,a*y); }
	Point operator / (double a){ return Point(x/a,y/a); }

	double abs(){ return sqrt(norm()); }
	double norm(){ return x*x + y*y; }

	bool operator<(const Point &p) const{
		return x != p.x? x < p.x: y < p.y;
	}

	bool operator == (const Point &p) const{
		return fabs(x-p.x) < EPS && fabs(y-p.y) < EPS;
	}

	double x,y;
};

typedef Point Vector;
typedef vector<Point> Polygon;

struct Line{
	Line(){

	}
	Line(Point a,Point b){
		p[0] = a;
		p[1] = b;
	}
	Point p[2];
};

int N;


double calc_dist(Point A,Point B){

	return sqrt((A.x-B.x)*(A.x-B.x)+(A.y-B.y)*(A.y-B.y));
}

double norm(Vector a){
	return a.x*a.x+a.y*a.y;
}

double abs(Vector a){
	return sqrt(norm(a));
}

double cross(Vector a,Vector b){
    return a.x*b.y-a.y*b.x;
}

double dot(Vector a,Vector b){
    return a.x*b.x + a.y*b.y;
}

int func(double x1,double y1,double x2, double y2, double xp, double yp){
	double naiseki,norm1,norm2,gaiseki;
	norm1 = sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));
	norm2 = sqrt((xp-x1)*(xp-x1)+(yp-y1)*(yp-y1));
	naiseki = (xp-x1)*(x2-x1)+(yp-y1)*(y2-y1);
	gaiseki = (x2-x1)*(yp-y1)-(xp-x1)*(y2-y1);
	if(gaiseki > EPS){
		return 1;
	}else if(gaiseki < -EPS){
		return -1;
	}
	if(naiseki < -EPS){
		return 2;
	}

	if(norm1 < norm2){
		return -2;
	}
	return 0;
}


//★★直線ではなく、線分の交差判定★★
bool is_Cross(Line a,Line b){

	if(func(a.p[0].x,a.p[0].y,a.p[1].x,a.p[1].y,b.p[0].x,b.p[0].y)*
			func(a.p[0].x,a.p[0].y,a.p[1].x,a.p[1].y,b.p[1].x,b.p[1].y) <= 0 &&
			func(b.p[0].x,b.p[0].y,b.p[1].x,b.p[1].y,a.p[0].x,a.p[0].y)*
			func(b.p[0].x,b.p[0].y,b.p[1].x,b.p[1].y,a.p[1].x,a.p[1].y) <= 0){
		return true;
	}
	return false;
}
//交点を求める関数
Point calc_Cross_Point(double x1,double x2,double x3,double x4,double y1,double y2,double y3,double y4){
	Point ret;
	ret.x = ((x2-x1)*(y3*(x4-x3)+x3*(y3-y4))-(x4-x3)*(y1*(x2-x1)+x1*(y1-y2)))/((y2-y1)*(x4-x3)-(y4-y3)*(x2-x1));
	if(x1 != x2){
		ret.y = ((y2-y1)*ret.x+y1*(x2-x1)+x1*(y1-y2))/(x2-x1);
	}else{
		ret.y = ((y4-y3)*ret.x+y3*(x4-x3)+x3*(y3-y4))/(x4-x3);
	}
	return ret;
}

//インタフェース関数
Point calc_Cross_Point(Point a,Point b,Point c,Point d){
	return calc_Cross_Point(a.x,b.x,c.x,d.x,a.y,b.y,c.y,d.y);
}

Point calc_minus(Point a,Point b){
    Point ret;

    ret.x = a.x-b.x;
    ret.y = a.y-b.y;

    return ret;
}

double calc_len(Vector a){
    return sqrt(a.x*a.x+a.y*a.y);
}


//線分ではなく直線と点の距離
double getDistanceLP(Line l,Point p){
    return fabs(cross(calc_minus(l.p[1],l.p[0]),calc_minus(p,l.p[0]))/calc_len(calc_minus(l.p[1],l.p[0])));
}

//点と線分の距離
double getDistanceSP(Line l,Point p){
	if(dot(calc_minus(l.p[1],l.p[0]),calc_minus(p,l.p[0])) < 0.0)return calc_len(calc_minus(p,l.p[0]));
	if(dot(calc_minus(l.p[0],l.p[1]),calc_minus(p,l.p[1])) < 0.0)return calc_len(calc_minus(p,l.p[1]));
	return getDistanceLP(l,p);
}

//線分と線分の距離
double getDistance(Line A,Line B){
	if(is_Cross(A,B))return 0.0;
	return min(min(getDistanceSP(A,B.p[0]),getDistanceSP(A,B.p[1])),
			min(getDistanceSP(B,A.p[0]),getDistanceSP(B,A.p[1])));
}

Point calc_Cross_Point(Line A,Line B){

	if(getDistanceSP(B,A.p[0]) < EPS){

		return A.p[0];

	}else if(getDistanceSP(B,A.p[1]) < EPS){

		return A.p[1];

	}else if(getDistanceSP(A,B.p[0]) < EPS){

		return B.p[0];

	}else if(getDistanceSP(A,B.p[1]) < EPS){

		return B.p[1];
	}

	return calc_Cross_Point(A.p[0],A.p[1],B.p[0],B.p[1]);
}

static const int COUNTER_CLOCKWISE = 1;
static const int CLOCKWISE = -1;
static const int ONLINE_BACK = 2;
static const int ONLINE_FRONT = -1;
static const int ON_SEGMENT = 0;

int ccw(Point p0,Point p1,Point p2){

	Vector a = p1 - p0;
	Vector b = p2 - p0;

	if(cross(a,b) > EPS)return COUNTER_CLOCKWISE;
	if(cross(a,b) < -EPS)return CLOCKWISE;
	if(dot(a,b) < -EPS)return ONLINE_BACK;
	if(a.norm() < b.norm())return ONLINE_FRONT;

	return ON_SEGMENT;
}

Polygon ConvexCut(Polygon g,Point a,Point b){

	Polygon ret;
	int N = g.size();

	for(int i = 0; i < g.size(); i++){
		Point A = g[i], B = g[(i+1)%N];
		if(ccw(a,b,A) != -1)ret.push_back(A);
		if(ccw(a,b,A)*ccw(a,b,B) == -1)ret.push_back(calc_Cross_Point(a,b,A,B));
	}

	return ret;
}

double calc_S(Polygon g){

	int N = g.size();
	double ret = 0;

	for(int i = 0; i < g.size(); i++){
		ret += cross(g[i],g[(i+1)%N]);
	}
	return ret/2.0;
}

void func(){

	Polygon pol;

	for(int i = 0; i < N; i++){
		Point point;

		scanf("%lf %lf",&point.x,&point.y);
		pol.push_back(point);
	}

	double base_S = calc_S(pol)/2;

	double L_S = calc_S(ConvexCut(pol,Point(-1000,0),Point(1000,0)));

	double ans_x,ans_y;

	if(fabs(L_S-base_S) < EPS){

		ans_x = 2;
		ans_y = 0;

		printf("%.15lf %.15lf\n",ans_x,ans_y);
		return;
	}

	double left = 0,right = M_PI,mid = (left+right)/2;

	if(L_S > base_S){

		left = -M_PI;
		right = 0;
	}

	double slope;

	for(int loop = 0; loop < 100; loop++){

		if(fabs(mid-(M_PI/2)) < EPS){

			L_S = calc_S(ConvexCut(pol,Point(0,-1000),Point(0,1000)));

		}else{

			slope = tan(mid);
			L_S = calc_S(ConvexCut(pol,Point(-1000,-1000*slope),Point(1000,1000*slope)));
		}

		if(L_S > base_S){

			right = mid;

		}else{

			left = mid;
		}
		mid = (left+right)/2;
	}

	if(fabs(mid-(M_PI/2)) < EPS){

		ans_x = 0;
		ans_y = 2;

	}else{

		ans_x = 2;
		ans_y = 2*tan(mid);
	}

	printf("%.15lf %.15lf\n",ans_x,ans_y);
}


int main(){

	while(true){
		scanf("%d",&N);
		if(N == 0)break;

		func();
	}

	return 0;
}
accuracy: 0.25
time_ms: 830
memory_kb: 3696
final_rank: 19

code_snippet: #include <iostream>
#include <complex>
#include <utility>
#include <vector>
#include <algorithm>
using namespace std;

typedef complex<double> Point, Vector;
typedef pair<Point, Point> Segment, Line;
typedef vector<Point> Polygon;

#define X real()
#define Y imag()
#define EPS (1e-10)
#define equals(a, b) (fabs((a) - (b)) < EPS)

const double pi = acos(-1);

double dot(Vector a, Vector b){
    return a.X * b.X + a.Y * b.Y;
}

double cross(Vector a, Vector b){
    return a.X * b.Y - a.Y * b.X;
}

static const int COUNTER_CLOCKWISE = 1;
static const int CLOCKWISE = -1;
static const int ONLINE_BACK = 2;
static const int ONLINE_FRONT = -2;
static const int ON_SEGMENT = 0;

int ccw(Point p0, Point p1, Point p2){
    Vector a = p1 - p0;
    Vector b = p2 - p0;
    if(cross(a, b) > EPS) return COUNTER_CLOCKWISE;
    if(cross(a, b) < -EPS) return CLOCKWISE;
    if(dot(a, b) < -EPS) return ONLINE_BACK;
    if(norm(a) < norm(b)) return ONLINE_FRONT;

    return ON_SEGMENT;
}

double convexArea(Polygon pol){
    int n = pol.size();
    double S = 0;
    for(int i=0; i<n; i++){
        S += cross(pol[i], pol[(i+1)%n]);
    }

    return S / 2;
}

Point getCrossPointLL(Line l1, Line l2){
    double a = cross(l1.second - l1.first, l2.second - l2.first);
    double b = cross(l1.second - l1.first, l1.second - l2.first);
    if(abs(a) < EPS && abs(b) < EPS) return l2.first;
    return l2.first + (l2.second - l2.first) * (b / a);
}

Polygon convexCut(Polygon pol, Line l){
    Polygon q;
    int n = pol.size();
    for(int i=0; i<n; i++){
        Point a = pol[i];
        Point b = pol[(i+1)%n];
        if(ccw(l.first, l.second, a) != CLOCKWISE) q.emplace_back(a);
        if(ccw(l.first, l.second, a) * ccw(l.first, l.second, b) < -EPS){
            q.emplace_back(getCrossPointLL(Line(a, b), l));
        }
    }

    return q;
}

double solve(Polygon pol){
    double S = convexArea(pol);
    double lb = 0, ub = pi;

    if(convexArea(convexCut(pol, Line(Point(0, 0), Point(1, 0)))) > S / 2){
        lb = pi;
        ub = 0;
    }

    double mid;
    for(int i=0; i<10000; i++){
        mid = (lb + ub) / 2;
        double midS = convexArea(convexCut(pol, Line(Point(0, 0), Point(cos(mid), sin(mid)))));

        if(abs(midS - S / 2) < EPS) break;

        if(midS < S / 2){
            lb = mid;
        }
        else{
            ub = mid;
        }
    }

    return mid;
}

int main(){
    while(1){
        int n; cin>>n;
        if(n == 0) return 0;
        Polygon pol;
        for(int i=0; i<n; i++){
            double x, y; cin>>x>>y;
            pol.emplace_back(x, y);
        }

        double rad = solve(pol);

        printf("%.15f %.15f\n", cos(rad), sin(rad));
    }
}
accuracy: 1
time_ms: 20
memory_kb: 3588
final_rank: 2

code_snippet: #include <bits/stdc++.h>

using namespace std;
using ll = long long;
// #define int ll
using PII = pair<ll, ll>;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()

template<typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template<typename T> bool IN(T a, T b, T x) { return a<=x&&x<b; }
template<typename T> T ceil(T a, T b) { return a/b + !!(a%b); }

template<typename T> vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts) {
    return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type
fill_v(T &t, const V &v) { t=v; }
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t, const V &v ) { for(auto &e:t) fill_v(e,v); }

template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a) {
    out<<'('<<a.first<<','<<a.second<<')'; return out;
}
template<class T>
ostream &operator <<(ostream& out,const vector<T>& a){
    out<<'[';
    for(const T &i: a) out<<i<<',';
    out<<']';
    return out;
}
template<class T>
ostream &operator <<(ostream& out, const set<T>& a) {
    out<<'{';
    for(const T &i: a) out<<i<<',';
    out<<'}';
    return out;
}
template<class T, class S>
ostream &operator <<(ostream& out, const map<T,S>& a) {
    out<<'{';
    for(auto &i: a) out<<i<<',';
    out<<'}';
    return out;
}

int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0}; // DRUL
const int INF = 1<<30;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;

using R = long double; // Rにmint渡せるようにする
using P = complex<R>;
using L = pair<P,P>;
using G = vector<P>;
struct C {
    P c; R r;
    C() {}
    C(const P &a, const R &b) : c(a), r(b) {}
};
struct S : public L {
    S() {}
    S(const P &a, const P &b) : L(a,b) {}
};

const R EPS = 1e-8;
const R PI = atan(1)*4;

inline int sgn(const R& r) { return (r>EPS) - (r<-EPS); }
inline R dot(const P& a, const P& b) {
    return real(a)*real(b) + imag(a)*imag(b);
}
inline R det(const P& a, const P& b) {
    return real(a)*imag(b) - imag(a)*real(b);
}
inline P vec(const L& l) {return l.second - l.first;}
namespace std {
	bool operator < (const P& a, const P& b) {
		return sgn(real(a-b)) ? real(a-b) < 0 : sgn(imag(a-b)) < 0;
	}
	bool operator == (const P& a, const P& b) {
		return sgn(real(a-b)) == 0 && sgn(imag(a-b)) == 0;
	}
    bool cmp_y (const P& a, const P& b) {
        return sgn(imag(a-b)) ? imag(a-b) < 0 : sgn(real(a-b)) < 0;
    }
}

// P,L,Sについて入力
inline istream& operator>>(istream& is, P& p) {
    R x, y;
    is >> x >> y;
    p = P(x, y);
    return is;
}
inline istream& operator>>(istream& is, L& l) {
    P a, b;
    is >> a >> b;
    l = L(a, b);
    return is;
}
inline istream& operator>>(istream& is, S& s) {
    P a, b;
    is >> a >> b;
    s = S(a, b);
    return is;
}

// 交点 交差判定を先にすること!!!
inline P crosspoint(const L& l1, const L& l2) {
    R ratio = det(vec(l2), l2.first-l1.first)/det(vec(l2),vec(l1));
    return l1.first + vec(l1)*ratio;
}

// 凸多角形polを直線lで切断して左側の多角形を返す
G convex_cut(const G& pol, const L& l) {
    G res;
    REP(i, pol.size()) {
        P a = pol[i], b = pol[(i + 1)%pol.size()];
        int da = sgn(det(l.first-a, l.second-a)), db = sgn(det(l.first-b, l.second-b));
        if (da >= 0) res.emplace_back(a);
        if (da * db < 0) res.emplace_back(crosspoint(L{a, b}, l));
    }
    return res;
}

// 面積 頂点が反時計回りに並んでいること
R area(const G& pol) {
    R ret = 0.0;
    REP(i, pol.size()) ret += det(pol[i], pol[(i+1)%pol.size()]);
    return (ret/2.0);
}

// 角度thetaの直線でpolを切断した後左半分の面積
R cut_poly(R theta, const G& pol) {
    L l(P(0,0), P(10.0*cos(theta), 10.0*sin(theta)));
    G g = convex_cut(pol, l);
    return area(g);
}

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    while(1) {
        ll n;
        cin >> n;
        if(!n) break;
        G vp(n);
        REP(i, n) cin >> vp[i];

        R vp_area = area(vp), v = cut_poly(0, vp);
        R lb = 0, ub = PI;
        REP(i, 100) {
            R mid = (lb+ub)/2;
            R val = cut_poly(mid, vp);
            if(v < vp_area/2) {
                if(val > vp_area/2) ub = mid;
                else lb = mid;
            } else {
                if(val > vp_area/2) lb = mid;
                else ub = mid;
            }
        }
        cout << fixed << setprecision(16) << 10.0*cos(lb) << " " << 10.0*sin(lb) << endl;
    }

    return 0;
}
accuracy: 1
time_ms: 80
memory_kb: 3620
final_rank: 5

code_snippet: #include <iostream>
#include <vector>
#include <utility>
#include <complex>
#include <cassert>
using namespace std;
using W = long double;
using P = complex<W>;
using Poly = vector<P>;
using L = pair<P,P>;
#define X real()
#define Y imag()
constexpr W EPS = 1e-10, pi = acos(-1);

void debug(Poly p){
  cerr << "Polygon" << endl;
  for(auto e : p) cerr << e.X << " " << e.Y << endl;
  cerr << "..." << endl;
}

void debug(L l){
  fprintf(stderr,"Segment %Lf %Lf %Lf %Lf\n",l.first.X,l.first.Y,l.second.X,l.second.Y);
}

W dot(const P &a, const P &b){ return a.X*b.X + a.Y*b.Y; }
W cross(const P &a, const P &b){ return a.X*b.Y - a.Y*b.X; }

P intersection(const L &a, const L &b){
  P af = a.first, as = a.second, bf = b.first, bs = b.second;
  return af + cross(bs-bf,af-bf)/(-cross(bs-bf,as-bf)+cross(bs-bf,af-bf))*(as-af);
}

int ccw(P a, P b, P c){
  b -= a, c -= a;
  if(cross(b,c) > +EPS) return +1;
  if(cross(b,c) < -EPS) return -1;
  if(dot(b,c) < +EPS) return +2;
  if(norm(b) + EPS < norm(c)) return -2;
  return 0;
}

Poly convex_cut(const Poly &p, const L &l){
  Poly ret;
  int n = p.size();
  for(int i = 0; i < n; ++i){
    P cur = p[i], nex = p[(i+1)%n], lf = l.first, ls = l.second;
    if(ccw(lf,ls,cur) != -1)
      ret.push_back(cur);
    if((ccw(lf,ls,cur) != -1) ^ (ccw(lf,ls,nex) != -1))
      ret.push_back(intersection(L(cur,nex),l));
  }
  return ret;
}

W area(const Poly &p){
  int n = p.size();
  W ret = 0;
  for(int i = 0; i < n; ++i){
    ret += cross(p[i],p[(i+1)%n]);
  }
  return ret/2;
}

int main(){
  int N;
  while(cin >> N, N){
    Poly pol;
    for(int i = 0; i < N; ++i){
      W x, y;
      cin >> x >> y;
      pol.emplace_back(x,y);
    }
    W ok = 0, ng = pi, S = area(pol);
    L l(P(0,0),P(10,0));
    W s = area(convex_cut(pol,l));
    if(s-(S-s) < EPS){
      ok = -pi;
      ng = 0;
    }
    for(int tmp = 0; tmp < 100; ++tmp){
      W m = (ok+ng)/2;
      l = L(P(0,0),P(10,0)*P(cos(m),sin(m)));
      s = area(convex_cut(pol,l));
      if(s-(S-s) > EPS){
        ok = m;
      }else{
        ng = m;
      }
    }
    W a = (ok+ng)/2;
    P A = P(10*cos(a),10*sin(a));
    s = area(convex_cut(pol,L(P(0,0),A)));
    assert(abs(s-(S-s)) <= 1e-5);
    //fprintf(stderr,"%.12Lf : %.12Lf\n",s,S-s);
    printf("%.15Lf %.15Lf\n",A.X,A.Y);
  }
}
accuracy: 1
time_ms: 90
memory_kb: 3560
final_rank: 3

code_snippet: #include<bits/stdc++.h> //std==c++14
using namespace std;
 
#define EPS (1e-10)
#define equals(a,b) ( fabs(a-b) < EPS )
#define PI acos(-1)
// COUNTER CLOCKWISE
static const int CCW_COUNTER_CLOCKWISE = 1;
static const int CCW_CLOCKWISE = -1;
static const int CCW_ONLINE_BACK = 2;
static const int CCW_ONLINE_FRONT = -2;
static const int CCW_ON_SEGMENT = 0;

//Intersect Circle and Circle
static const int ICC_SEPARATE = 4;//離れている
static const int ICC_CIRCUMSCRIBE = 3;//外接
static const int ICC_INTERSECT = 2;// 交わる
static const int ICC_INSCRIBE = 1;// 内接
static const int ICC_CONTAIN = 0;//内包

struct point{
	double x,y;
	//construct
	point() {} 
	point(double x,double y):x(x),y(y){}
	//演算子
	point operator + (point p) { return point(x+p.x,y+p.y); }
	point operator - (point p) { return point(x-p.x,y-p.y); }
	point operator * (double k) { return point(x*k,y*k); }
	point operator / (double k) { return point(x/k,y/k); }
	point operator / (point p) { return point( (x*p.x + y*p.y)/p.norm()  , (-x*p.y + y*p.x)/p.norm() ) ; }
	bool operator < (point p) { return x!=p.x ? x<p.x : y<p.y; }
	bool operator == (point p) { return equals(x,p.x) && equals(y,p.y) ; }
	//function
	double arg() { return atan2(y,x) ; }
	double norm(){return x*x+y*y; }
	double abs() { return sqrt(norm() ) ;}
	double dot(point p) { return p.x*x + p.y*y; }
	double cross(point p) { return x*p.y - y*p.x; }
	point roll(double theta){ return point( cos(theta)*x - sin(theta)*y , sin(theta)*x + cos(theta)*y ) ; }	
	//input output
	void input(){cin>>x>>y;}
	void polar(double r,double theta){ x = r*cos(theta), y= r*sin(theta) ; }
	void print(){cout<<x<<' '<<y<<endl;};

};

bool sort_x(point a,point b){
	return a.x!=b.x?a.x<b.x:a.y<b.y ;
}
bool sort_y(point a,point b){
	return a.y!=b.y?a.y<b.y:a.x<b.x ;
}

typedef vector<point> polygon;

struct segment{
	point s,t;
	segment() {}
	segment(point s,point t) : s(s),t(t){}
	void input(){s.input(),t.input(); }
};
typedef segment line;

struct circle{
	point c;
	double r;
	circle() {}
	circle(point c,double r) : c(c),r(r){}
	void input(){c.input(); cin>>r; }
};

double norm(point a){	return a.norm(); }
double abs(point a){ return a.abs(); }
double arg(point a){ return a.arg(); }
double dot(point a,point b) { return a.x*b.x + a.y*b.y ; }
double cross(point a,point b) { return a.x * b.y - a.y * b.x ; }
point polar(double r,double theta){ point a; a.polar(r,theta); return a; }
point orth(point p){ return point(-p.y,p.x); }

//isOrthgonal 垂直
bool isOrthogonal(point a,point b) { return equals(dot(a,b), 0.0 ) ; }
bool isOrthogonal(point a,point b,point c,point d) { return isOrthogonal(a-b,c-d) ; }
bool isOrthogonal(line l1,line l2 ){ return isOrthogonal(l1.t-l1.s,l2.t-l2.s); }
//isParallel 平行
bool isParallel(point a,point b) { return equals(cross(a,b), 0.0) ; }
bool isParallel(point a,point b,point c,point d) { return isParallel(a-b,c-d); }
bool isParallel(line l1,line l2) { return isParallel(l1.t-l1.s,l2.t-l2.s) ; }

point project(line l,point p){
	point base = l.t-l.s;
	double r = dot(p-l.s,base) / norm(base) ;
	return l.s + base*r;
}
point reflect(line l,point p){
	return p + (project(l,p) - p) *2.0;
}

int ccw(point p0,point p1,point p2){
	point a = p1-p0;
	point b = p2-p0;
	if(cross(a,b) > EPS ) return CCW_COUNTER_CLOCKWISE ;
	if(cross(a,b) < -EPS ) return CCW_CLOCKWISE;
	if(dot(a,b) < -EPS ) return CCW_ONLINE_BACK;
	if(a.norm() < b.norm() ) return CCW_ONLINE_FRONT;
	return CCW_ON_SEGMENT;
}


//intersect
bool intersect(point p1,point p2,point p3,point p4){return (ccw(p1,p2,p3)*ccw(p1,p2,p4) <= 0 && ccw(p3,p4,p1)*ccw(p3,p4,p2) <= 0 ) ; }
bool intersect(line l1,line l2) { return intersect(l1.s,l1.t,l2.s,l2.t) ; }
bool intersect(polygon p,line l){
	int n = p.size();
	for(int i=0;i<n;i++)  if(intersect(line(p[i],p[(i+1)%n] ) , l ) ) return true;
	return false;
}
int intersect(circle c1,circle c2){
	if(c1.r < c2.r) swap(c1,c2);
	double d = abs(c1.c-c2.c);
	double r = c1.r + c2.r;
	if(equals(d,r) ) return ICC_CIRCUMSCRIBE;
	if(d > r ) return ICC_SEPARATE;
	if(equals(d+c2.r,c1.r) ) return ICC_INSCRIBE;
	if( d + c2.r < c1.r ) return ICC_CONTAIN;
	return ICC_INTERSECT;
}

//bool intersectsc(line l,circle c){ return distancesp(l,c.c) <= c.r ; } distanceののち
int intersectcs(circle c,line l ){// 0		1		2
	if(norm(project(l,c.c) - c.c )  - c.r*c.r  > EPS ) return 0;
	double d1 = abs(c.c-l.s),d2  = abs(c.c-l.t);
	if(d1 < c.r + EPS && d2 < c.r + EPS ) return 0;
	if( (d1<c.r - EPS && d2 > c.r +EPS) || (d1 > c.r +EPS &&d2 < c.r -EPS ) ) return 1;
	point h = project(l,c.c) ;
	if(dot(l.s-h,l.t-h) < 0 ) return 2;
	return 0;
}

//distance
//line point
double distancelp(line l,point p){ return abs(cross(l.t-l.s,p-l.s)/ abs(l.t-l.s)  ); }
//segment point
double distancesp(line l,point p){ 
	if(dot(l.t-l.s,p-l.s) < 0.0 ) return abs(p-l.s);
	if(dot(l.s-l.t,p-l.t) < 0.0 ) return abs(p-l.t);
	return distancelp(l,p);
}
//segment segment 
double distancess(line l1,line l2){
	if(intersect(l1,l2) ) return 0.0;
	return min( min(distancesp(l1,l2.s) ,distancesp(l1,l2.t) ) , min(distancesp(l2,l1.s),distancesp(l2,l1.t)  ) );
}

bool intersectsc(line l,circle c){ return distancesp(l,c.c) <= c.r ; }

//crosspoint 
//segment segment
point crosspointss(line l1,line l2){
	for(int k=0;k<2;k++){
		if(distancesp(l1,l2.s) < EPS ) return l2.s;
		if(distancesp(l1,l2.t) < EPS ) return l2.t;
		swap(l1,l2);
	}
	point base = l2.t-l2.s;
	double d1 = abs(cross(base,l1.s-l2.s) );
	double d2 = abs(cross(base,l1.t-l2.s) );
	double t = d1/(d1+d2);
	return l1.s + (l1.t-l1.s) * t;
}
//line line
point crosspointll(line l1,line l2){
	double a = cross(l1.t-l1.s,l2.t-l2.s);
	double b = cross(l1.t-l1.s,l1.t-l2.s);
	if(abs(a) < EPS && abs(b) < EPS ) return l2.s;
	return l2.s + (l2.t-l2.s) * (b/a) ;
}
//circle line
polygon crosspointCL(circle c,line l){
	polygon ps;
	point pr = project(l,c.c);
	point e = (l.t - l.s) / abs(l.t-l.s) ;
	if(equals(distancelp(l,c.c),c.r) ){
		ps.emplace_back(pr);
		return ps;
	}
	double base = sqrt(c.r*c.r - norm(pr-c.c) );
	ps.emplace_back(pr + e*base ) ;
	ps.emplace_back(pr - e*base ) ;
	return ps;
}
//circle segment
polygon crosspointCS(circle c,line l ){
	polygon res = crosspointCL(c,l);
	if(intersectcs(c,l) == 2 ) return res;
	if(res.size() > 1u ){//一つのみ削る
		if(dot(l.s-res[0] ,l.t-res[0] ) > 0) swap(res[0],res[1] );
		res.pop_back();
	}
	return res;
}
polygon crosspointcc(circle c1,circle c2){
	polygon p(2);
	double d = abs(c1.c-c2.c);
	double a = acos( (c1.r *c1.r + d*d -c2.r*c2.r) /(2*c1.r*d ) );
	double t = arg(c2.c-c1.c);
	p[0] = c1.c + polar(c1.r,t+a);
	p[1] = c1.c + polar(c1.r,t-a);
	//if(cross(c2.c-c1.c,p[0]-c1.c) > EPS) swap(p[0],p[1]); //c1に関する偏角の順
	return p;
}

int contains(polygon g,point p) { //IN:2 ON:1 OUT:0
    int n = g.size();
    bool f = false;
    for(int i=0;i<n;i++){
	point a = g[i] - p,b = g[(i+1)%n] - p;
	if( fabs(cross(a,b) ) < EPS && dot(a,b) < EPS) return 1;
	if( a.y > b.y ) swap(a,b);
	if( a.y < EPS && EPS < b.y && cross(a,b) > EPS ) f = !f;
    }
    return (f?2:0) ;
}

polygon andrewscan(polygon &s){ //convex hull
	polygon u,l;
	if(s.size() < 3) return s;
	//sort(s.begin(),s.end() );
	//最も左で最も右の点にする
	sort(s.begin(),s.end(),sort_y);
	u.push_back(s[0]);
	u.push_back(s[1]);
	l.push_back(s[s.size()-1]);
	l.push_back(s[s.size()-2]);
	for(int i=2;i<s.size();i++){
		for(int n = u.size();n>=2&&ccw(u[n-2],u[n-1],s[i]) != CCW_CLOCKWISE;n--)//凸包の辺上を含めない
		//for(int n = u.size();n>=2&&ccw(u[n-2],u[n-1],s[i]) == CCW_COUNTER_CLOCKWISE;n--)//凸包の辺上を含める場合
		u.pop_back();
		u.push_back(s[i]);
	}
	for(int i=s.size()-3;i>=0;i--){
		for(int n=l.size();n>=2&&ccw(l[n-2],l[n-1],s[i]) != CCW_CLOCKWISE;n--)//凸包の辺上を含めない	
		//for(int n=l.size();n>=2&&ccw(l[n-2],l[n-1],s[i]) == CCW_COUNTER_CLOCKWISE;n--)//凸包の辺上を含める場合
		l.pop_back();
		l.push_back(s[i]);
	}
	reverse(l.begin(),l.end());
	for(int i=u.size()-2;i>=1;i--)l.push_back(u[i]);
	return l;
}

double diameter(polygon &s){
	polygon p = s;
	int n = p.size();
	if(n==2) return abs(p[0]-p[1]);
	int i=0,j=0;
	for(int k=0;k<n;k++){
		if(p[i] < p[k]) i = k;
		if(!(p[j]<p[k]) ) j = k;
	}
	double res = 0;
	int si = i,sj = j;
	while( i != sj || j != si ){
		res = max(res,abs(p[i]-p[j]) );
		if(cross(p[(i+1)%n]-p[i],p[(j+1)%n]-p[j] ) < 0.0) i = (i+1)%n;
		else j = (j+1)%n;
	}
	return res;
}
bool isconvex(polygon p){
	bool f = 1;
	int n = p.size();
	for(int i=0;i<n;i++){
		int t = ccw(p[(i+n-1)%n],p[i],p[(i+1)%n] );
		f&= t!=CCW_CLOCKWISE;
	}
	return f;
}
double area(polygon p){
	double res =  0.0;
	for(int i=0;i<p.size();i++) res += cross(p[i],p[ (i+1)%p.size() ]);
	return res/2.0;
}
double area(circle c1,circle c2){
	double d = abs(c1.c-c2.c);
	if(c1.r + c2.r <= d + EPS ) return 0.0;
	if(d<=abs(c1.r-c2.r) ){
		double r = min(c1.r,c2.r);
		return PI*r*r;
	}
	double rc = (d*d + c1.r*c1.r -c2.r*c2.r)/(2*d);
	double th = acos(rc/c1.r);
	double ph = acos( (d-rc)/c2.r);
	return c1.r*c1.r*th + c2.r*c2.r*ph - d * c1.r * sin(th) ;
}

polygon convex_cut(polygon p,line l){
	polygon q;
	int n = p.size();
	for(int i=0;i<n;i++){
		point a = p[i] , b = p[(i+1)%n];
		if(ccw(l.s,l.t,a) != -1 ) q.push_back(a);
		if(ccw(l.s,l.t,a) * ccw(l.s,l.t,b) < 0) q.push_back(crosspointss(line(a,b),l) );
	}
	return q;
}
//[s,t) 再帰 devide and conquer
double inf  = 1e10;
double closest_pair_dac(polygon &p,int s,int t,double &res){
	if(t-s<=1)return inf;
	if(t-s==2){
		sort(p.begin()+s,p.begin()+t,sort_y);
		return (p[s]-p[s+1]).abs();
	}
	int mid = (s+t)/2;
	double x = p[mid].x;
	res = min(closest_pair_dac(p,s,mid,res),closest_pair_dac(p,mid,t,res) );
	auto it = p.begin();
	auto its = it+s,itm = it+mid,itt = it + t;
	inplace_merge(its,itm,itt,sort_y);
	vector<point> tmp;
	for(int i=s;i<t;i++){
		if(abs(p[i].x-x) >= res) continue;
		for(int j=tmp.size()-1;j>=0;j--){
			point d = p[i]-tmp[j];
			if(d.y >= res) break;
			res = min( res , d.abs() );
		}
		tmp.push_back(p[i]);
	}
	return res;
}
double closest_pair(polygon &p){
	double res = inf;
	sort(p.begin(),p.end());
	return  closest_pair_dac(p,0,p.size(),res);
}

polygon tangent(circle c,point p){//点から円への接戦
	circle c2 = circle(p,sqrt(norm(c.c-p)-c.r*c.r ) );
	polygon res = crosspointcc(c,c2);
	sort(res.begin(),res.end() );
	return res;
}
vector<line> tangent(circle c1,circle c2){//円の共通接戦
    vector<line> res;
    if(c1.r < c2.r ) swap(c1,c2);
    point g  = c2.c-c1.c;
    if( equals( g.norm() ,0.0 ) ) return res;
    point u = g/g.abs();
    point v = orth(u);
    for(int s=1;s>=-1;s-=2){
	double h = (c1.r + s*c2.r)/g.abs();
	if( equals(1-h*h,0.0) ){
		res.emplace_back( line(c1.c+u*c1.r,c1.c+(u+v)*c1.r) );
	}else if(1-h*h>0) {
		point uu = u*h,vv = v*sqrt(1-h*h) ;
		res.emplace_back( line(c1.c+(uu+vv)*c1.r,c2.c-(uu+vv)*c2.r*s) );
		res.emplace_back( line(c1.c+(uu-vv)*c1.r,c2.c-(uu-vv)*c2.r*s) );
	}
    }
	return res;
}
polygon tangent_point(circle c1,circle c2){//円の共通接戦における接点集合
    vector<line> ls = tangent(c1,c2);
    polygon res ;
    for(auto l:ls){
	polygon tmp = crosspointCL(c1,l);
	if(tmp.size()!=0)res.emplace_back(tmp[0]);
    }
    sort(res.begin(),res.end());
    return res;
}

double calcu(circle c,point a,point b){
	point va = c.c-a,vb = c.c - b;
	double f = cross(va,vb);
	double res = 0.0;
	if(equals(f,0.0) )return res;
	if(max(abs(va),abs(vb) ) < c.r + EPS) return f;
	point d( dot(va,vb),cross(va,vb) );
	if( distancesp(line(a,b),c.c) > c.r -EPS ) return c.r*c.r*atan2(d.y,d.x);
	auto u = crosspointCS(c,line(a,b) );
	if(u.empty() ) return res;
	if(u.size() > 1u && dot(u[1]-u[0],a-u[0] ) > 0 ) swap(u[0],u[1]);
	u.emplace(u.begin(),a);
	u.emplace_back(b);
	for(int i=1;i<u.size();i++)res+=calcu(c,u[i-1],u[i]);
	return res;
}
double area(polygon ps,circle c){
	if(ps.size() < 3u) return 0.0;
	double res = 0.0;
	for(int i=0;i<ps.size();i++) res += calcu(c,ps[i],ps[(i+1)%ps.size()] );
	return res/2;
}

point solve(polygon &ps){
	point s = point(0.0,0.0);
	int n = ps.size();
	double S = area(ps);
	for(int i=0;i<n;i++){
		line l1 = line(s,ps[i]);
		line l2 = line(s,ps[(i+1)%n]);
		polygon s1 =convex_cut(ps,l1);
		polygon s2 =convex_cut(ps,l2);
		double S1 = area(s1);
		double S2 = area(s2);
		if( equals(S1,S/2) ) return ps[i];
		if( equals(S2,S/2) ) return ps[(i+1)%n];
		if( S1 < S/2 +EPS && S2 > S/2 + EPS ){
			point u = ps[i],d = ps[(i+1)%n];
			while( abs(S1-S2)  > EPS ){
			    	l1 = line(s,u);
				l2 = line(s,d);
				s1 = convex_cut(ps,l1);
				s2 = convex_cut(ps,l2);
				S1 = area(s1);
				S2 = area(s2);
				line l = line(s, (u+d)/2 );
				polygon ss = convex_cut(ps,l);
				if( area(ss) > S/2){
					d = (u+d)/2;
				}else{
					u = (u+d)/2;
				}
			}

			//ps[i].print();
			//ps[(i+1)%n].print();
			return (u+d)/2;
		}

	}
	return s;

}


typedef pair<double,double> mp;
int main(){
    	while(1){
		int n;
		cin>>n;
		if(n==0)break;
		polygon ps(n);
		for(int i=0;i<n;i++)ps[i].input();
		point res = solve(ps);
		printf("%0.10lf %0.10lf\n",res.x,res.y);
	}
	return 0;
}
accuracy: 1
time_ms: 80
memory_kb: 3228
final_rank: 1

code_snippet: #include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>

using namespace std;
using Real = double;
using Point = complex<Real>;
const Real EPS = 1e-8, PI = acos(-1);

// 実数同士の比較
inline bool eq(Real a, Real b) { return fabs(b - a) < EPS; }

Point operator*(const Point &p, const Real &d) {
  return Point(real(p) * d, imag(p) * d);
}

// 入力
istream &operator>>(istream &is, Point &p) {
  Real a, b;
  is >> a >> b;
  p = Point(a, b);
  return is;
}

// 出力
ostream &operator<<(ostream &os, Point &p) {
  os << fixed << setprecision(10) << p.real() << " " << p.imag();
}

// 原点を中心として, 点 p を θ 回転すた点を返す
Point rotate(Real theta, const Point &p) {
  return Point(cos(theta) * p.real() - sin(theta) * p.imag(), sin(theta) * p.real() + cos(theta) * p.imag());
}

// ラジアンを度数に変換
Real radian_to_degree(Real r) {
  return (r * 180.0 / PI);
}

// 度数をラジアンに変換
Real degree_to_radian(Real d) {
  return (d * PI / 180.0);
}

// ∠BAC をラジアンで取得
Real get_angle(const Point &a, const Point &b, const Point &c) {
  const Point v(b - a), w(c - a);
  Real alpha = atan2(v.imag(), v.real()), beta = atan2(w.imag(), w.real());
  if(alpha > beta) swap(alpha, beta);
  Real theta = (beta - alpha);
  return min(theta, 2 * acos(-1) - theta);
}

// x軸, y軸の順にソート
namespace std {
  bool operator<(const Point &a, const Point &b) {
    return !eq(a.real(), b.real()) ? a.real() < b.real() : a.imag() < b.imag();
  }
}

// 直線
// 2 点を通る直線
// Ax + By = C  
struct Line {
  Point a, b;

  Line() = default;

  Line(Point a, Point b) : a(a), b(b) {}

  Line(Real A, Real B, Real C) // Ax + By = C
  {
    if(eq(A, 0)) a = Point(0, C / B), b = Point(1, C / B);
    else if(eq(B, 0)) b = Point(C / A, 0), b = Point(C / A, 1);
    else a = Point(0, C / B), b = Point(C / A, 0);
  }

  friend ostream &operator<<(ostream &os, Line &p) {
    return os << p.a << " to " << p.b;
  }

  friend istream &operator>>(istream &is, Line &a) {
    return is >> a.a >> a.b;
  }
};

// 線分
// 2 点を結ぶ
struct Segment : Line {
  Segment() = default;
  Segment(Point a, Point b) : Line(a, b) {}
};


// 円
// 中心と半径
struct Circle {
  Point p;
  Real r;

  Circle() = default;

  Circle(Point p, Real r) : p(p), r(r) {}
};

using Points = vector< Point >;
using Polygon = vector< Point >;   // 注意!! 凸多角形は反時計回りに与える.(保証されない場合は面積が負なら reverse をかける)
using Segments = vector< Segment >;
using Lines = vector< Line >;
using Circles = vector< Circle >;

// 外積
Real cross(const Point &a, const Point &b) {
  return real(a) * imag(b) - imag(a) * real(b);
}

// 内積
Real dot(const Point &a, const Point &b) {
  return real(a) * real(b) + imag(a) * imag(b);
}


//          +1
//          
//  +2   a   0   b  -2
//
//          -1
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_1_C&lang=jp
int ccw(const Point &a, Point b, Point c) {
  b = b - a, c = c - a;
  if(cross(b, c) > EPS) return +1;  // "COUNTER_CLOCKWISE"
  if(cross(b, c) < -EPS) return -1; // "CLOCKWISE"
  if(dot(b, c) < 0) return +2;      // "ONLINE_BACK"
  if(norm(b) < norm(c)) return -2;  // "ONLINE_FRONT"
  return 0;                         // "ON_SEGMENT"
}


// 2 直線が平行か
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_2_A
bool parallel(const Line &a, const Line &b) {
  return eq(cross(a.b - a.a, b.b - b.a), 0.0);
}

// 2 直線が垂直か
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_2_A
bool orthogonal(const Line &a, const Line &b) {
  return eq(dot(a.a - a.b, b.a - b.b), 0.0);
}

// 直線 l に 点 p から垂線を下ろして,交わる点を返す
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_1_A
Point projection(const Line &l, const Point &p) {
  double t = dot(p - l.a, l.a - l.b) / norm(l.a - l.b);
  return l.a + (l.a - l.b) * t;
}

// 同じ
// 直線として扱われそう
Point projection(const Segment &l, const Point &p) {
  double t = dot(p - l.a, l.a - l.b) / norm(l.a - l.b);
  return l.a + (l.a - l.b) * t;
}

// 直線 l に対して, 点 p と線対称な位置にある点を返す.
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_1_B
Point reflection(const Line &l, const Point &p) {
  return p + (projection(l, p) - p) * 2.0;
}

// 直線上に点が乗るかどうか
bool intersect(const Line &l, const Point &p) {
  return abs(ccw(l.a, l.b, p)) != 1;
}

// 直線 l と直線 m の交差判定
bool intersect(const Line &l, const Line &m) {
  return abs(cross(l.b - l.a, m.b - m.a)) > EPS || abs(cross(l.b - l.a, m.b - l.a)) < EPS;
}

// 線分上に点があるかどうか
bool intersect(const Segment &s, const Point &p) {
  return ccw(s.a, s.b, p) == 0;
}

// 直線 l と 線分 s の交差判定
bool intersect(const Line &l, const Segment &s) {
  return cross(l.b - l.a, s.a - l.a) * cross(l.b - l.a, s.b - l.a) < EPS;
}

// 点 p と 直線 l との距離
Real distance(const Line &l, const Point &p);

// 円 c と直線 l との交差判定
bool intersect(const Circle &c, const Line &l) {
  return distance(l, c.p) <= c.r + EPS;
}

// 点 p が 円 c 上にあるかどうか
bool intersect(const Circle &c, const Point &p) {
  return abs(abs(p - c.p) - c.r) < EPS;
}


// 線分同士の交差判定
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_2_B
bool intersect(const Segment &s, const Segment &t) {
  return ccw(s.a, s.b, t.a) * ccw(s.a, s.b, t.b) <= 0 && ccw(t.a, t.b, s.a) * ccw(t.a, t.b, s.b) <= 0;
}

// 円 c と 線分 l との交差判定
int intersect(const Circle &c, const Segment &l) {
  if(norm(projection(l, c.p) - c.p) - c.r * c.r > EPS) return 0;
  auto d1 = abs(c.p - l.a), d2 = abs(c.p - l.b);
  if(d1 < c.r + EPS && d2 < c.r + EPS) return 0;
  if(d1 < c.r - EPS && d2 > c.r + EPS || d1 > c.r + EPS && d2 < c.r - EPS) return 1;
  const Point h = projection(l, c.p);
  if(dot(l.a - h, l.b - h) < 0) return 2;
  return 0;
}

// 円同士の交差判定
// 4 := 離れている
// 3 := 外接する
// 2 := 交わる
// 1 := 内接する
// 0 := 内包する
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_7_A&lang=jp
int intersect(Circle c1, Circle c2) {
  if(c1.r < c2.r) swap(c1, c2);
  Real d = abs(c1.p - c2.p);
  if(c1.r + c2.r < d) return 4;
  if(eq(c1.r + c2.r, d)) return 3;
  if(c1.r - c2.r < d) return 2;
  if(eq(c1.r - c2.r, d)) return 1;
  return 0;
}

// 点と点の距離
Real distance(const Point &a, const Point &b) {
  return abs(a - b);
}

// 直線と点の距離
Real distance(const Line &l, const Point &p) {
  return abs(p - projection(l, p));
}

// 直線と直線の距離 (もちろん交わってたら 0)
Real distance(const Line &l, const Line &m) {
  return intersect(l, m) ? 0 : distance(l, m.a);
}

// 線分と点の距離
Real distance(const Segment &s, const Point &p) {
  Point r = projection(s, p);
  if(intersect(s, r)) return abs(r - p);
  return min(abs(s.a - p), abs(s.b - p));
}

// 線分同士の距離
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_2_D
Real distance(const Segment &a, const Segment &b) {
  if(intersect(a, b)) return 0;
  return min({distance(a, b.a), distance(a, b.b), distance(b, a.a), distance(b, a.b)});
}

// 直線と線分の距離
Real distance(const Line &l, const Segment &s) {
  if(intersect(l, s)) return 0;
  return min(distance(l, s.a), distance(l, s.b));
}

// 直線同士の交点を返す (交差することが要請されるのかな (事前にintersect を呼べばいい))
Point crosspoint(const Line &l, const Line &m) {
  Real A = cross(l.b - l.a, m.b - m.a);
  Real B = cross(l.b - l.a, l.b - m.a);
  if(eq(abs(A), 0.0) && eq(abs(B), 0.0)) return m.a;
  return m.a + (m.b - m.a) * B / A;
}

// 線分同士の交点を返す (交差することが要請されるのかな (事前にintersect を呼べばいい))
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_2_C
Point crosspoint(const Segment &l, const Segment &m) {
  return crosspoint(Line(l), Line(m));
}


// 円と直線の交点を返す (交差することが要請されるのかな (事前にintersect を呼べばいい))
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_7_D
pair< Point, Point > crosspoint(const Circle &c, const Line l) {
  Point pr = projection(l, c.p);
  Point e = (l.b - l.a) / abs(l.b - l.a);
  if(eq(distance(l, c.p), c.r)) return {pr, pr};
  double base = sqrt(c.r * c.r - norm(pr - c.p));
  return {pr - e * base, pr + e * base};
}


// 円と線分の交点を返す (交差することが要請されるのかな (事前にintersect を呼べばいい))
pair< Point, Point > crosspoint(const Circle &c, const Segment &l) {
  Line aa = Line(l.a, l.b);
  if(intersect(c, l) == 2) return crosspoint(c, aa);
  auto ret = crosspoint(c, aa);
  if(dot(l.a - ret.first, l.b - ret.first) < 0) ret.second = ret.first;
  else ret.first = ret.second;
  return ret;
}

// 円同士の交点を返す (交差することが要請されるのかな (事前にintersect を呼べばいい))
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_7_E
pair< Point, Point > crosspoint(const Circle &c1, const Circle &c2) {
  Real d = abs(c1.p - c2.p);
  Real a = acos((c1.r * c1.r + d * d - c2.r * c2.r) / (2 * c1.r * d));
  Real t = atan2(c2.p.imag() - c1.p.imag(), c2.p.real() - c1.p.real());
  Point p1 = c1.p + Point(cos(t + a) * c1.r, sin(t + a) * c1.r);
  Point p2 = c1.p + Point(cos(t - a) * c1.r, sin(t - a) * c1.r);
  return {p1, p2};
}

// 点 p から円 C へ接戦を引いた時の、接点を返す
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_7_F
pair< Point, Point > tangent(const Circle &c1, const Point &p2) {
  return crosspoint(c1, Circle(p2, sqrt(norm(c1.p - p2) - c1.r * c1.r)));
}

// 円と円の共通接線を複数返す
// 0 ~ 4 つの可能性がある
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_7_G
Lines tangent(Circle c1, Circle c2) {
  Lines ret;
  if(c1.r < c2.r) swap(c1, c2);
  Real g = norm(c1.p - c2.p);
  if(eq(g, 0)) return ret;
  Point u = (c2.p - c1.p) / sqrt(g);
  Point v = rotate(PI * 0.5, u);
  for(int s : {-1, 1}) {
    Real h = (c1.r + s * c2.r) / sqrt(g);
    if(eq(1 - h * h, 0)) {
      ret.emplace_back(c1.p + u * c1.r, c1.p + (u + v) * c1.r);
    } else if(1 - h * h > 0) {
      Point uu = u * h, vv = v * sqrt(1 - h * h);
      ret.emplace_back(c1.p + (uu + vv) * c1.r, c2.p - (uu + vv) * c2.r * s);
      ret.emplace_back(c1.p + (uu - vv) * c1.r, c2.p - (uu - vv) * c2.r * s);
    }
  }
  return ret;
}

// 多角形が凸かどうかを判定
// 与えられる多角形は反時計回りなことが要請される
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_3_B
bool is_convex(const Polygon &p) {
  int n = (int) p.size();
  for(int i = 0; i < n; i++) {
    if(ccw(p[(i + n - 1) % n], p[i], p[(i + 1) % n]) == -1) return false;
  }
  return true;
}

// 凸包に含まれる点上および辺上の頂点からなる多角形を返す.
// 多角形の開始位置は特に指定がない.
// 反時計回りに返されることは保証されていそう
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_4_A
Polygon convex_hull(Polygon &p) {
  int n = (int) p.size(), k = 0;
  if(n <= 2) return p;
  sort(p.begin(), p.end());
  vector< Point > ch(2 * n);
  for(int i = 0; i < n; ch[k++] = p[i++]) {
    while(k >= 2 && cross(ch[k - 1] - ch[k - 2], p[i] - ch[k - 1]) < 0) --k;
  }
  for(int i = n - 2, t = k + 1; i >= 0; ch[k++] = p[i--]) {
    while(k >= t && cross(ch[k - 1] - ch[k - 2], p[i] - ch[k - 1]) < 0) --k;
  }
  ch.resize(k - 1);
  return ch;
}

// 多角形 Q と点 p との関係を返す
// 0 := OUT
// 1 := ON
// 2 := IN
// 多角形は反時計回りに渡す
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_3_C
enum {
  OUT, ON, IN
};
int contains(const Polygon &Q, const Point &p) {
  bool in = false;
  for(int i = 0; i < Q.size(); i++) {
    Point a = Q[i] - p, b = Q[(i + 1) % Q.size()] - p;
    if(a.imag() > b.imag()) swap(a, b);
    if(a.imag() <= 0 && 0 < b.imag() && cross(a, b) < 0) in = !in;
    if(cross(a, b) == 0 && dot(a, b) <= 0) return ON;
  }
  return in ? IN : OUT;
}

// TODO よくわからん
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=1033
void merge_segments(vector< Segment > &segs) {

  auto merge_if_able = [](Segment &s1, const Segment &s2) {
    if(abs(cross(s1.b - s1.a, s2.b - s2.a)) > EPS) return false;
    if(ccw(s1.a, s2.a, s1.b) == 1 || ccw(s1.a, s2.a, s1.b) == -1) return false;
    if(ccw(s1.a, s1.b, s2.a) == -2 || ccw(s2.a, s2.b, s1.a) == -2) return false;
    s1 = Segment(min(s1.a, s2.a), max(s1.b, s2.b));
    return true;
  };

  for(int i = 0; i < segs.size(); i++) {
    if(segs[i].b < segs[i].a) swap(segs[i].a, segs[i].b);
  }
  for(int i = 0; i < segs.size(); i++) {
    for(int j = i + 1; j < segs.size(); j++) {
      if(merge_if_able(segs[i], segs[j])) {
        segs[j--] = segs.back(), segs.pop_back();
      }
    }
  }
}

// TODO よくわからん
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=1033
vector< vector< int > > segment_arrangement(vector< Segment > &segs, vector< Point > &ps) {
  vector< vector< int > > g;
  int N = (int) segs.size();
  for(int i = 0; i < N; i++) {
    ps.emplace_back(segs[i].a);
    ps.emplace_back(segs[i].b);
    for(int j = i + 1; j < N; j++) {
      const Point p1 = segs[i].b - segs[i].a;
      const Point p2 = segs[j].b - segs[j].a;
      if(cross(p1, p2) == 0) continue;
      if(intersect(segs[i], segs[j])) {
        ps.emplace_back(crosspoint(segs[i], segs[j]));
      }
    }
  }
  sort(begin(ps), end(ps));
  ps.erase(unique(begin(ps), end(ps)), end(ps));

  int M = (int) ps.size();
  g.resize(M);
  for(int i = 0; i < N; i++) {
    vector< int > vec;
    for(int j = 0; j < M; j++) {
      if(intersect(segs[i], ps[j])) {
        vec.emplace_back(j);
      }
    }
    for(int j = 1; j < vec.size(); j++) {
      g[vec[j - 1]].push_back(vec[j]);
      g[vec[j]].push_back(vec[j - 1]);
    }
  }
  return (g);
}


// 直線の進行方向の右側を残す
// Polygon は反時計回りに与える
// Line には一応向きがあるわけで
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_4_C
Polygon convex_cut(const Polygon &U, Line l) {
  Polygon ret;
  for(int i = 0; i < U.size(); i++) {
    Point now = U[i], nxt = U[(i + 1) % U.size()];
    if(ccw(l.a, l.b, now) != -1) ret.push_back(now);
    if(ccw(l.a, l.b, now) * ccw(l.a, l.b, nxt) < 0) {
      ret.push_back(crosspoint(Line(now, nxt), l));
    }
  }
  return (ret);
}


// 多角形の面積
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_3_A
Real area2(const Polygon &p) {
  Real A = 0;
  for(int i = 0; i < p.size(); ++i) {
    A += cross(p[i], p[(i + 1) % p.size()]);
  }
  return A;
}

// 多角形と円の共通部分の面積
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_7_H
Real area2(const Polygon &p, const Circle &c) {
  if(p.size() < 3) return 0.0;
  function< Real(Circle, Point, Point) > cross_area = [&](const Circle &c, const Point &a, const Point &b) {
    Point va = c.p - a, vb = c.p - b;
    Real f = cross(va, vb), ret = 0.0;
    if(eq(f, 0.0)) return ret;
    if(max(abs(va), abs(vb)) < c.r + EPS) return f;
    if(distance(Segment(a, b), c.p) > c.r - EPS) return c.r * c.r * arg(vb * conj(va));
    auto u = crosspoint(c, Segment(a, b));
    vector< Point > tot{a, u.first, u.second, b};
    for(int i = 0; i + 1 < tot.size(); i++) {
      ret += cross_area(c, tot[i], tot[i + 1]);
    }
    return ret;
  };
  Real A = 0;
  for(int i = 0; i < p.size(); i++) {
    A += cross_area(c, p[i], p[(i + 1) % p.size()]);
  }
  return A;
}

// 凸多角形 g の直径を求めよ。ただし、凸多角形の直径とはその最遠頂点対間距離のことである.
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_4_B
Real convex_diameter(const Polygon &p) {
  int N = (int) p.size();
  int is = 0, js = 0;
  for(int i = 1; i < N; i++) {
    if(p[i].imag() > p[is].imag()) is = i;
    if(p[i].imag() < p[js].imag()) js = i;
  }
  Real maxdis = norm(p[is] - p[js]);

  int maxi, maxj, i, j;
  i = maxi = is;
  j = maxj = js;
  do {
    if(cross(p[(i + 1) % N] - p[i], p[(j + 1) % N] - p[j]) >= 0) {
      j = (j + 1) % N;
    } else {
      i = (i + 1) % N;
    }
    if(norm(p[i] - p[j]) > maxdis) {
      maxdis = norm(p[i] - p[j]);
      maxi = i;
      maxj = j;
    }
  } while(i != is || j != js);
  return sqrt(maxdis);
}


// 平面上の n 個の点について、最も近い２点の距離.
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_5_A
Real closest_pair(Points ps) {
  if(ps.size() <= 1) throw (0);
  sort(begin(ps), end(ps));

  auto compare_y = [&](const Point &a, const Point &b) {
    return imag(a) < imag(b);
  };
  vector< Point > beet(ps.size());
  const Real INF = 1e18;

  function< Real(int, int) > rec = [&](int left, int right) {
    if(right - left <= 1) return INF;
    int mid = (left + right) >> 1;
    auto x = real(ps[mid]);
    auto ret = min(rec(left, mid), rec(mid, right));
    inplace_merge(begin(ps) + left, begin(ps) + mid, begin(ps) + right, compare_y);
    int ptr = 0;
    for(int i = left; i < right; i++) {
      if(abs(real(ps[i]) - x) >= ret) continue;
      for(int j = 0; j < ptr; j++) {
        auto luz = ps[i] - beet[ptr - j - 1];
        if(imag(luz) >= ret) break;
        ret = min(ret, abs(luz));
      }
      beet[ptr++] = ps[i];
    }
    return ret;
  };
  return rec(0, (int) ps.size());
}

signed main(){

    while(1){
        int n; cin >> n;
        if(n==0) break;
 
        Polygon p(n);
        for(int i = 0; i < n; i++){
            cin >> p[i];
        }

        double half = area2(p) / 2.0;
 
        double lb = 0;
        double ub = PI;
        if(half > area2(convex_cut(p, Line(Point(0,0), Point(100,0))))){
            lb = PI;
            ub = 2 * PI;
        }
        for(int i = 0; i < 100; i++){
            double mid = (lb +ub) / 2;
            Line cut(Point(0, 0), rotate(mid, Point(100, 0)));
            if(half > area2(convex_cut(p, cut))){
                ub = mid;
            }else{
                lb = mid;
            }
        }

        Point ans = rotate(lb, Point(100, 0));
    
        cout << fixed << setprecision(15);
        cout << ans.real() << " " << ans.imag() << endl;
    }
    return 0;
}
accuracy: 1
time_ms: 50
memory_kb: 3692
final_rank: 8

code_snippet: #include <iostream>
#include <vector>
#include <utility>
#include <complex>
#include <cassert>
using namespace std;
using W = long double;
using P = complex<W>;
using Poly = vector<P>;
using L = pair<P,P>;
#define X real()
#define Y imag()
constexpr W EPS = 1e-10, pi = acos(-1);

void debug(Poly p){
  cerr << "Polygon" << endl;
  for(auto e : p) cerr << e.X << " " << e.Y << endl;
  cerr << "..." << endl;
}

void debug(L l){
  fprintf(stderr,"Segment %Lf %Lf %Lf %Lf\n",l.first.X,l.first.Y,l.second.X,l.second.Y);
}

W dot(const P &a, const P &b){ return a.X*b.X + a.Y*b.Y; }
W cross(const P &a, const P &b){ return a.X*b.Y - a.Y*b.X; }

P intersection(const L &a, const L &b){
  P af = a.first, as = a.second, bf = b.first, bs = b.second;
  return af + cross(bs-bf,af-bf)/(-cross(bs-bf,as-bf)+cross(bs-bf,af-bf))*(as-af);
}

int ccw(P a, P b, P c){
  b -= a, c -= a;
  if(cross(b,c) > +EPS) return +1;
  if(cross(b,c) < -EPS) return -1;
  if(dot(b,c) < +EPS) return +2;
  if(norm(b) + EPS < norm(c)) return -2;
  return 0;
}

Poly convex_cut(const Poly &p, const L &l){
  Poly ret;
  int n = p.size();
  for(int i = 0; i < n; ++i){
    P cur = p[i], nex = p[(i+1)%n], lf = l.first, ls = l.second;
    if(ccw(lf,ls,cur) != -1)
      ret.push_back(cur);
    if((ccw(lf,ls,cur) != -1) ^ (ccw(lf,ls,nex) != -1))
      ret.push_back(intersection(L(cur,nex),l));
  }
  return ret;
}

W area(const Poly &p){
  int n = p.size();
  W ret = 0;
  for(int i = 0; i < n; ++i){
    ret += cross(p[i],p[(i+1)%n]);
  }
  return ret/2;
}

int main(){
  int N;
  while(cin >> N, N){
    Poly pol;
    for(int i = 0; i < N; ++i){
      W x, y;
      cin >> x >> y;
      pol.emplace_back(x,y);
    }
    W ok = 0, ng = pi, S = area(pol);
    for(int i = 1; i < N; ++i){
      L l1(P(0,0),pol[i]);
      L l2(P(0,0),pol[i-1]);
      W s1 = area(convex_cut(pol,l1));
      W s2 = area(convex_cut(pol,l2));
      W d1 = (s1 - (S-s1));
      W d2 = (s2 - (S-s2));
      if(d1 <= 0 and d2 >= 0){
        ng = arg(pol[i]);
        ok = arg(pol[i-1]);
        if(ng < ok) ng += 2*pi;
        ng += EPS;
        ok -= EPS;
        break;
      }
    }
    assert(abs(ok) > EPS or abs(ng-pi) > EPS);
    for(int tmp = 0; tmp < 10000; ++tmp){
      W m = (ok+ng)/2;
      L l(P(0,0),P(10,0)*P(cos(m),sin(m)));
      W s = area(convex_cut(pol,l));
      if(s > S-s){
        ok = m;
      }else{
        ng = m;
      }
    }
    W a = (ok+ng)/2;
    P A = P(10*cos(a),10*sin(a));
    W s = area(convex_cut(pol,L(P(0,0),A)));
    //assert(abs(s-(S-s)) <= 1e-5);
    //fprintf(stderr,"%.12Lf : %.12Lf\n",s,S-s);
    printf("%.15Lf %.15Lf\n",A.X,A.Y);
  }
}
accuracy: 0.125
time_ms: 10
memory_kb: 3376
final_rank: 20

code_snippet: #include <iostream>
#include <vector>
#include <utility>
#include <complex>
#include <cassert>
using namespace std;
using W = long double;
using P = complex<W>;
using Poly = vector<P>;
using L = pair<P,P>;
#define X real()
#define Y imag()
constexpr W EPS = 1e-10, pi = acos(-1);

void debug(Poly p){
  cerr << "Polygon" << endl;
  for(auto e : p) cerr << e.X << " " << e.Y << endl;
  cerr << "..." << endl;
}

void debug(L l){
  fprintf(stderr,"Segment %Lf %Lf %Lf %Lf\n",l.first.X,l.first.Y,l.second.X,l.second.Y);
}

W dot(const P &a, const P &b){ return a.X*b.X + a.Y*b.Y; }
W cross(const P &a, const P &b){ return a.X*b.Y - a.Y*b.X; }

P intersection(const L &a, const L &b){
  P af = a.first, as = a.second, bf = b.first, bs = b.second;
  return af + cross(bs-bf,af-bf)/(-cross(bs-bf,as-bf)+cross(bs-bf,af-bf))*(as-af);
}

int ccw(P a, P b, P c){
  b -= a, c -= a;
  if(cross(b,c) > +EPS) return +1;
  if(cross(b,c) < -EPS) return -1;
  if(dot(b,c) < +EPS) return +2;
  if(norm(b) + EPS < norm(c)) return -2;
  return 0;
}

Poly convex_cut(const Poly &p, const L &l){
  Poly ret;
  int n = p.size();
  for(int i = 0; i < n; ++i){
    P cur = p[i], nex = p[(i+1)%n], lf = l.first, ls = l.second;
    if(ccw(lf,ls,cur) != -1)
      ret.push_back(cur);
    if((ccw(lf,ls,cur) != -1) ^ (ccw(lf,ls,nex) != -1))
      ret.push_back(intersection(L(cur,nex),l));
  }
  return ret;
}

W area(const Poly &p){
  int n = p.size();
  W ret = 0;
  for(int i = 0; i < n; ++i){
    ret += cross(p[i],p[(i+1)%n]);
  }
  return ret/2;
}

int main(){
  int N;
  while(cin >> N, N){
    Poly pol;
    for(int i = 0; i < N; ++i){
      W x, y;
      cin >> x >> y;
      pol.emplace_back(x,y);
    }
    W ok = 0, ng = pi, S = area(pol);
    for(int i = 1; i < N; ++i){
      L l1(P(0,0),pol[i]);
      L l2(P(0,0),pol[i-1]);
      W s1 = area(convex_cut(pol,l1));
      W s2 = area(convex_cut(pol,l2));
      W d1 = (s1 - (S-s1));
      W d2 = (s2 - (S-s2));
      if(d1 <= 0 and d2 >= 0){
        ng = arg(pol[i]);
        ok = arg(pol[i-1]);
        if(ng < ok) ng += 2*pi;
        break;
      }
    }
    for(int tmp = 0; tmp < 10000; ++tmp){
      W m = (ok+ng)/2;
      L l(P(0,0),P(10,0)*P(cos(m),sin(m)));
      W s = area(convex_cut(pol,l));
      if(s >= S-s){
        ok = m;
      }else{
        ng = m;
      }
    }
    W a = (ok+ng)/2;
    P A = P(10*cos(a),10*sin(a));
    W s = area(convex_cut(pol,L(P(0,0),A)));
    assert(abs(s-(S-s)) <= 1e-5);
    //fprintf(stderr,"%.12Lf : %.12Lf\n",s,S-s);
    printf("%.15Lf %.15Lf\n",A.X,A.Y);
  }
}
accuracy: 0.25
time_ms: 10
memory_kb: 3512
final_rank: 12

code_snippet: #include <iostream>
#include <vector>
#include <utility>
#include <complex>
#include <cassert>
using namespace std;
using W = long double;
using P = complex<W>;
using Poly = vector<P>;
using L = pair<P,P>;
#define X real()
#define Y imag()
constexpr W EPS = 1e-10, pi = acos(-1);

void debug(Poly p){
  cerr << "Polygon" << endl;
  for(auto e : p) cerr << e.X << " " << e.Y << endl;
  cerr << "..." << endl;
}

void debug(L l){
  fprintf(stderr,"Segment %Lf %Lf %Lf %Lf\n",l.first.X,l.first.Y,l.second.X,l.second.Y);
}

W dot(const P &a, const P &b){ return a.X*b.X + a.Y*b.Y; }
W cross(const P &a, const P &b){ return a.X*b.Y - a.Y*b.X; }

P intersection(const L &a, const L &b){
  P af = a.first, as = a.second, bf = b.first, bs = b.second;
  return af + cross(bs-bf,af-bf)/(-cross(bs-bf,as-bf)+cross(bs-bf,af-bf))*(as-af);
}

int ccw(P a, P b, P c){
  b -= a, c -= a;
  if(cross(b,c) > +EPS) return +1;
  if(cross(b,c) < -EPS) return -1;
  if(dot(b,c) < +EPS) return +2;
  if(norm(b) + EPS < norm(c)) return -2;
  return 0;
}

Poly convex_cut(const Poly &p, const L &l){
  Poly ret;
  int n = p.size();
  for(int i = 0; i < n; ++i){
    P cur = p[i], nex = p[(i+1)%n], lf = l.first, ls = l.second;
    if(ccw(lf,ls,cur) != -1)
      ret.push_back(cur);
    if((ccw(lf,ls,cur) != -1) ^ (ccw(lf,ls,nex) != -1))
      ret.push_back(intersection(L(cur,nex),l));
  }
  return ret;
}

W area(const Poly &p){
  int n = p.size();
  W ret = 0;
  for(int i = 0; i < n; ++i){
    ret += cross(p[i],p[(i+1)%n]);
  }
  return ret/2;
}

int main(){
  int N;
  while(cin >> N, N){
    Poly pol;
    for(int i = 0; i < N; ++i){
      W x, y;
      cin >> x >> y;
      pol.emplace_back(x,y);
    }
    W ok = 0, ng = pi, S = area(pol);
    for(int i = 1; i < N; ++i){
      L l1(P(0,0),pol[i]);
      L l2(P(0,0),pol[i-1]);
      W s1 = area(convex_cut(pol,l1));
      W s2 = area(convex_cut(pol,l2));
      W d1 = (s1 - (S-s1));
      W d2 = (s2 - (S-s2));
      if(d1 <= 0 and d1*d2 < EPS){
        ng = arg(pol[i]);
        ok = arg(pol[i-1]);
        if(ng < ok) ng += 2*pi;
        break;
      }
    }
    for(int tmp = 0; tmp < 10000; ++tmp){
      W m = (ok+ng)/2;
      L l(P(0,0),P(10,0)*P(cos(m),sin(m)));
      W s = area(convex_cut(pol,l));
      if(s >= S-s){
        ok = m;
      }else{
        ng = m;
      }
    }
    W a = (ok+ng)/2;
    P A = P(10,0)*P(cos(a),sin(a));
    W s = area(convex_cut(pol,L(P(0,0),A)));
    assert(abs(s-(S-s)) < 1e-5);
    //fprintf(stderr,"%.12Lf : %.12Lf\n",s,S-s);
    printf("%.15Lf %.15Lf\n",A.X,A.Y);
  }
}
accuracy: 0.25
time_ms: 10
memory_kb: 3556
final_rank: 13

code_snippet: #include <iostream>
#include <vector>
#include <utility>
#include <complex>
#include <cassert>
using namespace std;
using W = long double;
using P = complex<W>;
using Poly = vector<P>;
using L = pair<P,P>;
#define X real()
#define Y imag()
constexpr W EPS = 1e-10, pi = acos(-1);

void debug(Poly p){
  cerr << "Polygon" << endl;
  for(auto e : p) cerr << e.X << " " << e.Y << endl;
  cerr << "..." << endl;
}

void debug(L l){
  fprintf(stderr,"Segment %Lf %Lf %Lf %Lf\n",l.first.X,l.first.Y,l.second.X,l.second.Y);
}

W dot(const P &a, const P &b){ return a.X*b.X + a.Y*b.Y; }
W cross(const P &a, const P &b){ return a.X*b.Y - a.Y*b.X; }

P intersection(const L &a, const L &b){
  P af = a.first, as = a.second, bf = b.first, bs = b.second;
  return af + cross(bs-bf,af-bf)/(-cross(bs-bf,as-bf)+cross(bs-bf,af-bf))*(as-af);
}

int ccw(P a, P b, P c){
  b -= a, c -= a;
  if(cross(b,c) > +EPS) return +1;
  if(cross(b,c) < -EPS) return -1;
  if(dot(b,c) < +EPS) return +2;
  if(norm(b) + EPS < norm(c)) return -2;
  return 0;
}

Poly convex_cut(const Poly &p, const L &l){
  Poly ret;
  int n = p.size();
  for(int i = 0; i < n; ++i){
    P cur = p[i], nex = p[(i+1)%n], lf = l.first, ls = l.second;
    if(ccw(lf,ls,cur) != -1)
      ret.push_back(cur);
    if((ccw(lf,ls,cur) != -1) ^ (ccw(lf,ls,nex) != -1))
      ret.push_back(intersection(L(cur,nex),l));
  }
  return ret;
}

W area(const Poly &p){
  int n = p.size();
  W ret = 0;
  for(int i = 0; i < n; ++i){
    ret += cross(p[i],p[(i+1)%n]);
  }
  return ret/2;
}

int main(){
  int N;
  while(cin >> N, N){
    Poly pol;
    for(int i = 0; i < N; ++i){
      W x, y;
      cin >> x >> y;
      pol.emplace_back(x,y);
    }
    W ok = 0, ng = pi, S = area(pol);
    for(int i = 1; i < N; ++i){
      L l1(P(0,0),pol[i]);
      L l2(P(0,0),pol[i-1]);
      W s1 = area(convex_cut(pol,l1));
      W s2 = area(convex_cut(pol,l2));
      W d1 = (s1 - (S-s1));
      W d2 = (s2 - (S-s2));
      if(d1 <= 0 and d1*d2 < EPS){
        ok = arg(pol[i]);
        ng = arg(pol[i-1]);
        if(ok > ng) swap(ok,ng);
        break;
      }
    }
    for(int tmp = 0; tmp < 10000; ++tmp){
      W m = (ok+ng)/2;
      L l(P(0,0),P(10,0)*P(cos(m),sin(m)));
      W s = area(convex_cut(pol,l));
      if(s >= S-s){
        ok = m;
      }else{
        ng = m;
      }
    }
    W a = (ok+ng)/2;
    P A = P(10,0)*P(cos(a),sin(a));
    W s = area(convex_cut(pol,L(P(0,0),A)));
    assert(abs(s-(S-s)) < 1e-5);
    //fprintf(stderr,"%.12Lf : %.12Lf\n",s,S-s);
    printf("%.15Lf %.15Lf\n",A.X,A.Y);
  }
}
accuracy: 0.25
time_ms: 10
memory_kb: 3604
final_rank: 15

code_snippet: #include <iostream>
#include <vector>
#include <utility>
#include <complex>
using namespace std;
using W = long double;
using P = complex<W>;
using Poly = vector<P>;
using L = pair<P,P>;
#define X real()
#define Y imag()
constexpr W EPS = 1e-10, pi = acos(-1);

void debug(Poly p){
  cerr << "Polygon" << endl;
  for(auto e : p) cerr << e.X << " " << e.Y << endl;
  cerr << "..." << endl;
}

void debug(L l){
  fprintf(stderr,"Segment %Lf %Lf %Lf %Lf\n",l.first.X,l.first.Y,l.second.X,l.second.Y);
}

W dot(const P &a, const P &b){ return a.X*b.X + a.Y*b.Y; }
W cross(const P &a, const P &b){ return a.X*b.Y - a.Y*b.X; }

P intersection(const L &a, const L &b){
  P af = a.first, as = a.second, bf = b.first, bs = b.second;
  return af + cross(bs-bf,af-bf)/(-cross(bs-bf,as-bf)+cross(bs-bf,af-bf))*(as-af);
}

int ccw(P a, P b, P c){
  b -= a, c -= a;
  if(cross(b,c) > +EPS) return +1;
  if(cross(b,c) < -EPS) return -1;
  if(dot(b,c) < +EPS) return +2;
  if(norm(b) + EPS < norm(c)) return -2;
  return 0;
}

Poly convex_cut(const Poly &p, const L &l){
  Poly ret;
  int n = p.size();
  for(int i = 0; i < n; ++i){
    P cur = p[i], nex = p[(i+1)%n], lf = l.first, ls = l.second;
    if(ccw(lf,ls,cur) != -1)
      ret.push_back(cur);
    if((ccw(lf,ls,cur) != -1) ^ (ccw(lf,ls,nex) != -1))
      ret.push_back(intersection(L(cur,nex),l));
  }
  return ret;
}

W area(const Poly &p){
  int n = p.size();
  W ret = 0;
  for(int i = 0; i < n; ++i){
    ret += cross(p[i],p[(i+1)%n]);
  }
  return ret/2;
}

int main(){
  int N;
  while(cin >> N, N){
    Poly pol;
    for(int i = 0; i < N; ++i){
      W x, y;
      cin >> x >> y;
      pol.emplace_back(x,y);
    }
    W ok = 0, ng = pi, S = area(pol);
    for(int i = 1; i < N; ++i){
      L l1(P(0,0),pol[i]);
      L l2(P(0,0),pol[i-1]);
      W s1 = area(convex_cut(pol,l1));
      W s2 = area(convex_cut(pol,l2));
      W d1 = (s1 - (S-s1));
      W d2 = (s2 - (S-s2));
      if(d1 <= 0 and d1*d2 < EPS){
        ok = arg(pol[i]);
        ng = arg(pol[i-1]);
        if(ok > ng) swap(ok,ng);
        break;
      }
    }
    for(int tmp = 0; tmp < 1000; ++tmp){
      W m = (ok+ng)/2;
      L l(P(0,0),P(10,0)*P(cos(m),sin(m)));
      W s = area(convex_cut(pol,l));
      if(s > S-s){
        ok = m;
      }else{
        ng = m;
      }
    }
    W a = (ok+ng)/2;
    P A = P(10,0)*P(cos(a),sin(a));
    W s = area(convex_cut(pol,L(P(0,0),A)));
    //fprintf(stderr,"%.12Lf : %.12Lf\n",s,S-s);
    printf("%.15Lf %.15Lf\n",A.X,A.Y);
  }
}
accuracy: 0.25
time_ms: 750
memory_kb: 3520
final_rank: 18

code_snippet: #include <bits/stdc++.h>
using namespace std;

#ifdef LOCAL
#include "../dump.hpp"
#else
#define dump(...)
#endif

#define rep(i,n) for(int i=0,i##_cond=(n);i<i##_cond;++i)

const double EPS = 1e-10;
// 点
typedef complex<double> P;
// 外積
double cross(const P& a, const P& b) {
  return imag(conj(a)*b);
}
// 内積
double dot(const P& a, const P& b) {
  return real(conj(a)*b);
}

// 直線
struct L : public vector<P> {
  L(const P &a, const P &b) {
    push_back(a); push_back(b);
  }
};

// 多角形
typedef vector<P> G;

// 入力
G g;

int ccw(P a, P b, P c) {
  b -= a; c -= a;
  if (cross(b, c) > 0)   return +1;       // 反時計周り
  if (cross(b, c) < 0)   return -1;       // 時計回り
  if (dot(b, c) < 0)     return +2;       // c--a--b の順に一直線
  if (norm(b) < norm(c)) return -2;       // a--b--c の順に一直線
  return 0;
}

P crosspoint(const L &l, const L &m) {
  double A = cross(l[1] - l[0], m[1] - m[0]);
  double B = cross(l[1] - l[0], l[1] - m[0]);
  if (abs(A) < EPS && abs(B) < EPS) return m[0];
  if (abs(A) < EPS) assert(false);
  return m[0] + B / A * (m[1] - m[0]);
}

G convex_cut(const G& Poly, const L& l) {
  G Q;
  for (int i = 0; i < Poly.size(); ++i) {
    P A = Poly[i], B = Poly[(i+1)%Poly.size()];
    if (ccw(l[0], l[1], A) != -1) Q.push_back(A);
    if (ccw(l[0], l[1], A)*ccw(l[0], l[1], B) < 0)
      Q.push_back(crosspoint(L(A, B), l));
  }
  return Q;
}

double area2(const G& poly) {
  double A = 0;
  for (int i = 0; i < poly.size(); ++i) 
    A += cross(poly[i], poly[(i+1)%poly.size()]);
  return A;
}

double a; // 面積の半分

// 面積が半分以下の時okとする
bool solve(double deg){
  P zero(0,0);
  P t(sin(deg),cos(deg));
  t *= 100;
  L l(zero,t);
  G f = convex_cut(g,l);
  dump(a, area2(f));
  if(area2(f) - 1e-5 < a) return true;
  else return false;
}

double bs(double _ok, double _ng){
  double ok = _ok;
  double ng = _ng;

  while(abs(ok - ng) > 1e-15){
    double mid = (ok + ng) / 2;
    if(solve(mid)){
      ok = mid;
    }else{
      ng = mid;
    }
  }
  return ok;
}

signed main(){
  int n;
  P zero(0,0);
  while(cin >> n, n){
    g.clear(); g.resize(n);
    rep(i,n){
      double x, y; cin >> x >> y;
      g[i] = {x, y};
    }
    a = area2(g)/2;
    // dump(a);
    double ok = 0, ng = M_PI;
    if(solve(ok) == false) swap(ok, ng);
    //dump(ok,ng);
    double ans = bs(ok,ng);
    P t(sin(ans),cos(ans));
    t *= 100;
    dump("hoge");
    solve(ans);
    printf("%.15f %.15f\n",real(t),imag(t));
  }
}
accuracy: 0.25
time_ms: 30
memory_kb: 3572
final_rank: 14

code_snippet: using namespace std;
#include<iostream>
#include<algorithm>
#include<vector>
#include<cmath>
#include<iomanip>
const double EPS=1e-10;
bool eq(double a,double b){return abs(a-b)<EPS;}
struct Point{
	double x,y;
	Point(double x_=0,double y_=0):x(x_),y(y_){}
	Point operator-()const{return Point(-x,-y);}
	Point operator+(const Point&p)const{return Point(x+p.x,y+p.y);}
	Point operator-(const Point&p)const{return Point(x-p.x,y-p.y);}
	Point operator*(const double k)const{return Point(x*k,y*k);}
	Point operator/(const double k)const{return Point(x/k,y/k);}
	bool operator<(const Point&p)const{return eq(x,p.x)?y<p.y:x<p.x;}
	bool operator==(const Point&p)const{return eq(x,p.x)&&eq(y,p.y);}
};
istream&operator>>(istream&is,Point&p){return is>>p.x>>p.y;}
ostream&operator<<(ostream&os,const Point&p){return os<<fixed<<setprecision(9)<<p.x<<' '<<p.y;}
struct Line{
	Point p1,p2;
	Line(Point p1_=Point(),Point p2_=Point()):p1(p1_),p2(p2_){}
};
struct Segment:Line{
	Segment(Point p1_=Point(),Point p2_=Point()):Line(p1_,p2_){}
};
struct Circle{
	Point o;
	double r;
	Circle(Point o_=Point(),double r_=0):o(o_),r(r_){}
};
using Polygon=vector<Point>;
//function list begin
Point vec(const Line&);
double norm(const Point&);
double norm(const Line&);
double abs(const Point&);
double abs(const Line&);
double arg(const Point&);
double arg(const Line&);
double arg(const Point&,const Point&,const Point&);//a->b->c
double dot(const Point&,const Point&);
double cross(const Point&,const Point&);
Point polar(const double,const double);
Point rotate(const Point&,const double);
enum{ONLINE_FRONT=-2,CLOCKWISE=-1,ON_SEGMENT=0,COUNTER_CLOCKWISE=1,ONLINE_BACK=2};
int ccw(const Point&,const Point&,const Point&);
int ccw(const Line&,const Point&);
bool orthogonal(const Point&,const Point&);
bool orthogonal(const Line&,const Line&);
bool parallel(const Point&,const Point&);
bool parallel(const Line&,const Line&);
bool intersect(const Line&,const Point&);
bool intersect(const Line&,const Line&);
bool intersect(const Segment&,const Point&);
bool intersect(const Segment&,const Segment&);
bool intersect(const Line&,const Segment&);
bool intersect(const Segment&,const Line&);
bool intersect(const Circle&,const Point&);
int intersect(const Circle&,const Line&);//count contacts
int intersect(const Circle&,const Segment&);
int intersect(const Circle&,const Circle&);
double distance(const Point&,const Point&);
double distance(const Line&,const Point&);
double distance(const Line&,const Line&);
double distance(const Segment&,const Point&);
double distance(const Segment&,const Segment&);
double distance(const Line&,const Segment&);
double distance(const Segment&,const Line&);
double distance(const Circle&,const Point&);
double distance(const Circle&,const Line&);
double distance(const Circle&,const Segment&);
double distance(const Circle&,const Circle&);
Point projection(const Line&,const Point&);
Point reflection(const Line&,const Point&);
Point crosspoint(const Line&,const Line&);
pair<Point,Point>crosspoint(const Circle&,const Line&);
pair<Point,Point>crosspoint(const Circle&,const Segment&);
pair<Point,Point>crosspoint(const Circle&,const Circle&);
pair<Point,Point>tangent(const Circle&,const Point&);
vector<Line>tangent(const Circle&,const Circle&);
bool is_convex(const Polygon&);
Polygon convex_full(Polygon,bool=false);
enum{OUT,ON,IN};
int contain(const Polygon&,const Point&);
int contain(const Circle&,const Point&);
int contain(const Circle&,const Segment&);
Polygon convex_cut(const Polygon&,const Line&);
double diameter(Polygon);
double area(const Polygon&);
double area(const Polygon&,const Line&);
double area(const Polygon&,const Circle&);
//function list end
Point vec(const Line&s){return s.p2-s.p1;}
double norm(const Point&p){return p.x*p.x+p.y*p.y;}
double norm(const Line&s){return norm(vec(s));}
double abs(const Point&p){return hypot(p.x,p.y);}
double abs(const Line&s){return abs(vec(s));}
double arg(const Point&p){return atan2(p.y,p.x);}
double arg(const Line&s){return arg(vec(s));}
double arg(const Point&a,const Point&b,const Point&c){
	double A=arg(b-a),B=arg(c-b);
	double theta=abs(A-B);
	return min(theta,2*M_PI-theta);
}
double dot(const Point&a,const Point&b){return a.x*b.x+a.y*b.y;}
double cross(const Point&a,const Point&b){return a.x*b.y-a.y*b.x;}
Point polar(const double r,const double theta){return Point(cos(theta),sin(theta))*r;}
Point rotate(const Point&p,const double theta){
	return Point(p.x*cos(theta)-p.y*sin(theta),p.x*sin(theta)+p.y*cos(theta));
}
int ccw(const Point&a,const Point&b,const Point&c){
	Point p=b-a,q=c-a;
	return cross(p,q)>EPS?COUNTER_CLOCKWISE
		:cross(p,q)<-EPS?CLOCKWISE
		:dot(p,q)<0?ONLINE_BACK
		:norm(p)<norm(q)?ONLINE_FRONT
		:ON_SEGMENT;
}
int ccw(const Line&s,const Point&p){return ccw(s.p1,s.p2,p);}
bool orthogonal(const Point&a,const Point&b){return eq(dot(a,b),0);}
bool orthogonal(const Line&s,const Line&t){return orthogonal(vec(s),vec(t));}
bool parallel(const Point&a,const Point&b){return eq(cross(a,b),0);}
bool parallel(const Line&s,const Line&t){return parallel(vec(s),vec(t));}
bool intersect(const Line&s,const Point&p){return eq(cross(vec(s),p-s.p1),0);}
bool intersect(const Line&s,const Line&t){return !parallel(s,t)||intersect(s,t.p1);}
bool intersect(const Segment&s,const Point&p){return ccw(s,p)==ON_SEGMENT;}
bool intersect(const Segment&s,const Segment&t){
	return ccw(s,t.p1)*ccw(s,t.p2)<=0&&ccw(t,s.p1)*ccw(t,s.p2)<=0;
}
bool intersect(const Line&s,const Segment&t){
	return cross(vec(s),t.p1-s.p1)*cross(vec(s),t.p2-s.p1)<EPS;
}
bool intersect(const Segment&s,const Line&t){return intersect(t,s);}
bool intersect(const Circle&c,const Point&p){return eq(distance(c.o,p),c.r);}
int intersect(const Circle&c,const Line&s){
	double d=distance(s,c.o);
	return eq(d,c.r)?1:d<c.r?2:0;
}
int intersect(const Circle&c,const Segment&s){
	Point h=projection(s,c.o);
	double d1=distance(c.o,s.p1),d2=distance(c.o,s.p2);
	return distance(c.o,h)>c.r+EPS?0
		:d1<c.r-EPS&&d2<c.r-EPS?0
		:d1<c.r-EPS&&d2>c.r-EPS||d1>c.r-EPS&&d2<c.r-EPS?1
		:intersect(s,h)?eq(distance(c.o,h),c.r)?1:2
		:0;
}
int intersect(const Circle&a,const Circle&b){
	double d=distance(a.o,b.o);
	return eq(d,a.r+b.r)?3:d>a.r+b.r?4:eq(d,abs(a.r-b.r))?1:d>abs(a.r-b.r)?2:0;
}
double distance(const Point&a,const Point&b){return abs(a-b);}
double distance(const Line&s,const Point&p){return distance(p,projection(s,p));}
double distance(const Line&s,const Line&t){return intersect(s,t)?0:distance(s,t.p1);}
double distance(const Segment&s,const Point&p){
	return distance(p,
		dot(vec(s),p-s.p1)<0?s.p1
		:dot(-vec(s),p-s.p2)<0?s.p2
		:projection(s,p)
	);
}
double distance(const Segment&s,const Segment&t){
	return intersect(s,t)?0:min({
		distance(s,t.p1),distance(s,t.p2),
		distance(t,s.p1),distance(t,s.p2)
	});
}
double distance(const Line&s,const Segment&t){
	return intersect(s,t)?0:min(distance(s,t.p1),distance(s,t.p2));
}
double distance(const Segment&s,const Line&t){return distance(t,s);}
double distance(const Circle&c,const Point&p){return abs(distance(c.o,p)-c.r);}
double distance(const Circle&c,const Line&s){return max(distance(s,c.o)-c.r,0.);}
double distance(const Circle&c,const Segment&s){
	return intersect(c,s)?0
		:contain(c,s)?c.r-max(distance(c.o,s.p1),distance(c.o,s.p2))
		:distance(s,c.o)-c.r;
}
double distance(const Circle&a,const Circle&b){return max(distance(a.o,b.o)-a.r-b.r,0.);}
Point projection(const Line&s,const Point&p){
	return s.p1+vec(s)*dot(p-s.p1,vec(s))/norm(s);
}
Point reflection(const Line&s,const Point&p){return projection(s,p)*2-p;}
Point crosspoint(const Line&s,const Line&t){
	double d1=abs(cross(vec(s),t.p1-s.p1));
	double d2=abs(cross(vec(s),t.p2-s.p1));
	return t.p1+vec(t)*(d1/(d1+d2));
}
pair<Point,Point>crosspoint(const Circle&c,const Line&s){
	Point h=projection(s,c.o);
	Point e=vec(s)/abs(s)*sqrt(c.r*c.r-norm(h-c.o));
	return minmax(h-e,h+e);
}
pair<Point,Point>crosspoint(const Circle&c,const Segment&s){
	pair<Point,Point>p=crosspoint(c,Line(s));
	return intersect(c,s)==2?p
		:intersect(s,p.first)?make_pair(p.first,p.first)
		:make_pair(p.second,p.second);
}
pair<Point,Point>crosspoint(const Circle&a,const Circle&b){
	double d=distance(a.o,b.o);
	double alpha=acos((a.r*a.r+d*d-b.r*b.r)/(2*a.r*d));
	double theta=arg(b.o-a.o);
	return minmax(a.o+polar(a.r,theta+alpha),a.o+polar(a.r,theta-alpha));
}
pair<Point,Point>tangent(const Circle&c,const Point&p){
	return crosspoint(c,Circle(p,sqrt(norm(c.o-p)-c.r*c.r)));
}
vector<Line>tangent(const Circle&a,const Circle&b){
	vector<Line>ret;
	double g=distance(a.o,b.o);
	if(eq(g,0))return ret;
	Point u=(b.o-a.o)/g;
	Point v=rotate(u,M_PI/2);
	for(int s:{-1,1}){
		double h=(a.r+b.r*s)/g;
		if(eq(h*h,1))ret.emplace_back(a.o+(h>0?u:-u)*a.r,a.o+(h>0?u:-u)*a.r+v);
		else if(1-h*h>0){
			Point U=u*h,V=v*sqrt(1-h*h);
			ret.emplace_back(a.o+(U+V)*a.r,b.o-(U+V)*b.r*s);
			ret.emplace_back(a.o+(U-V)*a.r,b.o-(U-V)*b.r*s);
		}
	}
	return ret;
}
bool is_convex(const Polygon&P){
	for(int i=0;i<P.size();i++)
		if(ccw(P[i],P[(i+1)%P.size()],P[(i+2)%P.size()])==CLOCKWISE)return false;
	return true;
}
Polygon convex_full(Polygon P,bool ONSEG){
	if(P.size()<=2)return P;
	sort(P.begin(),P.end());
	Polygon ret(2*P.size());
	int k=0,t;
	if(ONSEG){
		for(const Point&p:P){
			while(k>=2&&ccw(ret[k-2],ret[k-1],p)==CLOCKWISE)k--;
			ret[k++]=p;
		}
		t=k;
		for(int i=P.size()-2;i>=0;i--){
			while(k>=t+1&&ccw(ret[k-2],ret[k-1],P[i])==CLOCKWISE)k--;
			ret[k++]=P[i];
		}
	}
	else{
		for(const Point&p:P){
			while(k>=2&&ccw(ret[k-2],ret[k-1],p)!=COUNTER_CLOCKWISE)k--;
			ret[k++]=p;
		}
		t=k;
		for(int i=P.size()-2;i>=0;i--){
			while(k>=t+1&&ccw(ret[k-2],ret[k-1],P[i])!=COUNTER_CLOCKWISE)k--;
			ret[k++]=P[i];
		}
	}
	ret.resize(k-1);
	int mi=0;
	for(int i=1;i<k-1;i++)
		if(eq(ret[mi].y,ret[i].y)?ret[mi].x>ret[i].x:ret[mi].y>ret[i].y)mi=i;
	rotate(ret.begin(),ret.begin()+mi,ret.end());
	return ret;
}
int contain(const Polygon&P,const Point&p){
	bool in=false;
	for(int i=0;i<P.size();i++){
		Segment s(P[i],P[(i+1)%P.size()]);
		if(intersect(s,p))return ON;
		else{
			Point a=s.p1-p,b=s.p2-p;
			if(a.y>b.y)swap(a,b);
			if(a.y<EPS&&EPS<b.y&&cross(a,b)>EPS)in=!in;
		}
	}
	return in?IN:OUT;
}
int contain(const Circle&c,const Point&p){
	double d=distance(c.o,p);
	return eq(d,c.r)?ON:d<c.r?IN:OUT;
}
int contain(const Circle&c,const Segment&s){
	double d1=distance(c.o,s.p1),d2=distance(c.o,s.p2);
	return d1<c.r+EPS&&d2<c.r+EPS?eq(d1,c.r)||eq(d2,c.r)?ON:IN:OUT;
}
Polygon convex_cut(const Polygon&P,const Line&s){
	Polygon ret;
	for(int i=0;i<P.size();i++){
		Segment t(P[i],P[(i+1)%P.size()]);
		if(ccw(s,t.p1)!=CLOCKWISE)ret.push_back(t.p1);
		if(!parallel(s,t)&&!intersect(s,t.p1)
			&&!intersect(s,t.p2)&&intersect(s,t))ret.push_back(crosspoint(s,t));
	}
	return ret;
}
double diameter(Polygon P){
	if(!is_convex(P))P=convex_full(P);
	int mi=0,Mi=0;
	for(int i=1;i<P.size();i++){
		if(P[i].x<P[mi].x)mi=i;
		if(P[i].x>P[Mi].x)Mi=i;
	}
	double ret=0;
	int sm=mi,sM=Mi;
	while(mi!=sM||Mi!=sm){
		ret=max(ret,norm(P[mi]-P[Mi]));
		if(cross(P[(mi+1)%P.size()]-P[mi],P[(Mi+1)%P.size()]-P[Mi])<0)mi=(mi+1)%P.size();
		else Mi=(Mi+1)%P.size();
	}
	return sqrt(ret);
}
double area(const Polygon&P){
	double ret=0;
	for(int i=0;i<P.size();i++)ret+=cross(P[i],P[(i+1)%P.size()]);
	return ret/2;
}
double area(const Polygon&P,const Line&s){return area(convex_cut(P,s));}
double area(const Polygon&P,const Circle&c){
	double ret=0;
	for(int i=0;i<P.size();i++)
	{
		Segment s(P[i],P[(i+1)%P.size()]);
		if(contain(c,s))ret+=cross(s.p1-c.o,s.p2-c.o);
		else if(!intersect(c,s)){
			double a=arg(s.p2-c.o)-arg(s.p1-c.o);
			if(a>M_PI)a-=2*M_PI;
			if(a<-M_PI)a+=2*M_PI;
			ret+=c.r*c.r*a;
		}
		else
		{
			pair<Point,Point>p=crosspoint(c,s);
			Point tmp[4]={s.p1,p.first,p.second,s.p2};
			if(intersect(c,Segment(s.p1,p.first))==2)swap(tmp[1],tmp[2]);
			for(int j=0;j<3;j++)
			{
				Segment t(tmp[j],tmp[j+1]);
				if(contain(c,t))ret+=cross(t.p1-c.o,t.p2-c.o);
				else{
					double a=arg(t.p2-c.o)-arg(t.p1-c.o);
					if(a>M_PI)a-=2*M_PI;
					if(a<-M_PI)a+=2*M_PI;
					ret+=c.r*c.r*a;
				}
			}
		}
	}
	return ret/2;
}
int N;
main()
{
	while(cin>>N,N)
	{
		Polygon P(N);
		for(int i=0;i<N;i++)cin>>P[i];
		double S=area(P);
		Point O;
		double L=0,R=M_PI;
		bool flag=area(P,Line(O,polar(2,0)))<S/2;
		for(int i=0;i<100;i++)
		{
			double M=(L+R)/2;
			if(area(P,Line(O,polar(2,M)))<S/2^flag)R=M;
			else L=M;
		}
		Point p=polar(2,L);
		cout<<fixed<<setprecision(15)<<p.x<<" "<<p.y<<endl;
	}
}
accuracy: 1
time_ms: 50
memory_kb: 3680
final_rank: 7

code_snippet: using namespace std;
#include<iostream>
#include<algorithm>
#include<vector>
#include<cmath>
#include<iomanip>
const double EPS=1e-10;
bool eq(double a,double b){return abs(a-b)<EPS;}
struct Point{
	double x,y;
	Point(double x_=0,double y_=0):x(x_),y(y_){}
	Point operator-()const{return Point(-x,-y);}
	Point operator+(const Point&p)const{return Point(x+p.x,y+p.y);}
	Point operator-(const Point&p)const{return Point(x-p.x,y-p.y);}
	Point operator*(const double k)const{return Point(x*k,y*k);}
	Point operator/(const double k)const{return Point(x/k,y/k);}
	bool operator<(const Point&p)const{return eq(x,p.x)?y<p.y:x<p.x;}
	bool operator==(const Point&p)const{return eq(x,p.x)&&eq(y,p.y);}
};
istream&operator>>(istream&is,Point&p){return is>>p.x>>p.y;}
ostream&operator<<(ostream&os,const Point&p){return os<<fixed<<setprecision(9)<<p.x<<' '<<p.y;}
struct Line{
	Point p1,p2;
	Line(Point p1_=Point(),Point p2_=Point()):p1(p1_),p2(p2_){}
};
struct Segment:Line{
	Segment(Point p1_=Point(),Point p2_=Point()):Line(p1_,p2_){}
};
struct Circle{
	Point o;
	double r;
	Circle(Point o_=Point(),double r_=0):o(o_),r(r_){}
};
using Polygon=vector<Point>;
//function list begin
Point vec(const Line&);
double norm(const Point&);
double norm(const Line&);
double abs(const Point&);
double abs(const Line&);
double arg(const Point&);
double arg(const Line&);
double arg(const Point&,const Point&,const Point&);//a->b->c
double dot(const Point&,const Point&);
double cross(const Point&,const Point&);
Point polar(const double,const double);
Point rotate(const Point&,const double);
enum{ONLINE_FRONT=-2,CLOCKWISE=-1,ON_SEGMENT=0,COUNTER_CLOCKWISE=1,ONLINE_BACK=2};
int ccw(const Point&,const Point&,const Point&);
int ccw(const Line&,const Point&);
bool orthogonal(const Point&,const Point&);
bool orthogonal(const Line&,const Line&);
bool parallel(const Point&,const Point&);
bool parallel(const Line&,const Line&);
bool intersect(const Line&,const Point&);
bool intersect(const Line&,const Line&);
bool intersect(const Segment&,const Point&);
bool intersect(const Segment&,const Segment&);
bool intersect(const Line&,const Segment&);
bool intersect(const Segment&,const Line&);
bool intersect(const Circle&,const Point&);
int intersect(const Circle&,const Line&);//count contacts
int intersect(const Circle&,const Segment&);
int intersect(const Circle&,const Circle&);
double distance(const Point&,const Point&);
double distance(const Line&,const Point&);
double distance(const Line&,const Line&);
double distance(const Segment&,const Point&);
double distance(const Segment&,const Segment&);
double distance(const Line&,const Segment&);
double distance(const Segment&,const Line&);
double distance(const Circle&,const Point&);
double distance(const Circle&,const Line&);
double distance(const Circle&,const Segment&);
double distance(const Circle&,const Circle&);
Point projection(const Line&,const Point&);
Point reflection(const Line&,const Point&);
Point crosspoint(const Line&,const Line&);
pair<Point,Point>crosspoint(const Circle&,const Line&);
pair<Point,Point>crosspoint(const Circle&,const Segment&);
pair<Point,Point>crosspoint(const Circle&,const Circle&);
pair<Point,Point>tangent(const Circle&,const Point&);
vector<Line>tangent(const Circle&,const Circle&);
bool is_convex(const Polygon&);
Polygon convex_full(Polygon,bool=false);
enum{OUT,ON,IN};
int contain(const Polygon&,const Point&);
int contain(const Circle&,const Point&);
int contain(const Circle&,const Segment&);
Polygon convex_cut(const Polygon&,const Line&);
double diameter(Polygon);
double area(const Polygon&);
double area(const Polygon&,const Line&);
double area(const Polygon&,const Circle&);
//function list end
Point vec(const Line&s){return s.p2-s.p1;}
double norm(const Point&p){return p.x*p.x+p.y*p.y;}
double norm(const Line&s){return norm(vec(s));}
double abs(const Point&p){return hypot(p.x,p.y);}
double abs(const Line&s){return abs(vec(s));}
double arg(const Point&p){return atan2(p.y,p.x);}
double arg(const Line&s){return arg(vec(s));}
double arg(const Point&a,const Point&b,const Point&c){
	double A=arg(b-a),B=arg(c-b);
	double theta=abs(A-B);
	return min(theta,2*M_PI-theta);
}
double dot(const Point&a,const Point&b){return a.x*b.x+a.y*b.y;}
double cross(const Point&a,const Point&b){return a.x*b.y-a.y*b.x;}
Point polar(const double r,const double theta){return Point(cos(theta),sin(theta))*r;}
Point rotate(const Point&p,const double theta){
	return Point(p.x*cos(theta)-p.y*sin(theta),p.x*sin(theta)+p.y*cos(theta));
}
int ccw(const Point&a,const Point&b,const Point&c){
	Point p=b-a,q=c-a;
	return cross(p,q)>EPS?COUNTER_CLOCKWISE
		:cross(p,q)<-EPS?CLOCKWISE
		:dot(p,q)<0?ONLINE_BACK
		:norm(p)<norm(q)?ONLINE_FRONT
		:ON_SEGMENT;
}
int ccw(const Line&s,const Point&p){return ccw(s.p1,s.p2,p);}
bool orthogonal(const Point&a,const Point&b){return eq(dot(a,b),0);}
bool orthogonal(const Line&s,const Line&t){return orthogonal(vec(s),vec(t));}
bool parallel(const Point&a,const Point&b){return eq(cross(a,b),0);}
bool parallel(const Line&s,const Line&t){return parallel(vec(s),vec(t));}
bool intersect(const Line&s,const Point&p){return eq(cross(vec(s),p-s.p1),0);}
bool intersect(const Line&s,const Line&t){return !parallel(s,t)||intersect(s,t.p1);}
bool intersect(const Segment&s,const Point&p){return ccw(s,p)==ON_SEGMENT;}
bool intersect(const Segment&s,const Segment&t){
	return ccw(s,t.p1)*ccw(s,t.p2)<=0&&ccw(t,s.p1)*ccw(t,s.p2)<=0;
}
bool intersect(const Line&s,const Segment&t){
	return cross(vec(s),t.p1-s.p1)*cross(vec(s),t.p2-s.p1)<EPS;
}
bool intersect(const Segment&s,const Line&t){return intersect(t,s);}
bool intersect(const Circle&c,const Point&p){return eq(distance(c.o,p),c.r);}
int intersect(const Circle&c,const Line&s){
	double d=distance(s,c.o);
	return eq(d,c.r)?1:d<c.r?2:0;
}
int intersect(const Circle&c,const Segment&s){
	Point h=projection(s,c.o);
	double d1=distance(c.o,s.p1),d2=distance(c.o,s.p2);
	return distance(c.o,h)>c.r+EPS?0
		:d1<c.r-EPS&&d2<c.r-EPS?0
		:d1<c.r-EPS&&d2>c.r-EPS||d1>c.r-EPS&&d2<c.r-EPS?1
		:intersect(s,h)?eq(distance(c.o,h),c.r)?1:2
		:0;
}
int intersect(const Circle&a,const Circle&b){
	double d=distance(a.o,b.o);
	return eq(d,a.r+b.r)?3:d>a.r+b.r?4:eq(d,abs(a.r-b.r))?1:d>abs(a.r-b.r)?2:0;
}
double distance(const Point&a,const Point&b){return abs(a-b);}
double distance(const Line&s,const Point&p){return distance(p,projection(s,p));}
double distance(const Line&s,const Line&t){return intersect(s,t)?0:distance(s,t.p1);}
double distance(const Segment&s,const Point&p){
	return distance(p,
		dot(vec(s),p-s.p1)<0?s.p1
		:dot(-vec(s),p-s.p2)<0?s.p2
		:projection(s,p)
	);
}
double distance(const Segment&s,const Segment&t){
	return intersect(s,t)?0:min({
		distance(s,t.p1),distance(s,t.p2),
		distance(t,s.p1),distance(t,s.p2)
	});
}
double distance(const Line&s,const Segment&t){
	return intersect(s,t)?0:min(distance(s,t.p1),distance(s,t.p2));
}
double distance(const Segment&s,const Line&t){return distance(t,s);}
double distance(const Circle&c,const Point&p){return abs(distance(c.o,p)-c.r);}
double distance(const Circle&c,const Line&s){return max(distance(s,c.o)-c.r,0.);}
double distance(const Circle&c,const Segment&s){
	return intersect(c,s)?0
		:contain(c,s)?c.r-max(distance(c.o,s.p1),distance(c.o,s.p2))
		:distance(s,c.o)-c.r;
}
double distance(const Circle&a,const Circle&b){return max(distance(a.o,b.o)-a.r-b.r,0.);}
Point projection(const Line&s,const Point&p){
	return s.p1+vec(s)*dot(p-s.p1,vec(s))/norm(s);
}
Point reflection(const Line&s,const Point&p){return projection(s,p)*2-p;}
Point crosspoint(const Line&s,const Line&t){
	double d1=abs(cross(vec(s),t.p1-s.p1));
	double d2=abs(cross(vec(s),t.p2-s.p1));
	return t.p1+vec(t)*(d1/(d1+d2));
}
pair<Point,Point>crosspoint(const Circle&c,const Line&s){
	Point h=projection(s,c.o);
	Point e=vec(s)/abs(s)*sqrt(c.r*c.r-norm(h-c.o));
	return minmax(h-e,h+e);
}
pair<Point,Point>crosspoint(const Circle&c,const Segment&s){
	pair<Point,Point>p=crosspoint(c,Line(s));
	return intersect(c,s)==2?p
		:intersect(s,p.first)?make_pair(p.first,p.first)
		:make_pair(p.second,p.second);
}
pair<Point,Point>crosspoint(const Circle&a,const Circle&b){
	double d=distance(a.o,b.o);
	double alpha=acos((a.r*a.r+d*d-b.r*b.r)/(2*a.r*d));
	double theta=arg(b.o-a.o);
	return minmax(a.o+polar(a.r,theta+alpha),a.o+polar(a.r,theta-alpha));
}
pair<Point,Point>tangent(const Circle&c,const Point&p){
	return crosspoint(c,Circle(p,sqrt(norm(c.o-p)-c.r*c.r)));
}
vector<Line>tangent(const Circle&a,const Circle&b){
	vector<Line>ret;
	double g=distance(a.o,b.o);
	if(eq(g,0))return ret;
	Point u=(b.o-a.o)/g;
	Point v=rotate(u,M_PI/2);
	for(int s:{-1,1}){
		double h=(a.r+b.r*s)/g;
		if(eq(h*h,1))ret.emplace_back(a.o+(h>0?u:-u)*a.r,a.o+(h>0?u:-u)*a.r+v);
		else if(1-h*h>0){
			Point U=u*h,V=v*sqrt(1-h*h);
			ret.emplace_back(a.o+(U+V)*a.r,b.o-(U+V)*b.r*s);
			ret.emplace_back(a.o+(U-V)*a.r,b.o-(U-V)*b.r*s);
		}
	}
	return ret;
}
bool is_convex(const Polygon&P){
	for(int i=0;i<P.size();i++)
		if(ccw(P[i],P[(i+1)%P.size()],P[(i+2)%P.size()])==CLOCKWISE)return false;
	return true;
}
Polygon convex_full(Polygon P,bool ONSEG){
	if(P.size()<=2)return P;
	sort(P.begin(),P.end());
	Polygon ret(2*P.size());
	int k=0,t;
	if(ONSEG){
		for(const Point&p:P){
			while(k>=2&&ccw(ret[k-2],ret[k-1],p)==CLOCKWISE)k--;
			ret[k++]=p;
		}
		t=k;
		for(int i=P.size()-2;i>=0;i--){
			while(k>=t+1&&ccw(ret[k-2],ret[k-1],P[i])==CLOCKWISE)k--;
			ret[k++]=P[i];
		}
	}
	else{
		for(const Point&p:P){
			while(k>=2&&ccw(ret[k-2],ret[k-1],p)!=COUNTER_CLOCKWISE)k--;
			ret[k++]=p;
		}
		t=k;
		for(int i=P.size()-2;i>=0;i--){
			while(k>=t+1&&ccw(ret[k-2],ret[k-1],P[i])!=COUNTER_CLOCKWISE)k--;
			ret[k++]=P[i];
		}
	}
	ret.resize(k-1);
	int mi=0;
	for(int i=1;i<k-1;i++)
		if(eq(ret[mi].y,ret[i].y)?ret[mi].x>ret[i].x:ret[mi].y>ret[i].y)mi=i;
	rotate(ret.begin(),ret.begin()+mi,ret.end());
	return ret;
}
int contain(const Polygon&P,const Point&p){
	bool in=false;
	for(int i=0;i<P.size();i++){
		Segment s(P[i],P[(i+1)%P.size()]);
		if(intersect(s,p))return ON;
		else{
			Point a=s.p1-p,b=s.p2-p;
			if(a.y>b.y)swap(a,b);
			if(a.y<EPS&&EPS<b.y&&cross(a,b)>EPS)in=!in;
		}
	}
	return in?IN:OUT;
}
int contain(const Circle&c,const Point&p){
	double d=distance(c.o,p);
	return eq(d,c.r)?ON:d<c.r?IN:OUT;
}
int contain(const Circle&c,const Segment&s){
	double d1=distance(c.o,s.p1),d2=distance(c.o,s.p2);
	return d1<c.r+EPS&&d2<c.r+EPS?eq(d1,c.r)||eq(d2,c.r)?ON:IN:OUT;
}
Polygon convex_cut(const Polygon&P,const Line&s){
	Polygon ret;
	for(int i=0;i<P.size();i++){
		Segment t(P[i],P[(i+1)%P.size()]);
		if(ccw(s,t.p1)!=CLOCKWISE)ret.push_back(t.p1);
		if(!parallel(s,t)&&!intersect(s,t.p1)
			&&!intersect(s,t.p2)&&intersect(s,t))ret.push_back(crosspoint(s,t));
	}
	return ret;
}
double diameter(Polygon P){
	if(!is_convex(P))P=convex_full(P);
	int mi=0,Mi=0;
	for(int i=1;i<P.size();i++){
		if(P[i].x<P[mi].x)mi=i;
		if(P[i].x>P[Mi].x)Mi=i;
	}
	double ret=0;
	int sm=mi,sM=Mi;
	while(mi!=sM||Mi!=sm){
		ret=max(ret,norm(P[mi]-P[Mi]));
		if(cross(P[(mi+1)%P.size()]-P[mi],P[(Mi+1)%P.size()]-P[Mi])<0)mi=(mi+1)%P.size();
		else Mi=(Mi+1)%P.size();
	}
	return sqrt(ret);
}
double area(const Polygon&P){
	double ret=0;
	for(int i=0;i<P.size();i++)ret+=cross(P[i],P[(i+1)%P.size()]);
	return ret/2;
}
double area(const Polygon&P,const Line&s){return area(convex_cut(P,s));}
double area(const Polygon&P,const Circle&c){
	double ret=0;
	for(int i=0;i<P.size();i++)
	{
		Segment s(P[i],P[(i+1)%P.size()]);
		if(contain(c,s))ret+=cross(s.p1-c.o,s.p2-c.o);
		else if(!intersect(c,s)){
			double a=arg(s.p2-c.o)-arg(s.p1-c.o);
			if(a>M_PI)a-=2*M_PI;
			if(a<-M_PI)a+=2*M_PI;
			ret+=c.r*c.r*a;
		}
		else
		{
			pair<Point,Point>p=crosspoint(c,s);
			Point tmp[4]={s.p1,p.first,p.second,s.p2};
			if(intersect(c,Segment(s.p1,p.first))==2)swap(tmp[1],tmp[2]);
			for(int j=0;j<3;j++)
			{
				Segment t(tmp[j],tmp[j+1]);
				if(contain(c,t))ret+=cross(t.p1-c.o,t.p2-c.o);
				else{
					double a=arg(t.p2-c.o)-arg(t.p1-c.o);
					if(a>M_PI)a-=2*M_PI;
					if(a<-M_PI)a+=2*M_PI;
					ret+=c.r*c.r*a;
				}
			}
		}
	}
	return ret/2;
}
int N;
main()
{
	while(cin>>N,N)
	{
		Polygon P(N);
		for(int i=0;i<N;i++)cin>>P[i];
		double S=area(P);
		Point O,p;
		double now=1e150;
		for(int i=0;i<N;i++)
		{
			double L=arg(P[i]);
			double R=arg(P[(i+1)%N]);
			if(R<L)R+=2*M_PI;
			for(int i=0;i<100;i++)
			{
				double M1=(L*2+R)/3;
				double M2=(L+R*2)/3;
				if(abs(S-area(P,Line(O,polar(2,M1)))*2)<abs(S-area(P,Line(O,polar(2,M2)))*2))R=M2;
				else L=M1;
			}
			Point q=polar(2,L);
			if(now>abs(S-area(P,Line(O,q))*2))
			{
				now=abs(S-area(P,Line(O,q))*2);
				p=q;
			}
		}
		cout<<fixed<<setprecision(15)<<p.x<<" "<<p.y<<endl;
	}
}
accuracy: 1
time_ms: 1140
memory_kb: 3744
final_rank: 11

code_snippet: using namespace std;
#include<iostream>
#include<algorithm>
#include<vector>
#include<cmath>
#include<iomanip>
const double EPS=1e-10;
bool eq(double a,double b){return abs(a-b)<EPS;}
struct Point{
	double x,y;
	Point(double x_=0,double y_=0):x(x_),y(y_){}
	Point operator-()const{return Point(-x,-y);}
	Point operator+(const Point&p)const{return Point(x+p.x,y+p.y);}
	Point operator-(const Point&p)const{return Point(x-p.x,y-p.y);}
	Point operator*(const double k)const{return Point(x*k,y*k);}
	Point operator/(const double k)const{return Point(x/k,y/k);}
	bool operator<(const Point&p)const{return eq(x,p.x)?y<p.y:x<p.x;}
	bool operator==(const Point&p)const{return eq(x,p.x)&&eq(y,p.y);}
};
istream&operator>>(istream&is,Point&p){return is>>p.x>>p.y;}
ostream&operator<<(ostream&os,const Point&p){return os<<fixed<<setprecision(9)<<p.x<<' '<<p.y;}
struct Line{
	Point p1,p2;
	Line(Point p1_=Point(),Point p2_=Point()):p1(p1_),p2(p2_){}
};
struct Segment:Line{
	Segment(Point p1_=Point(),Point p2_=Point()):Line(p1_,p2_){}
};
struct Circle{
	Point o;
	double r;
	Circle(Point o_=Point(),double r_=0):o(o_),r(r_){}
};
using Polygon=vector<Point>;
//function list begin
Point vec(const Line&);
double norm(const Point&);
double norm(const Line&);
double abs(const Point&);
double abs(const Line&);
double arg(const Point&);
double arg(const Line&);
double arg(const Point&,const Point&,const Point&);//a->b->c
double dot(const Point&,const Point&);
double cross(const Point&,const Point&);
Point polar(const double,const double);
Point rotate(const Point&,const double);
enum{ONLINE_FRONT=-2,CLOCKWISE=-1,ON_SEGMENT=0,COUNTER_CLOCKWISE=1,ONLINE_BACK=2};
int ccw(const Point&,const Point&,const Point&);
int ccw(const Line&,const Point&);
bool orthogonal(const Point&,const Point&);
bool orthogonal(const Line&,const Line&);
bool parallel(const Point&,const Point&);
bool parallel(const Line&,const Line&);
bool intersect(const Line&,const Point&);
bool intersect(const Line&,const Line&);
bool intersect(const Segment&,const Point&);
bool intersect(const Segment&,const Segment&);
bool intersect(const Line&,const Segment&);
bool intersect(const Segment&,const Line&);
bool intersect(const Circle&,const Point&);
int intersect(const Circle&,const Line&);//count contacts
int intersect(const Circle&,const Segment&);
int intersect(const Circle&,const Circle&);
double distance(const Point&,const Point&);
double distance(const Line&,const Point&);
double distance(const Line&,const Line&);
double distance(const Segment&,const Point&);
double distance(const Segment&,const Segment&);
double distance(const Line&,const Segment&);
double distance(const Segment&,const Line&);
double distance(const Circle&,const Point&);
double distance(const Circle&,const Line&);
double distance(const Circle&,const Segment&);
double distance(const Circle&,const Circle&);
Point projection(const Line&,const Point&);
Point reflection(const Line&,const Point&);
Point crosspoint(const Line&,const Line&);
pair<Point,Point>crosspoint(const Circle&,const Line&);
pair<Point,Point>crosspoint(const Circle&,const Segment&);
pair<Point,Point>crosspoint(const Circle&,const Circle&);
pair<Point,Point>tangent(const Circle&,const Point&);
vector<Line>tangent(const Circle&,const Circle&);
bool is_convex(const Polygon&);
Polygon convex_full(Polygon,bool=false);
enum{OUT,ON,IN};
int contain(const Polygon&,const Point&);
int contain(const Circle&,const Point&);
int contain(const Circle&,const Segment&);
Polygon convex_cut(const Polygon&,const Line&);
double diameter(Polygon);
double area(const Polygon&);
double area(const Polygon&,const Line&);
double area(const Polygon&,const Circle&);
//function list end
Point vec(const Line&s){return s.p2-s.p1;}
double norm(const Point&p){return p.x*p.x+p.y*p.y;}
double norm(const Line&s){return norm(vec(s));}
double abs(const Point&p){return hypot(p.x,p.y);}
double abs(const Line&s){return abs(vec(s));}
double arg(const Point&p){return atan2(p.y,p.x);}
double arg(const Line&s){return arg(vec(s));}
double arg(const Point&a,const Point&b,const Point&c){
	double A=arg(b-a),B=arg(c-b);
	double theta=abs(A-B);
	return min(theta,2*M_PI-theta);
}
double dot(const Point&a,const Point&b){return a.x*b.x+a.y*b.y;}
double cross(const Point&a,const Point&b){return a.x*b.y-a.y*b.x;}
Point polar(const double r,const double theta){return Point(cos(theta),sin(theta))*r;}
Point rotate(const Point&p,const double theta){
	return Point(p.x*cos(theta)-p.y*sin(theta),p.x*sin(theta)+p.y*cos(theta));
}
int ccw(const Point&a,const Point&b,const Point&c){
	Point p=b-a,q=c-a;
	return cross(p,q)>EPS?COUNTER_CLOCKWISE
		:cross(p,q)<-EPS?CLOCKWISE
		:dot(p,q)<0?ONLINE_BACK
		:norm(p)<norm(q)?ONLINE_FRONT
		:ON_SEGMENT;
}
int ccw(const Line&s,const Point&p){return ccw(s.p1,s.p2,p);}
bool orthogonal(const Point&a,const Point&b){return eq(dot(a,b),0);}
bool orthogonal(const Line&s,const Line&t){return orthogonal(vec(s),vec(t));}
bool parallel(const Point&a,const Point&b){return eq(cross(a,b),0);}
bool parallel(const Line&s,const Line&t){return parallel(vec(s),vec(t));}
bool intersect(const Line&s,const Point&p){return eq(cross(vec(s),p-s.p1),0);}
bool intersect(const Line&s,const Line&t){return !parallel(s,t)||intersect(s,t.p1);}
bool intersect(const Segment&s,const Point&p){return ccw(s,p)==ON_SEGMENT;}
bool intersect(const Segment&s,const Segment&t){
	return ccw(s,t.p1)*ccw(s,t.p2)<=0&&ccw(t,s.p1)*ccw(t,s.p2)<=0;
}
bool intersect(const Line&s,const Segment&t){
	return cross(vec(s),t.p1-s.p1)*cross(vec(s),t.p2-s.p1)<EPS;
}
bool intersect(const Segment&s,const Line&t){return intersect(t,s);}
bool intersect(const Circle&c,const Point&p){return eq(distance(c.o,p),c.r);}
int intersect(const Circle&c,const Line&s){
	double d=distance(s,c.o);
	return eq(d,c.r)?1:d<c.r?2:0;
}
int intersect(const Circle&c,const Segment&s){
	Point h=projection(s,c.o);
	double d1=distance(c.o,s.p1),d2=distance(c.o,s.p2);
	return distance(c.o,h)>c.r+EPS?0
		:d1<c.r-EPS&&d2<c.r-EPS?0
		:d1<c.r-EPS&&d2>c.r-EPS||d1>c.r-EPS&&d2<c.r-EPS?1
		:intersect(s,h)?eq(distance(c.o,h),c.r)?1:2
		:0;
}
int intersect(const Circle&a,const Circle&b){
	double d=distance(a.o,b.o);
	return eq(d,a.r+b.r)?3:d>a.r+b.r?4:eq(d,abs(a.r-b.r))?1:d>abs(a.r-b.r)?2:0;
}
double distance(const Point&a,const Point&b){return abs(a-b);}
double distance(const Line&s,const Point&p){return distance(p,projection(s,p));}
double distance(const Line&s,const Line&t){return intersect(s,t)?0:distance(s,t.p1);}
double distance(const Segment&s,const Point&p){
	return distance(p,
		dot(vec(s),p-s.p1)<0?s.p1
		:dot(-vec(s),p-s.p2)<0?s.p2
		:projection(s,p)
	);
}
double distance(const Segment&s,const Segment&t){
	return intersect(s,t)?0:min({
		distance(s,t.p1),distance(s,t.p2),
		distance(t,s.p1),distance(t,s.p2)
	});
}
double distance(const Line&s,const Segment&t){
	return intersect(s,t)?0:min(distance(s,t.p1),distance(s,t.p2));
}
double distance(const Segment&s,const Line&t){return distance(t,s);}
double distance(const Circle&c,const Point&p){return abs(distance(c.o,p)-c.r);}
double distance(const Circle&c,const Line&s){return max(distance(s,c.o)-c.r,0.);}
double distance(const Circle&c,const Segment&s){
	return intersect(c,s)?0
		:contain(c,s)?c.r-max(distance(c.o,s.p1),distance(c.o,s.p2))
		:distance(s,c.o)-c.r;
}
double distance(const Circle&a,const Circle&b){return max(distance(a.o,b.o)-a.r-b.r,0.);}
Point projection(const Line&s,const Point&p){
	return s.p1+vec(s)*dot(p-s.p1,vec(s))/norm(s);
}
Point reflection(const Line&s,const Point&p){return projection(s,p)*2-p;}
Point crosspoint(const Line&s,const Line&t){
	double d1=abs(cross(vec(s),t.p1-s.p1));
	double d2=abs(cross(vec(s),t.p2-s.p1));
	return t.p1+vec(t)*(d1/(d1+d2));
}
pair<Point,Point>crosspoint(const Circle&c,const Line&s){
	Point h=projection(s,c.o);
	Point e=vec(s)/abs(s)*sqrt(c.r*c.r-norm(h-c.o));
	return minmax(h-e,h+e);
}
pair<Point,Point>crosspoint(const Circle&c,const Segment&s){
	pair<Point,Point>p=crosspoint(c,Line(s));
	return intersect(c,s)==2?p
		:intersect(s,p.first)?make_pair(p.first,p.first)
		:make_pair(p.second,p.second);
}
pair<Point,Point>crosspoint(const Circle&a,const Circle&b){
	double d=distance(a.o,b.o);
	double alpha=acos((a.r*a.r+d*d-b.r*b.r)/(2*a.r*d));
	double theta=arg(b.o-a.o);
	return minmax(a.o+polar(a.r,theta+alpha),a.o+polar(a.r,theta-alpha));
}
pair<Point,Point>tangent(const Circle&c,const Point&p){
	return crosspoint(c,Circle(p,sqrt(norm(c.o-p)-c.r*c.r)));
}
vector<Line>tangent(const Circle&a,const Circle&b){
	vector<Line>ret;
	double g=distance(a.o,b.o);
	if(eq(g,0))return ret;
	Point u=(b.o-a.o)/g;
	Point v=rotate(u,M_PI/2);
	for(int s:{-1,1}){
		double h=(a.r+b.r*s)/g;
		if(eq(h*h,1))ret.emplace_back(a.o+(h>0?u:-u)*a.r,a.o+(h>0?u:-u)*a.r+v);
		else if(1-h*h>0){
			Point U=u*h,V=v*sqrt(1-h*h);
			ret.emplace_back(a.o+(U+V)*a.r,b.o-(U+V)*b.r*s);
			ret.emplace_back(a.o+(U-V)*a.r,b.o-(U-V)*b.r*s);
		}
	}
	return ret;
}
bool is_convex(const Polygon&P){
	for(int i=0;i<P.size();i++)
		if(ccw(P[i],P[(i+1)%P.size()],P[(i+2)%P.size()])==CLOCKWISE)return false;
	return true;
}
Polygon convex_full(Polygon P,bool ONSEG){
	if(P.size()<=2)return P;
	sort(P.begin(),P.end());
	Polygon ret(2*P.size());
	int k=0,t;
	if(ONSEG){
		for(const Point&p:P){
			while(k>=2&&ccw(ret[k-2],ret[k-1],p)==CLOCKWISE)k--;
			ret[k++]=p;
		}
		t=k;
		for(int i=P.size()-2;i>=0;i--){
			while(k>=t+1&&ccw(ret[k-2],ret[k-1],P[i])==CLOCKWISE)k--;
			ret[k++]=P[i];
		}
	}
	else{
		for(const Point&p:P){
			while(k>=2&&ccw(ret[k-2],ret[k-1],p)!=COUNTER_CLOCKWISE)k--;
			ret[k++]=p;
		}
		t=k;
		for(int i=P.size()-2;i>=0;i--){
			while(k>=t+1&&ccw(ret[k-2],ret[k-1],P[i])!=COUNTER_CLOCKWISE)k--;
			ret[k++]=P[i];
		}
	}
	ret.resize(k-1);
	int mi=0;
	for(int i=1;i<k-1;i++)
		if(eq(ret[mi].y,ret[i].y)?ret[mi].x>ret[i].x:ret[mi].y>ret[i].y)mi=i;
	rotate(ret.begin(),ret.begin()+mi,ret.end());
	return ret;
}
int contain(const Polygon&P,const Point&p){
	bool in=false;
	for(int i=0;i<P.size();i++){
		Segment s(P[i],P[(i+1)%P.size()]);
		if(intersect(s,p))return ON;
		else{
			Point a=s.p1-p,b=s.p2-p;
			if(a.y>b.y)swap(a,b);
			if(a.y<EPS&&EPS<b.y&&cross(a,b)>EPS)in=!in;
		}
	}
	return in?IN:OUT;
}
int contain(const Circle&c,const Point&p){
	double d=distance(c.o,p);
	return eq(d,c.r)?ON:d<c.r?IN:OUT;
}
int contain(const Circle&c,const Segment&s){
	double d1=distance(c.o,s.p1),d2=distance(c.o,s.p2);
	return d1<c.r+EPS&&d2<c.r+EPS?eq(d1,c.r)||eq(d2,c.r)?ON:IN:OUT;
}
Polygon convex_cut(const Polygon&P,const Line&s){
	Polygon ret;
	for(int i=0;i<P.size();i++){
		Segment t(P[i],P[(i+1)%P.size()]);
		if(ccw(s,t.p1)!=CLOCKWISE)ret.push_back(t.p1);
		if(!parallel(s,t)&&!intersect(s,t.p1)
			&&!intersect(s,t.p2)&&intersect(s,t))ret.push_back(crosspoint(s,t));
	}
	return ret;
}
double diameter(Polygon P){
	if(!is_convex(P))P=convex_full(P);
	int mi=0,Mi=0;
	for(int i=1;i<P.size();i++){
		if(P[i].x<P[mi].x)mi=i;
		if(P[i].x>P[Mi].x)Mi=i;
	}
	double ret=0;
	int sm=mi,sM=Mi;
	while(mi!=sM||Mi!=sm){
		ret=max(ret,norm(P[mi]-P[Mi]));
		if(cross(P[(mi+1)%P.size()]-P[mi],P[(Mi+1)%P.size()]-P[Mi])<0)mi=(mi+1)%P.size();
		else Mi=(Mi+1)%P.size();
	}
	return sqrt(ret);
}
double area(const Polygon&P){
	double ret=0;
	for(int i=0;i<P.size();i++)ret+=cross(P[i],P[(i+1)%P.size()]);
	return ret/2;
}
double area(const Polygon&P,const Line&s){return area(convex_cut(P,s));}
double area(const Polygon&P,const Circle&c){
	double ret=0;
	for(int i=0;i<P.size();i++)
	{
		Segment s(P[i],P[(i+1)%P.size()]);
		if(contain(c,s))ret+=cross(s.p1-c.o,s.p2-c.o);
		else if(!intersect(c,s)){
			double a=arg(s.p2-c.o)-arg(s.p1-c.o);
			if(a>M_PI)a-=2*M_PI;
			if(a<-M_PI)a+=2*M_PI;
			ret+=c.r*c.r*a;
		}
		else
		{
			pair<Point,Point>p=crosspoint(c,s);
			Point tmp[4]={s.p1,p.first,p.second,s.p2};
			if(intersect(c,Segment(s.p1,p.first))==2)swap(tmp[1],tmp[2]);
			for(int j=0;j<3;j++)
			{
				Segment t(tmp[j],tmp[j+1]);
				if(contain(c,t))ret+=cross(t.p1-c.o,t.p2-c.o);
				else{
					double a=arg(t.p2-c.o)-arg(t.p1-c.o);
					if(a>M_PI)a-=2*M_PI;
					if(a<-M_PI)a+=2*M_PI;
					ret+=c.r*c.r*a;
				}
			}
		}
	}
	return ret/2;
}
int N;
main()
{
	while(cin>>N,N)
	{
		Polygon P(N);
		for(int i=0;i<N;i++)cin>>P[i];
		double S=area(P);
		Point O,p;
		double now=1e150;
		for(int i=0;i<N;i++)
		{
			double L=arg(P[i]);
			double R=arg(P[(i+1)%N]);
			if(R<L)R+=2*M_PI;
			for(int i=0;i<100;i++)
			{
				double M1=(L*2+R)/3;
				double M2=(L+R*2)/3;
				if(abs(S-area(P,Line(O,polar(2,M1)))*2)<abs(S-area(P,Line(O,polar(2,M2)))*2))R=M2;
				else L=M1;
			}
			Point q=polar(2,L);
			if(now>abs(S-area(P,Line(O,q))*2))
			{
				now=abs(S-area(P,Line(O,q))*2);
				p=q;
			}
			if(now>abs(S-area(P,Line(O,P[i]))*2))
			{
				now=abs(S-area(P,Line(O,P[i]))*2);
				p=P[i];
			}
		}
		cout<<fixed<<setprecision(15)<<p.x<<" "<<p.y<<endl;
		/*for(int i=0;i<20;i++)
		{
			cout<<fixed<<setprecision(15)<<area(P,Line(O,polar(2,M_PI/20*i)))<<endl;
		}*/
	}
}
accuracy: 1
time_ms: 1130
memory_kb: 3744
final_rank: 10

code_snippet: using namespace std;
#include<iostream>
#include<algorithm>
#include<vector>
#include<cmath>
#include<iomanip>
const double EPS=1e-10;
bool eq(double a,double b){return abs(a-b)<EPS;}
struct Point{
	double x,y;
	Point(double x_=0,double y_=0):x(x_),y(y_){}
	Point operator-()const{return Point(-x,-y);}
	Point operator+(const Point&p)const{return Point(x+p.x,y+p.y);}
	Point operator-(const Point&p)const{return Point(x-p.x,y-p.y);}
	Point operator*(const double k)const{return Point(x*k,y*k);}
	Point operator/(const double k)const{return Point(x/k,y/k);}
	bool operator<(const Point&p)const{return eq(x,p.x)?y<p.y:x<p.x;}
	bool operator==(const Point&p)const{return eq(x,p.x)&&eq(y,p.y);}
};
istream&operator>>(istream&is,Point&p){return is>>p.x>>p.y;}
ostream&operator<<(ostream&os,const Point&p){return os<<fixed<<setprecision(9)<<p.x<<' '<<p.y;}
struct Line{
	Point p1,p2;
	Line(Point p1_=Point(),Point p2_=Point()):p1(p1_),p2(p2_){}
};
struct Segment:Line{
	Segment(Point p1_=Point(),Point p2_=Point()):Line(p1_,p2_){}
};
struct Circle{
	Point o;
	double r;
	Circle(Point o_=Point(),double r_=0):o(o_),r(r_){}
};
using Polygon=vector<Point>;
//function list begin
Point vec(const Line&);
double norm(const Point&);
double norm(const Line&);
double abs(const Point&);
double abs(const Line&);
double arg(const Point&);
double arg(const Line&);
double arg(const Point&,const Point&,const Point&);//a->b->c
double dot(const Point&,const Point&);
double cross(const Point&,const Point&);
Point polar(const double,const double);
Point rotate(const Point&,const double);
enum{ONLINE_FRONT=-2,CLOCKWISE=-1,ON_SEGMENT=0,COUNTER_CLOCKWISE=1,ONLINE_BACK=2};
int ccw(const Point&,const Point&,const Point&);
int ccw(const Line&,const Point&);
bool orthogonal(const Point&,const Point&);
bool orthogonal(const Line&,const Line&);
bool parallel(const Point&,const Point&);
bool parallel(const Line&,const Line&);
bool intersect(const Line&,const Point&);
bool intersect(const Line&,const Line&);
bool intersect(const Segment&,const Point&);
bool intersect(const Segment&,const Segment&);
bool intersect(const Line&,const Segment&);
bool intersect(const Segment&,const Line&);
bool intersect(const Circle&,const Point&);
int intersect(const Circle&,const Line&);//count contacts
int intersect(const Circle&,const Segment&);
int intersect(const Circle&,const Circle&);
double distance(const Point&,const Point&);
double distance(const Line&,const Point&);
double distance(const Line&,const Line&);
double distance(const Segment&,const Point&);
double distance(const Segment&,const Segment&);
double distance(const Line&,const Segment&);
double distance(const Segment&,const Line&);
double distance(const Circle&,const Point&);
double distance(const Circle&,const Line&);
double distance(const Circle&,const Segment&);
double distance(const Circle&,const Circle&);
Point projection(const Line&,const Point&);
Point reflection(const Line&,const Point&);
Point crosspoint(const Line&,const Line&);
pair<Point,Point>crosspoint(const Circle&,const Line&);
pair<Point,Point>crosspoint(const Circle&,const Segment&);
pair<Point,Point>crosspoint(const Circle&,const Circle&);
pair<Point,Point>tangent(const Circle&,const Point&);
vector<Line>tangent(const Circle&,const Circle&);
bool is_convex(const Polygon&);
Polygon convex_full(Polygon,bool=false);
enum{OUT,ON,IN};
int contain(const Polygon&,const Point&);
int contain(const Circle&,const Point&);
int contain(const Circle&,const Segment&);
Polygon convex_cut(const Polygon&,const Line&);
double diameter(Polygon);
double area(const Polygon&);
double area(const Polygon&,const Line&);
double area(const Polygon&,const Circle&);
//function list end
Point vec(const Line&s){return s.p2-s.p1;}
double norm(const Point&p){return p.x*p.x+p.y*p.y;}
double norm(const Line&s){return norm(vec(s));}
double abs(const Point&p){return hypot(p.x,p.y);}
double abs(const Line&s){return abs(vec(s));}
double arg(const Point&p){return atan2(p.y,p.x);}
double arg(const Line&s){return arg(vec(s));}
double arg(const Point&a,const Point&b,const Point&c){
	double A=arg(b-a),B=arg(c-b);
	double theta=abs(A-B);
	return min(theta,2*M_PI-theta);
}
double dot(const Point&a,const Point&b){return a.x*b.x+a.y*b.y;}
double cross(const Point&a,const Point&b){return a.x*b.y-a.y*b.x;}
Point polar(const double r,const double theta){return Point(cos(theta),sin(theta))*r;}
Point rotate(const Point&p,const double theta){
	return Point(p.x*cos(theta)-p.y*sin(theta),p.x*sin(theta)+p.y*cos(theta));
}
int ccw(const Point&a,const Point&b,const Point&c){
	Point p=b-a,q=c-a;
	return cross(p,q)>EPS?COUNTER_CLOCKWISE
		:cross(p,q)<-EPS?CLOCKWISE
		:dot(p,q)<0?ONLINE_BACK
		:norm(p)<norm(q)?ONLINE_FRONT
		:ON_SEGMENT;
}
int ccw(const Line&s,const Point&p){return ccw(s.p1,s.p2,p);}
bool orthogonal(const Point&a,const Point&b){return eq(dot(a,b),0);}
bool orthogonal(const Line&s,const Line&t){return orthogonal(vec(s),vec(t));}
bool parallel(const Point&a,const Point&b){return eq(cross(a,b),0);}
bool parallel(const Line&s,const Line&t){return parallel(vec(s),vec(t));}
bool intersect(const Line&s,const Point&p){return eq(cross(vec(s),p-s.p1),0);}
bool intersect(const Line&s,const Line&t){return !parallel(s,t)||intersect(s,t.p1);}
bool intersect(const Segment&s,const Point&p){return ccw(s,p)==ON_SEGMENT;}
bool intersect(const Segment&s,const Segment&t){
	return ccw(s,t.p1)*ccw(s,t.p2)<=0&&ccw(t,s.p1)*ccw(t,s.p2)<=0;
}
bool intersect(const Line&s,const Segment&t){
	return cross(vec(s),t.p1-s.p1)*cross(vec(s),t.p2-s.p1)<EPS;
}
bool intersect(const Segment&s,const Line&t){return intersect(t,s);}
bool intersect(const Circle&c,const Point&p){return eq(distance(c.o,p),c.r);}
int intersect(const Circle&c,const Line&s){
	double d=distance(s,c.o);
	return eq(d,c.r)?1:d<c.r?2:0;
}
int intersect(const Circle&c,const Segment&s){
	Point h=projection(s,c.o);
	double d1=distance(c.o,s.p1),d2=distance(c.o,s.p2);
	return distance(c.o,h)>c.r+EPS?0
		:d1<c.r-EPS&&d2<c.r-EPS?0
		:d1<c.r-EPS&&d2>c.r-EPS||d1>c.r-EPS&&d2<c.r-EPS?1
		:intersect(s,h)?eq(distance(c.o,h),c.r)?1:2
		:0;
}
int intersect(const Circle&a,const Circle&b){
	double d=distance(a.o,b.o);
	return eq(d,a.r+b.r)?3:d>a.r+b.r?4:eq(d,abs(a.r-b.r))?1:d>abs(a.r-b.r)?2:0;
}
double distance(const Point&a,const Point&b){return abs(a-b);}
double distance(const Line&s,const Point&p){return distance(p,projection(s,p));}
double distance(const Line&s,const Line&t){return intersect(s,t)?0:distance(s,t.p1);}
double distance(const Segment&s,const Point&p){
	return distance(p,
		dot(vec(s),p-s.p1)<0?s.p1
		:dot(-vec(s),p-s.p2)<0?s.p2
		:projection(s,p)
	);
}
double distance(const Segment&s,const Segment&t){
	return intersect(s,t)?0:min({
		distance(s,t.p1),distance(s,t.p2),
		distance(t,s.p1),distance(t,s.p2)
	});
}
double distance(const Line&s,const Segment&t){
	return intersect(s,t)?0:min(distance(s,t.p1),distance(s,t.p2));
}
double distance(const Segment&s,const Line&t){return distance(t,s);}
double distance(const Circle&c,const Point&p){return abs(distance(c.o,p)-c.r);}
double distance(const Circle&c,const Line&s){return max(distance(s,c.o)-c.r,0.);}
double distance(const Circle&c,const Segment&s){
	return intersect(c,s)?0
		:contain(c,s)?c.r-max(distance(c.o,s.p1),distance(c.o,s.p2))
		:distance(s,c.o)-c.r;
}
double distance(const Circle&a,const Circle&b){return max(distance(a.o,b.o)-a.r-b.r,0.);}
Point projection(const Line&s,const Point&p){
	return s.p1+vec(s)*dot(p-s.p1,vec(s))/norm(s);
}
Point reflection(const Line&s,const Point&p){return projection(s,p)*2-p;}
Point crosspoint(const Line&s,const Line&t){
	double d1=abs(cross(vec(s),t.p1-s.p1));
	double d2=abs(cross(vec(s),t.p2-s.p1));
	return t.p1+vec(t)*(d1/(d1+d2));
}
pair<Point,Point>crosspoint(const Circle&c,const Line&s){
	Point h=projection(s,c.o);
	Point e=vec(s)/abs(s)*sqrt(c.r*c.r-norm(h-c.o));
	return minmax(h-e,h+e);
}
pair<Point,Point>crosspoint(const Circle&c,const Segment&s){
	pair<Point,Point>p=crosspoint(c,Line(s));
	return intersect(c,s)==2?p
		:intersect(s,p.first)?make_pair(p.first,p.first)
		:make_pair(p.second,p.second);
}
pair<Point,Point>crosspoint(const Circle&a,const Circle&b){
	double d=distance(a.o,b.o);
	double alpha=acos((a.r*a.r+d*d-b.r*b.r)/(2*a.r*d));
	double theta=arg(b.o-a.o);
	return minmax(a.o+polar(a.r,theta+alpha),a.o+polar(a.r,theta-alpha));
}
pair<Point,Point>tangent(const Circle&c,const Point&p){
	return crosspoint(c,Circle(p,sqrt(norm(c.o-p)-c.r*c.r)));
}
vector<Line>tangent(const Circle&a,const Circle&b){
	vector<Line>ret;
	double g=distance(a.o,b.o);
	if(eq(g,0))return ret;
	Point u=(b.o-a.o)/g;
	Point v=rotate(u,M_PI/2);
	for(int s:{-1,1}){
		double h=(a.r+b.r*s)/g;
		if(eq(h*h,1))ret.emplace_back(a.o+(h>0?u:-u)*a.r,a.o+(h>0?u:-u)*a.r+v);
		else if(1-h*h>0){
			Point U=u*h,V=v*sqrt(1-h*h);
			ret.emplace_back(a.o+(U+V)*a.r,b.o-(U+V)*b.r*s);
			ret.emplace_back(a.o+(U-V)*a.r,b.o-(U-V)*b.r*s);
		}
	}
	return ret;
}
bool is_convex(const Polygon&P){
	for(int i=0;i<P.size();i++)
		if(ccw(P[i],P[(i+1)%P.size()],P[(i+2)%P.size()])==CLOCKWISE)return false;
	return true;
}
Polygon convex_full(Polygon P,bool ONSEG){
	if(P.size()<=2)return P;
	sort(P.begin(),P.end());
	Polygon ret(2*P.size());
	int k=0,t;
	if(ONSEG){
		for(const Point&p:P){
			while(k>=2&&ccw(ret[k-2],ret[k-1],p)==CLOCKWISE)k--;
			ret[k++]=p;
		}
		t=k;
		for(int i=P.size()-2;i>=0;i--){
			while(k>=t+1&&ccw(ret[k-2],ret[k-1],P[i])==CLOCKWISE)k--;
			ret[k++]=P[i];
		}
	}
	else{
		for(const Point&p:P){
			while(k>=2&&ccw(ret[k-2],ret[k-1],p)!=COUNTER_CLOCKWISE)k--;
			ret[k++]=p;
		}
		t=k;
		for(int i=P.size()-2;i>=0;i--){
			while(k>=t+1&&ccw(ret[k-2],ret[k-1],P[i])!=COUNTER_CLOCKWISE)k--;
			ret[k++]=P[i];
		}
	}
	ret.resize(k-1);
	int mi=0;
	for(int i=1;i<k-1;i++)
		if(eq(ret[mi].y,ret[i].y)?ret[mi].x>ret[i].x:ret[mi].y>ret[i].y)mi=i;
	rotate(ret.begin(),ret.begin()+mi,ret.end());
	return ret;
}
int contain(const Polygon&P,const Point&p){
	bool in=false;
	for(int i=0;i<P.size();i++){
		Segment s(P[i],P[(i+1)%P.size()]);
		if(intersect(s,p))return ON;
		else{
			Point a=s.p1-p,b=s.p2-p;
			if(a.y>b.y)swap(a,b);
			if(a.y<EPS&&EPS<b.y&&cross(a,b)>EPS)in=!in;
		}
	}
	return in?IN:OUT;
}
int contain(const Circle&c,const Point&p){
	double d=distance(c.o,p);
	return eq(d,c.r)?ON:d<c.r?IN:OUT;
}
int contain(const Circle&c,const Segment&s){
	double d1=distance(c.o,s.p1),d2=distance(c.o,s.p2);
	return d1<c.r+EPS&&d2<c.r+EPS?eq(d1,c.r)||eq(d2,c.r)?ON:IN:OUT;
}
Polygon convex_cut(const Polygon&P,const Line&s){
	Polygon ret;
	for(int i=0;i<P.size();i++){
		Segment t(P[i],P[(i+1)%P.size()]);
		if(ccw(s,t.p1)!=CLOCKWISE)ret.push_back(t.p1);
		if(!parallel(s,t)&&!intersect(s,t.p1)
			&&!intersect(s,t.p2)&&intersect(s,t))ret.push_back(crosspoint(s,t));
	}
	return ret;
}
double diameter(Polygon P){
	if(!is_convex(P))P=convex_full(P);
	int mi=0,Mi=0;
	for(int i=1;i<P.size();i++){
		if(P[i].x<P[mi].x)mi=i;
		if(P[i].x>P[Mi].x)Mi=i;
	}
	double ret=0;
	int sm=mi,sM=Mi;
	while(mi!=sM||Mi!=sm){
		ret=max(ret,norm(P[mi]-P[Mi]));
		if(cross(P[(mi+1)%P.size()]-P[mi],P[(Mi+1)%P.size()]-P[Mi])<0)mi=(mi+1)%P.size();
		else Mi=(Mi+1)%P.size();
	}
	return sqrt(ret);
}
double area(const Polygon&P){
	double ret=0;
	for(int i=0;i<P.size();i++)ret+=cross(P[i],P[(i+1)%P.size()]);
	return ret/2;
}
double area(const Polygon&P,const Line&s){return area(convex_cut(P,s));}
double area(const Polygon&P,const Circle&c){
	double ret=0;
	for(int i=0;i<P.size();i++)
	{
		Segment s(P[i],P[(i+1)%P.size()]);
		if(contain(c,s))ret+=cross(s.p1-c.o,s.p2-c.o);
		else if(!intersect(c,s)){
			double a=arg(s.p2-c.o)-arg(s.p1-c.o);
			if(a>M_PI)a-=2*M_PI;
			if(a<-M_PI)a+=2*M_PI;
			ret+=c.r*c.r*a;
		}
		else
		{
			pair<Point,Point>p=crosspoint(c,s);
			Point tmp[4]={s.p1,p.first,p.second,s.p2};
			if(intersect(c,Segment(s.p1,p.first))==2)swap(tmp[1],tmp[2]);
			for(int j=0;j<3;j++)
			{
				Segment t(tmp[j],tmp[j+1]);
				if(contain(c,t))ret+=cross(t.p1-c.o,t.p2-c.o);
				else{
					double a=arg(t.p2-c.o)-arg(t.p1-c.o);
					if(a>M_PI)a-=2*M_PI;
					if(a<-M_PI)a+=2*M_PI;
					ret+=c.r*c.r*a;
				}
			}
		}
	}
	return ret/2;
}
int N;
main()
{
	while(cin>>N,N)
	{
		Polygon P(N);
		for(int i=0;i<N;i++)cin>>P[i];
		double S=area(P);
		Point O,p;
		double now=1e150;
		for(int i=0;i<N;i++)
		{
			double L=arg(P[i]);
			double R=arg(P[(i+1)%N]);
			if(R<L)R+=2*M_PI;
			for(int i=0;i<50;i++)
			{
				double M1=(L*2+R)/3;
				double M2=(L+R*2)/3;
				if(abs(S-area(P,Line(O,polar(2,M1)))*2)<abs(S-area(P,Line(O,polar(2,M2)))*2))R=M2;
				else L=M1;
			}
			Point q=polar(2,L);
			if(now>abs(S-area(P,Line(O,q))*2))
			{
				now=abs(S-area(P,Line(O,q))*2);
				p=q;
			}
			if(now>abs(S-area(P,Line(O,P[i]))*2))
			{
				now=abs(S-area(P,Line(O,P[i]))*2);
				p=P[i];
			}
		}
		cout<<fixed<<setprecision(15)<<p.x<<" "<<p.y<<endl;
		/*for(int i=0;i<20;i++)
		{
			cout<<fixed<<setprecision(15)<<area(P,Line(O,polar(2,M_PI/20*i)))<<endl;
		}*/
	}
}
accuracy: 0.25
time_ms: 340
memory_kb: 3744
final_rank: 17

code_snippet: using namespace std;
#include<iostream>
#include<algorithm>
#include<vector>
#include<cmath>
#include<iomanip>
const double EPS=1e-10;
bool eq(double a,double b){return abs(a-b)<EPS;}
struct Point{
	double x,y;
	Point(double x_=0,double y_=0):x(x_),y(y_){}
	Point operator-()const{return Point(-x,-y);}
	Point operator+(const Point&p)const{return Point(x+p.x,y+p.y);}
	Point operator-(const Point&p)const{return Point(x-p.x,y-p.y);}
	Point operator*(const double k)const{return Point(x*k,y*k);}
	Point operator/(const double k)const{return Point(x/k,y/k);}
	bool operator<(const Point&p)const{return eq(x,p.x)?y<p.y:x<p.x;}
	bool operator==(const Point&p)const{return eq(x,p.x)&&eq(y,p.y);}
};
istream&operator>>(istream&is,Point&p){return is>>p.x>>p.y;}
ostream&operator<<(ostream&os,const Point&p){return os<<fixed<<setprecision(9)<<p.x<<' '<<p.y;}
struct Line{
	Point p1,p2;
	Line(Point p1_=Point(),Point p2_=Point()):p1(p1_),p2(p2_){}
};
struct Segment:Line{
	Segment(Point p1_=Point(),Point p2_=Point()):Line(p1_,p2_){}
};
struct Circle{
	Point o;
	double r;
	Circle(Point o_=Point(),double r_=0):o(o_),r(r_){}
};
using Polygon=vector<Point>;
//function list begin
Point vec(const Line&);
double norm(const Point&);
double norm(const Line&);
double abs(const Point&);
double abs(const Line&);
double arg(const Point&);
double arg(const Line&);
double arg(const Point&,const Point&,const Point&);//a->b->c
double dot(const Point&,const Point&);
double cross(const Point&,const Point&);
Point polar(const double,const double);
Point rotate(const Point&,const double);
enum{ONLINE_FRONT=-2,CLOCKWISE=-1,ON_SEGMENT=0,COUNTER_CLOCKWISE=1,ONLINE_BACK=2};
int ccw(const Point&,const Point&,const Point&);
int ccw(const Line&,const Point&);
bool orthogonal(const Point&,const Point&);
bool orthogonal(const Line&,const Line&);
bool parallel(const Point&,const Point&);
bool parallel(const Line&,const Line&);
bool intersect(const Line&,const Point&);
bool intersect(const Line&,const Line&);
bool intersect(const Segment&,const Point&);
bool intersect(const Segment&,const Segment&);
bool intersect(const Line&,const Segment&);
bool intersect(const Segment&,const Line&);
bool intersect(const Circle&,const Point&);
int intersect(const Circle&,const Line&);//count contacts
int intersect(const Circle&,const Segment&);
int intersect(const Circle&,const Circle&);
double distance(const Point&,const Point&);
double distance(const Line&,const Point&);
double distance(const Line&,const Line&);
double distance(const Segment&,const Point&);
double distance(const Segment&,const Segment&);
double distance(const Line&,const Segment&);
double distance(const Segment&,const Line&);
double distance(const Circle&,const Point&);
double distance(const Circle&,const Line&);
double distance(const Circle&,const Segment&);
double distance(const Circle&,const Circle&);
Point projection(const Line&,const Point&);
Point reflection(const Line&,const Point&);
Point crosspoint(const Line&,const Line&);
pair<Point,Point>crosspoint(const Circle&,const Line&);
pair<Point,Point>crosspoint(const Circle&,const Segment&);
pair<Point,Point>crosspoint(const Circle&,const Circle&);
pair<Point,Point>tangent(const Circle&,const Point&);
vector<Line>tangent(const Circle&,const Circle&);
bool is_convex(const Polygon&);
Polygon convex_full(Polygon,bool=false);
enum{OUT,ON,IN};
int contain(const Polygon&,const Point&);
int contain(const Circle&,const Point&);
int contain(const Circle&,const Segment&);
Polygon convex_cut(const Polygon&,const Line&);
double diameter(Polygon);
double area(const Polygon&);
double area(const Polygon&,const Line&);
double area(const Polygon&,const Circle&);
//function list end
Point vec(const Line&s){return s.p2-s.p1;}
double norm(const Point&p){return p.x*p.x+p.y*p.y;}
double norm(const Line&s){return norm(vec(s));}
double abs(const Point&p){return hypot(p.x,p.y);}
double abs(const Line&s){return abs(vec(s));}
double arg(const Point&p){return atan2(p.y,p.x);}
double arg(const Line&s){return arg(vec(s));}
double arg(const Point&a,const Point&b,const Point&c){
	double A=arg(b-a),B=arg(c-b);
	double theta=abs(A-B);
	return min(theta,2*M_PI-theta);
}
double dot(const Point&a,const Point&b){return a.x*b.x+a.y*b.y;}
double cross(const Point&a,const Point&b){return a.x*b.y-a.y*b.x;}
Point polar(const double r,const double theta){return Point(cos(theta),sin(theta))*r;}
Point rotate(const Point&p,const double theta){
	return Point(p.x*cos(theta)-p.y*sin(theta),p.x*sin(theta)+p.y*cos(theta));
}
int ccw(const Point&a,const Point&b,const Point&c){
	Point p=b-a,q=c-a;
	return cross(p,q)>EPS?COUNTER_CLOCKWISE
		:cross(p,q)<-EPS?CLOCKWISE
		:dot(p,q)<0?ONLINE_BACK
		:norm(p)<norm(q)?ONLINE_FRONT
		:ON_SEGMENT;
}
int ccw(const Line&s,const Point&p){return ccw(s.p1,s.p2,p);}
bool orthogonal(const Point&a,const Point&b){return eq(dot(a,b),0);}
bool orthogonal(const Line&s,const Line&t){return orthogonal(vec(s),vec(t));}
bool parallel(const Point&a,const Point&b){return eq(cross(a,b),0);}
bool parallel(const Line&s,const Line&t){return parallel(vec(s),vec(t));}
bool intersect(const Line&s,const Point&p){return eq(cross(vec(s),p-s.p1),0);}
bool intersect(const Line&s,const Line&t){return !parallel(s,t)||intersect(s,t.p1);}
bool intersect(const Segment&s,const Point&p){return ccw(s,p)==ON_SEGMENT;}
bool intersect(const Segment&s,const Segment&t){
	return ccw(s,t.p1)*ccw(s,t.p2)<=0&&ccw(t,s.p1)*ccw(t,s.p2)<=0;
}
bool intersect(const Line&s,const Segment&t){
	return cross(vec(s),t.p1-s.p1)*cross(vec(s),t.p2-s.p1)<EPS;
}
bool intersect(const Segment&s,const Line&t){return intersect(t,s);}
bool intersect(const Circle&c,const Point&p){return eq(distance(c.o,p),c.r);}
int intersect(const Circle&c,const Line&s){
	double d=distance(s,c.o);
	return eq(d,c.r)?1:d<c.r?2:0;
}
int intersect(const Circle&c,const Segment&s){
	Point h=projection(s,c.o);
	double d1=distance(c.o,s.p1),d2=distance(c.o,s.p2);
	return distance(c.o,h)>c.r+EPS?0
		:d1<c.r-EPS&&d2<c.r-EPS?0
		:d1<c.r-EPS&&d2>c.r-EPS||d1>c.r-EPS&&d2<c.r-EPS?1
		:intersect(s,h)?eq(distance(c.o,h),c.r)?1:2
		:0;
}
int intersect(const Circle&a,const Circle&b){
	double d=distance(a.o,b.o);
	return eq(d,a.r+b.r)?3:d>a.r+b.r?4:eq(d,abs(a.r-b.r))?1:d>abs(a.r-b.r)?2:0;
}
double distance(const Point&a,const Point&b){return abs(a-b);}
double distance(const Line&s,const Point&p){return distance(p,projection(s,p));}
double distance(const Line&s,const Line&t){return intersect(s,t)?0:distance(s,t.p1);}
double distance(const Segment&s,const Point&p){
	return distance(p,
		dot(vec(s),p-s.p1)<0?s.p1
		:dot(-vec(s),p-s.p2)<0?s.p2
		:projection(s,p)
	);
}
double distance(const Segment&s,const Segment&t){
	return intersect(s,t)?0:min({
		distance(s,t.p1),distance(s,t.p2),
		distance(t,s.p1),distance(t,s.p2)
	});
}
double distance(const Line&s,const Segment&t){
	return intersect(s,t)?0:min(distance(s,t.p1),distance(s,t.p2));
}
double distance(const Segment&s,const Line&t){return distance(t,s);}
double distance(const Circle&c,const Point&p){return abs(distance(c.o,p)-c.r);}
double distance(const Circle&c,const Line&s){return max(distance(s,c.o)-c.r,0.);}
double distance(const Circle&c,const Segment&s){
	return intersect(c,s)?0
		:contain(c,s)?c.r-max(distance(c.o,s.p1),distance(c.o,s.p2))
		:distance(s,c.o)-c.r;
}
double distance(const Circle&a,const Circle&b){return max(distance(a.o,b.o)-a.r-b.r,0.);}
Point projection(const Line&s,const Point&p){
	return s.p1+vec(s)*dot(p-s.p1,vec(s))/norm(s);
}
Point reflection(const Line&s,const Point&p){return projection(s,p)*2-p;}
Point crosspoint(const Line&s,const Line&t){
	double d1=abs(cross(vec(s),t.p1-s.p1));
	double d2=abs(cross(vec(s),t.p2-s.p1));
	return t.p1+vec(t)*(d1/(d1+d2));
}
pair<Point,Point>crosspoint(const Circle&c,const Line&s){
	Point h=projection(s,c.o);
	Point e=vec(s)/abs(s)*sqrt(c.r*c.r-norm(h-c.o));
	return minmax(h-e,h+e);
}
pair<Point,Point>crosspoint(const Circle&c,const Segment&s){
	pair<Point,Point>p=crosspoint(c,Line(s));
	return intersect(c,s)==2?p
		:intersect(s,p.first)?make_pair(p.first,p.first)
		:make_pair(p.second,p.second);
}
pair<Point,Point>crosspoint(const Circle&a,const Circle&b){
	double d=distance(a.o,b.o);
	double alpha=acos((a.r*a.r+d*d-b.r*b.r)/(2*a.r*d));
	double theta=arg(b.o-a.o);
	return minmax(a.o+polar(a.r,theta+alpha),a.o+polar(a.r,theta-alpha));
}
pair<Point,Point>tangent(const Circle&c,const Point&p){
	return crosspoint(c,Circle(p,sqrt(norm(c.o-p)-c.r*c.r)));
}
vector<Line>tangent(const Circle&a,const Circle&b){
	vector<Line>ret;
	double g=distance(a.o,b.o);
	if(eq(g,0))return ret;
	Point u=(b.o-a.o)/g;
	Point v=rotate(u,M_PI/2);
	for(int s:{-1,1}){
		double h=(a.r+b.r*s)/g;
		if(eq(h*h,1))ret.emplace_back(a.o+(h>0?u:-u)*a.r,a.o+(h>0?u:-u)*a.r+v);
		else if(1-h*h>0){
			Point U=u*h,V=v*sqrt(1-h*h);
			ret.emplace_back(a.o+(U+V)*a.r,b.o-(U+V)*b.r*s);
			ret.emplace_back(a.o+(U-V)*a.r,b.o-(U-V)*b.r*s);
		}
	}
	return ret;
}
bool is_convex(const Polygon&P){
	for(int i=0;i<P.size();i++)
		if(ccw(P[i],P[(i+1)%P.size()],P[(i+2)%P.size()])==CLOCKWISE)return false;
	return true;
}
Polygon convex_full(Polygon P,bool ONSEG){
	if(P.size()<=2)return P;
	sort(P.begin(),P.end());
	Polygon ret(2*P.size());
	int k=0,t;
	if(ONSEG){
		for(const Point&p:P){
			while(k>=2&&ccw(ret[k-2],ret[k-1],p)==CLOCKWISE)k--;
			ret[k++]=p;
		}
		t=k;
		for(int i=P.size()-2;i>=0;i--){
			while(k>=t+1&&ccw(ret[k-2],ret[k-1],P[i])==CLOCKWISE)k--;
			ret[k++]=P[i];
		}
	}
	else{
		for(const Point&p:P){
			while(k>=2&&ccw(ret[k-2],ret[k-1],p)!=COUNTER_CLOCKWISE)k--;
			ret[k++]=p;
		}
		t=k;
		for(int i=P.size()-2;i>=0;i--){
			while(k>=t+1&&ccw(ret[k-2],ret[k-1],P[i])!=COUNTER_CLOCKWISE)k--;
			ret[k++]=P[i];
		}
	}
	ret.resize(k-1);
	int mi=0;
	for(int i=1;i<k-1;i++)
		if(eq(ret[mi].y,ret[i].y)?ret[mi].x>ret[i].x:ret[mi].y>ret[i].y)mi=i;
	rotate(ret.begin(),ret.begin()+mi,ret.end());
	return ret;
}
int contain(const Polygon&P,const Point&p){
	bool in=false;
	for(int i=0;i<P.size();i++){
		Segment s(P[i],P[(i+1)%P.size()]);
		if(intersect(s,p))return ON;
		else{
			Point a=s.p1-p,b=s.p2-p;
			if(a.y>b.y)swap(a,b);
			if(a.y<EPS&&EPS<b.y&&cross(a,b)>EPS)in=!in;
		}
	}
	return in?IN:OUT;
}
int contain(const Circle&c,const Point&p){
	double d=distance(c.o,p);
	return eq(d,c.r)?ON:d<c.r?IN:OUT;
}
int contain(const Circle&c,const Segment&s){
	double d1=distance(c.o,s.p1),d2=distance(c.o,s.p2);
	return d1<c.r+EPS&&d2<c.r+EPS?eq(d1,c.r)||eq(d2,c.r)?ON:IN:OUT;
}
Polygon convex_cut(const Polygon&P,const Line&s){
	Polygon ret;
	for(int i=0;i<P.size();i++){
		Segment t(P[i],P[(i+1)%P.size()]);
		if(ccw(s,t.p1)!=CLOCKWISE)ret.push_back(t.p1);
		if(!parallel(s,t)&&!intersect(s,t.p1)
			&&!intersect(s,t.p2)&&intersect(s,t))ret.push_back(crosspoint(s,t));
	}
	return ret;
}
double diameter(Polygon P){
	if(!is_convex(P))P=convex_full(P);
	int mi=0,Mi=0;
	for(int i=1;i<P.size();i++){
		if(P[i].x<P[mi].x)mi=i;
		if(P[i].x>P[Mi].x)Mi=i;
	}
	double ret=0;
	int sm=mi,sM=Mi;
	while(mi!=sM||Mi!=sm){
		ret=max(ret,norm(P[mi]-P[Mi]));
		if(cross(P[(mi+1)%P.size()]-P[mi],P[(Mi+1)%P.size()]-P[Mi])<0)mi=(mi+1)%P.size();
		else Mi=(Mi+1)%P.size();
	}
	return sqrt(ret);
}
double area(const Polygon&P){
	double ret=0;
	for(int i=0;i<P.size();i++)ret+=cross(P[i],P[(i+1)%P.size()]);
	return ret/2;
}
double area(const Polygon&P,const Line&s){return area(convex_cut(P,s));}
double area(const Polygon&P,const Circle&c){
	double ret=0;
	for(int i=0;i<P.size();i++)
	{
		Segment s(P[i],P[(i+1)%P.size()]);
		if(contain(c,s))ret+=cross(s.p1-c.o,s.p2-c.o);
		else if(!intersect(c,s)){
			double a=arg(s.p2-c.o)-arg(s.p1-c.o);
			if(a>M_PI)a-=2*M_PI;
			if(a<-M_PI)a+=2*M_PI;
			ret+=c.r*c.r*a;
		}
		else
		{
			pair<Point,Point>p=crosspoint(c,s);
			Point tmp[4]={s.p1,p.first,p.second,s.p2};
			if(intersect(c,Segment(s.p1,p.first))==2)swap(tmp[1],tmp[2]);
			for(int j=0;j<3;j++)
			{
				Segment t(tmp[j],tmp[j+1]);
				if(contain(c,t))ret+=cross(t.p1-c.o,t.p2-c.o);
				else{
					double a=arg(t.p2-c.o)-arg(t.p1-c.o);
					if(a>M_PI)a-=2*M_PI;
					if(a<-M_PI)a+=2*M_PI;
					ret+=c.r*c.r*a;
				}
			}
		}
	}
	return ret/2;
}
int N;
main()
{
	while(cin>>N,N)
	{
		Polygon P(N);
		for(int i=0;i<N;i++)cin>>P[i];
		double S=area(P);
		Point O,p;
		double now=1e150;
		for(int i=0;i<N;i++)
		{
			double L=arg(P[i]);
			double R=arg(P[(i+1)%N]);
			if(R<L)R+=2*M_PI;
			for(int i=0;i<50;i++)
			{
				double M1=(L*2+R)/3;
				double M2=(L+R*2)/3;
				if(abs(S-area(P,Line(O,polar(2,M1)))*2)<abs(S-area(P,Line(O,polar(2,M2)))*2))R=M2;
				else L=M1;
			}
			Point q=polar(2,L);
			if(now>abs(S-area(P,Line(O,q))*2))
			{
				now=abs(S-area(P,Line(O,q))*2);
				p=q;
			}
		}
		cout<<fixed<<setprecision(15)<<p.x<<" "<<p.y<<endl;
		/*for(int i=0;i<20;i++)
		{
			cout<<fixed<<setprecision(15)<<area(P,Line(O,polar(2,M_PI/20*i)))<<endl;
		}*/
	}
}
accuracy: 0.25
time_ms: 340
memory_kb: 3700
final_rank: 16