您的位置:首页 > 其它

Codeforces Round #319 (Div. 1)C. Points on Plane 分块思想

2015-10-10 21:08 148 查看
[b] C. Points on Plane[/b]

On a plane are n points (xi, yi) with integer coordinates between 0 and 106. The distance between the two points with numbers a and bis said to be the following value:

///1085422276
#include<bits/stdc++.h>
using namespace std ;
typedef long long ll;
#define mem(a) memset(a,0,sizeof(a))
#define meminf(a) memset(a,127,sizeof(a));
#define TS printf("111111\n");
#define FOR(i,a,b) for( int i=a;i<=b;i++)
#define FORJ(i,a,b) for(int i=a;i>=b;i--)
#define READ(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define inf 100000
inline ll read()
{
ll x=0,f=1;
char ch=getchar();
while(ch<'0'||ch>'9')
{
if(ch=='-')f=-1;
ch=getchar();
}
while(ch>='0'&&ch<='9')
{
x=x*10+ch-'0';
ch=getchar();
}
return x*f;
}
//****************************************
#define maxn 1000000+10

pair<pair<int ,int >,int > P[maxn];
int main()
{

int n=read();
int x,y;
FOR(i,1,n)
{
x=read();
y=read();
P[i].first.first=x/1005;//注意
P[i].first.second=y;
P[i].second=i;
}
sort(P+1,P+n+1);
FOR(i,1,n)
{
cout<<P[i].second<<" ";
}
return 0;
}


代码
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: