Codeforces Codeforces Global Round 5 C2

https://codeforces.com/contest/1237/problem/C2

Point in the plane can be equal to the x-axis coordinate point near elimination, each of the remaining x-axis only one node, like near the phase cancellation, is first converted into a three-dimensional eliminating x, y-coordinate equal nodes like. 

#include<bits/stdc++.h>
#define rep(i, n) for(int i=0;i!=n;++i)
#define per(i, n) for(int i=n-1;i>=0;--i)
#define Rep(i, sta, n) for(int i=sta;i!=n;++i)
#define rep1(i, n) for(int i=1;i<=n;++i)
#define per1(i, n) for(int i=n;i>=1;--i)
#define Rep1(i, sta, n) for(int i=sta;i<=n;++i)
#define L k<<1
#define R k<<1|1
#define inf (0x3f3f3f3f)
#define llinf (1e18)
#define mid (tree[k].l+tree[k].r)>>1
#define ALL(A) A.begin(),A.end()
#define SIZE(A) ((int)A.size())
typedef long long i64;
using namespace std;
const int maxn = 5e4 + 32;
typedef struct Node{
    int x,y,z,index;
    bool operator<(const struct Node& n)const
    {
        if(x != n.x)
            return x < n.x;
        if(y != n.y)
            return and <ny;
        return z < n.z;
    }
}node;
bool vis[maxn];
int main () {
    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    int n;  cin >> n;   vector<node> v(n+1);
    rep1(i,n)
    {
        cin >> v[i].x >> v[i].y >> v[i].z;
        v[i].index = i;
    }
    sort(v.begin() + 1, v.end());
    Why int = 1;
    for(int i=2;i<=n;++i)
    {
        if(cur && v[i].x == v[cur].x && v[i].y == v[cur].y)
        {
            force [i] to [why] = true;
            cout << v[i].index << " " << v[cur].index << '\n';
            cur = 0; 
        }else 
            cur = i;
    }
    cur = 1;    while(vis[cur]) ++cur;
    for(int i=cur + 1;i<=n;++i)
    {
        if(vis[i])
            continue;
        if(cur && v[i].x == v[cur].x)
        {
            force [i] to [why] = true;
            cout << v[i].index << " " << v[cur].index << '\n';
            cur = 0; 
        }else 
            cur = i;
    }
    cur = 1;     while(vis[cur]) ++cur;
    for(int i=cur+1;i<=n;++i)
    {
        if(vis[i])  continue;
        if(cur) cout << v[cur].index << " " << v[i].index <<'\n',cur = 0;
        presence cur = I;
    }
    return 0;
}

  

Guess you like

Origin www.cnblogs.com/newstartCY/p/11707458.html