2013ACM-ICPC杭州赛区全国邀请赛总结
2013-08-10 21:09
381 查看
A.Robot(hdu 4576)
思路:
直接暴力之...现场赛的时候被这题坑成狗,怎么算复杂度也不够...求300MS的解法T^T
hdu 4585
思路:
直接暴力之...现场赛的时候被这题坑成狗,怎么算复杂度也不够...求300MS的解法T^T
#include <iostream> #include<cstdio> #include<cstring> #include<algorithm> #include <map> #include <set> using namespace std; struct Point{ int id,x; bool operator <(const Point & tem)const{ return x<tem.x; } }; set<Point>q; int main() { int n,Id,num; while(scanf("%d",&n)!=EOF) { if(n==0) break; Point hehe; hehe.id=1; hehe.x=1000000000; q.clear(); q.insert(hehe); for(int i=2;i<=n+1;i++) { scanf("%d%d",&Id,&num); hehe.id=Id; hehe.x=num; set<Point>::iterator now =q.lower_bound(hehe),tem1,tem2; tem1=tem2=now; if(tem1!=q.begin())tem1--; int va1=(num-tem1->x),va2=(tem2->x-num); if(va2<va1) printf("%d %d\n",Id,tem2->id); else printf("%d %d\n",Id,tem1->id); q.insert(hehe); } } return 0; }
hdu 4585
相关文章推荐
- HDU 4582 DFS spanning tree(DFS+贪心)(2013ACM-ICPC杭州赛区全国邀请赛)
- 2013ACM-ICPC杭州赛区全国邀请赛 ——Robot
- 2013ACM-ICPC杭州赛区全国邀请赛——Random Walk
- 2013ACM-ICPC杭州赛区全国邀请赛(题目重现)
- 2013ACM-ICPC杭州赛区全国邀请赛——Random Walk
- 2013ACM-ICPC杭州赛区全国邀请赛——X-Boxes
- hdu 4585 Shaolin 2013 ACM-ICPC杭州赛区全国邀请赛——题目重现
- hdu 4578 Transformation 2013ACM-ICPC杭州赛区全国邀请赛
- hdu 4576 robot 2013 ACM-ICPC杭州赛区全国邀请赛——题目重现-1001-robot
- HDU 4587 TWONODES (tarjan) (2013ACM-ICPC南京赛区全国邀请赛)
- hdu4577 X-Boxes ACM-ICPC杭州赛区全国邀请赛 2
- hdu4576 Robot 2013 ACM-ICPC杭州赛区全国邀请赛 1
- 2013 ACM-ICPC杭州赛区全国邀请赛——题目重现
- hdu 4584 building-bridge 暴力的题,怎么暴力怎么干。。2013 ACM-ICPC杭州赛区全国邀请赛——题目重现
- hdu 4585 Shaolin 2013 ACM-ICPC杭州赛区全国邀请赛——题目重现
- HDU 4573 Throw the Stones(动态三维凸包)(2013 ACM-ICPC长沙赛区全国邀请赛)
- HDU 4565 So Easy!(数学+矩阵快速幂)(2013 ACM-ICPC长沙赛区全国邀请赛)
- HDU 4569 Special equations(枚举+数论)(2013 ACM-ICPC长沙赛区全国邀请赛)
- 2013 ACM-ICPC长沙赛区全国邀请赛——Bottles Arrangement
- 2013 ACM-ICPC南京赛区全国邀请赛