Divide Points CodeForces - 1270E

You are given a set of n≥2n≥2 pairwise different points with integer coordinates. Your task is to partition these points into two nonempty groups AA and BB, such that the following condition holds:

For every two points PP and QQ, write the between them on the blackboard: if they belong to the same group — with a yellow pen, and if they belong to different groups — with a bluepen. Then no yellow number is equal to any blue number.

It is guaranteed that such a partition exists for any possible input. If there exist multiple partitions, you are allowed to output any of them.

Input

The first line contains one integer nn (2≤n≤103)(2≤n≤103) — the number of points.

The ii-th of the next nn lines contains two integers xixi and yiyi (−106≤xi,yi≤106−106≤xi,yi≤106) — the coordinates of the ii-th point. 

It is guaranteed that all nn points are pairwise different.

Output

In the first line, output aa (1≤a≤n−11≤a≤n−1) — the number of points in a group AA.

In the second line, output aa integers — the indexes of points that you include into group AA.

If there are multiple answers, print any.

Examples

Input

3 0 0 0 1 1 0

Output

1 1

Input

4 0 1 0 -1 1 0 -1 0

Output

2 1 2

Input

3 -2 1 1 1 -1 0

Output

1 2

Input

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

Output

1 6  

Input

2 -1000000 -1000000 1000000 1000000

Output

1 1

Note 

In the first example, we set point (0,0)(0,0) to group AA and points (0,1)(0,1) and (1,0)(1,0) to group BB. In this way, we will have 11 yellow number 2–√2 and 22 blue numbers 11 on the blackboard.

In the second example, we set points (0,1)(0,1) and (0,−1)(0,−1) to group AA and points (−1,0)(−1,0) and (1,0)(1,0) to group BB. In this way, we will have 22 yellow numbers 22, 44 blue numbers 2–√2 on the blackboard.


#include<iosteam>

#include<cstdio>

#include<cmath>

#include<vector>

using namespace std;

const int inf=1e9;

const int mod=1e9+10;

const int maxn=1e5+10;

int n;

int x[1005],y[1005];

vector<int>a[2][2];

int main()

{

    cin>>n;

    for(int i=1;i<=n;i++)

        cin>>x[i]>>y[i];

    int flag=1;

    for(int i=n;i>=1;i--)

    {

        x[i]-=x[1],y[i]-=y[1];

        if(x[i]&1) flag=0;

        if(y[i]&1) flag=0;

    }

    while(flag)

    {

        for(int i=1;i<=n;i++)

        {

            x[i]/=2;y[i]/=2;

            if(x[i]&1) flag=0;

            if(y[i]&1) flag=0;

        }

    }

    for(int i=1;i<=n;i++)

    {

        a[x[i]&1][y[i]&1].push_back(i);

    }

    if(!a[0][1].empty()||!a[1][0].empty())

    {

        cout<<(int)(a[0][0].size()+a[1][1].size())<<endl;

        for(int x:a[0][0]) cout<<x<<" ";

        for(int x:a[1][1]) cout<<x<<" ";

    }

    else

    {

        cout<<(int)a[0][0].size()<<endl;

        for(int x:a[0][0]) cout<<x<<" ";

    }

    return 0;

}


评论

热度(6)