CF120J.Minimum Sum

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

You are given a set of nn vectors on a plane. For each vector you are allowed to multiply any of its coordinates by -1. Thus, each vector vi=(xi,yi)v_{i}=(x_{i},y_{i}) can be transformed into one of the following four vectors:

  • vi1=(xi,yi)v_{i}^{1}=(x_{i},y_{i}) ,
  • vi2=(xi,yi)v_{i}^{2}=(-x_{i},y_{i}) ,
  • vi3=(xi,yi)v_{i}^{3}=(x_{i},-y_{i}) ,
  • vi4=(xi,yi)v_{i}^{4}=(-x_{i},-y_{i}) .

You should find two vectors from the set and determine which of their coordinates should be multiplied by -1 so that the absolute value of the sum of the resulting vectors was minimally possible. More formally, you should choose two vectors viv_{i} , vjv_{j} ( 1<=i,j<=n,ij1<=i,j<=n,i≠j ) and two numbers k1k_{1} , k2k_{2} ( 1<=k1,k2<=41<=k_{1},k_{2}<=4 ), so that the value of the expression vik1+vjk2|v_{i}^{k_{1}}+v_{j}^{k_{2}}| were minimum.

输入格式

The first line contains a single integer nn ( 2<=n<=1052<=n<=10^{5} ). Then nn lines contain vectors as pairs of integers " xix_{i} yiy_{i} " ( 10000<=xi,yi<=10000-10000<=x_{i},y_{i}<=10000 ), one pair per line.

输出格式

Print on the first line four space-separated numbers " ii k1k_{1} jj k2k_{2} " — the answer to the problem. If there are several variants the absolute value of whose sums is minimum, you can print any of them.

输入输出样例

  • 输入#1

    5
    -7 -3
    9 0
    -8 6
    7 -8
    4 -5
    

    输出#1

    3 2 4 2
    
  • 输入#2

    5
    3 2
    -4 7
    -6 0
    -8 4
    5 1
    

    输出#2

    3 4 5 4
    

说明/提示

A sum of two vectors v=(xv,yv)v=(x_{v},y_{v}) and u=(xu,yu)u=(x_{u},y_{u}) is vector s=v+u=(xv+xu,yv+yu)s=v+u=(x_{v}+x_{u},y_{v}+y_{u}) .

An absolute value of vector v=(x,y)v=(x,y) is number .

In the second sample there are several valid answers, such as:

(3 1 4 2), (3 1 4 4), (3 4 4 1), (3 4 4 3), (4 1 3 2), (4 1 3 4), (4 2 3 1).

首页