Good Bye 2019 E

Good Bye 2019 E

The meaning of problems

n n points into two categories, a distance between the intersection of the distance between the different categories and be set the same category is an empty set. structure.

answer

Classification problems.
Did not start thinking, has wanted to go the distance, in fact, can be converted into a judgment parity (there is a network flow before parity is divided by a bipartite graph.
Each point is divided into four categories parity there. Kiki (1), even - even (2), parity (3), the even-odd (4).
it is apparent group 1, group 3 and 4 is not a problem.
since the distance of the same group are even, odd are different
but If it only 1,2 or only 3,4, we can see that first of all, if the attempt divided into two groups.
the same is even still even number ^ 2 + 2 ^ 2 = ^ distance.
the difference is that odd odd ^ 2 = ^ 2+ distance ^ 2.
both simple parity judgment is the same, but can be converted into 4 even-numbered (odd-odd ^ ^ 2 + 2), is obviously not equal to the odd odd ^ ^ 2 + 2, if equal, then reversed this can be converted into even, that is, he is even-even number ^ ^ 2 + 2, but actually it is not.

So long as not only one set, are solvable.
If a group does, if only one group, for example, (4,4) and (6,6), are the same even, but it is (2,2) and (3,3) after / 2. So we can get different through constant / 2.
/ 2 results affect it, / 2 corresponds to the expanded coordinate system, the translation is also possible, if an odd number, then it can first then +1 / 2, for the same the same abscissa and ordinate, i.e., all of the operations are simultaneously can.
It can be reduced to (x + 1) / 2
because of the negative, so we need to add the initial 1e6.

Some people may be concerned that in addition to 0 how to do, in fact, the case. We can even expand only the y axis or x-axis. We use words (x + 1) / 2, it will not change when 1. And the other must be> = 2, that is, in any case will be different, even if now is an odd number will come to 2.
If it is all one? So hope is built on the other side, the other side is certainly not the same, topic to ensure that the different points. It was always the other side because of the different first-1, as described above, and therefore, it must be solvable.

#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define sf(x) scanf("%d",&x)
using namespace std;
 
typedef long long ll;
const int maxn = 200050;
const int bs=1000050;
 
int n;
vector<int>G[4];
struct node{int x,y;}A[maxn];
 
bool check(){
    int one=0;
    for(int i=1;i<=4;i++)G[i-1].clear();
    for(int i=1;i<=n;i++){
        int tmp=(A[i].x%2)*2+A[i].y%2;
        G[tmp].push_back(i);
    }
    for(int i=1;i<=4;i++){
        if(G[i-1].size()==n)return false;
    }
    return true;
}//00同偶,01一偶一奇,10一奇一偶,11一奇一奇
 
int main(){
    cin>>n;
    for(int i=1;i<=n;i++)scanf("%d%d",&A[i].x,&A[i].y),A[i].x+=bs,A[i].y+=bs;
    while(!check()){
        for(int i=1;i<=n;i++){
            A[i].x=(A[i].x+1)/2;
            A[i].y=(A[i].y+1)/2;
        }
    }
    if(G[0].size()+G[3].size()==n){
       // puts("?");
        cout<<G[0].size()<<endl;
        for(auto x:G[0])cout<<x<<" ";
    }
    else if(G[1].size()+G[2].size()==n){
        //puts("??");
        cout<<G[1].size()<<endl;
        for(auto x:G[1])cout<<x<<" ";
    }
    else{
        cout<<G[1].size()+G[2].size()<<endl;
        for(auto x:G[1])cout<<x<<" ";
        for(auto x:G[2])cout<<x<<" ";
    }
}
Published 203 original articles · won praise 17 · views 20000 +

Guess you like

Origin blog.csdn.net/mxYlulu/article/details/104012397
Recommended