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:
代码
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; }
代码
相关文章推荐
- 第一阶段考核中的JAVA简答题
- Drupal8 新建第一个模块
- opencv 应用程序无法正常启动(0xooooo7b)
- C++Primer第五版 练习11.31-32(解答)
- leetcode-reverse words in a string
- POJ 1661 Help Jimmy (DP)
- min 宏定义 避免副作用
- Validform 学习笔记---代码练习
- mybatis02 架构
- UML——类图
- FastDFS安装部署
- 编写一个C#程序,要求从键盘输入10个数存放在数组中,分别求出最大数和最小数存放在第一第二个元素里
- Android每日范例——密码输入框
- 解析JSON数据系列1:在网页上显示Json数据
- SDOI(队列)
- Struts2中配置默认Action
- 使用命令备份和恢复OSX系统分区
- C++Primer第五版 练习11.28(解答)
- html初学(这两天带着一个女孩写div+css,总感觉她理解的方式不是很对)
- jquery特效(3)—轮播图①(手动点击轮播)