(UVALive 7261)Xiongnu's Land 二分】的更多相关文章

Wei Qing (died 106 BC) was a military general of the Western Han dynasty whose campaigns against the Xiongnu earned him great acclaim. He was a relative of Emperor Wu because he was the younger half-brother of Empress Wei Zifu (Emperor Wu’s wife) and…
思路: 先二分下界,再二分上届. #include <bits/stdc++.h> using namespace std; #define MP make_pair #define PB push_back typedef long long LL; typedef pair<int,int> PII; ; const double pi=acos(-1.0); ; ; struct node { int x,y,w,h; node(){} node(int a,int b,in…
题目链接:https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=5273 Wei Qing (died BC) was a military general of the Western Han dynasty whose campaigns against the Xiongnu earned him great acclaim.…
题目传送门 题意:有多个矩形分布在[0, 0]到[R, R]的的范围内,画一条竖线分割成两块矩形,使得左边包括矩形的面积大于等于右边的面积,在这个前提下使得画的竖线尽量远 分析:二分答案,当面积相等时,判断再往右一个单位是否还可以相等,若不行则答案唯一确定,否则可以往右移动,即最后的竖线要不在一个矩形内或者在矩形边缘时最优. #include <bits/stdc++.h> using namespace std; typedef long long ll; const int N = 1e4…
拿到了icpc北京站的参赛名额 感谢亮哥~ 虽然是地狱之战 但也要全力以赴! 题意: 有一片沙漠 n片绿洲 让你用一条线分成两部分 左≥右 而且分割线要尽量靠右 问线的位置 思路: 网上说可以二分 没太看懂…… 还有一种思路就是线性扫描 将二维的图化成一维的线 然后从头扫一遍 遇到左≥sum/2时试探着向右继续扫 最后输出答案 不知道为啥hihocoder能过uvalive死活就是过不去…… #include<stdio.h> #include<iostream> #include…
题目链接: http://codeforces.com/gym/101194/attachments https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=5922 题意: 给出 $N$ 个冰淇淋球,第 $i$ 个冰淇淋球大小为 $B_i$,现在已知冰淇淋球堆叠起来可组成一个冰淇淋. 对于上下相邻的两个冰淇淋球,只有上面的那个大小不…
Wei Qing (died 106 BC) was a military general of the Western Han dynasty whose campaigns against the Xiongnu earned him great acclaim. He was a relative of Emperor Wu because he was the younger half-brother of Empress Wei Zifu (Emperor Wu’s wife) and…
题意:给你一些区间,再查询一些点,问这些点与所有区间形成的最小距离的最大值.最小距离定义为:如果点在区间内,那么最小距离为0,否则为min(pos-L[i],R[i]-pos). 解法:当然要排个序,仔细想想会发现我们要找的区间的位置满足二分性质,即如果此时pos-L[mid] >= R[mid]-pos,那么我们要找的区间肯定是mid或大于mid,否则,我们要找的区间一定是mid即mid以下.二分找到即可.预处理时要把嵌套在别的区间里的区间忽略掉,因为外面那个区间一定比他更优. 代码: #in…
Uncle Tom's Inherited Land* Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 2013    Accepted Submission(s): 830Special Judge Problem Description Your old uncle Tom inherited a piece of land from…
题意:为每个小伙伴切糕,要求每个小盆友(包括你自己)分得的pie一样大,但是每个人只能分得一份pie,不能拿两份凑一起的. 做法:二分查找切糕的大小,然后看看分出来的个数有没有大于小盆友们的个数,它又没说每个pie都要分完,分不完的留给工作人员吃嘛. 代码: /* * Author: illuz <iilluzen[at]gmail.com> * Blog: http://blog.csdn.net/hcbbt * File: live3652.cpp * Create Date: 2013-…