【题意描述】就是给定n个星星的x,y坐标,y坐标按照从小到大的顺序进行排列,x坐标随机排列。下面求对于每个星星而言,其它星星的x,y的坐标都小于等于该星星的数目,然后输出所有的情况。【思路分析】我们这道题可以采用树状数组求解,将x+1作为树状数组的底标。【AC代码】#include #includ....
分类:
其他好文 时间:
2014-08-08 12:29:55
阅读次数:
182
??
Problem Description
Astronomers often examine star maps where stars are represented by points on a plane and each star has Cartesian coordinates. Let the level of a star be an amount of the stars...
分类:
其他好文 时间:
2014-08-07 13:17:10
阅读次数:
247
先排序后二分。 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 7 #define MAXN 1005 8 9 typedef struct {10 int x, y;11 } node_s...
分类:
其他好文 时间:
2014-08-04 01:52:36
阅读次数:
323
A -StarsTime Limit:1000MSMemory Limit:65536KB64bit IO Format:%I64d & %I64uDescriptionAstronomers often examine star maps where stars are represented b...
分类:
其他好文 时间:
2014-08-03 20:25:05
阅读次数:
270
绝对大坑。千万记住树状数组0好下标位置是虚拟节点。详见大白书P195。其实肉眼看也能得出,在add(有的也叫update)的点修改操作中如果传入0就会死循环。最后TLE。所以下标+1解决问题。上代码! 1 #include 2 #include 3 #include 4 #include 5...
分类:
其他好文 时间:
2014-07-27 21:58:39
阅读次数:
288
树状数组,果断1A啦,心情舒畅啊,哈哈
先按照y轴从小到大排序,然后一次加入并统计每个点得x坐标,这道题数据不严谨啊,在y轴相同得情况下,应该以x轴从大到小排序,可我都没排x轴就过了
#include
#include
#include
#include
using namespace std;
int Max;
struct node{
int x,y;
}a[15005];
int...
分类:
其他好文 时间:
2014-07-24 10:23:24
阅读次数:
185
题目大意:
求一个窗口覆盖最多的星星的权值。
思路分析:
每一个星星看成
左下点为x y
右上点为x+w-1 y+h-1 的矩形。
然后求出最大覆盖的和。
#include
#include
#include
#include
#define lson num<<1,s,mid
#define rson num<<1|1,mid+1,e
#define max...
题意就是一颗星星的左下方有多少颗星星就是几级;
把每级的星星个数统计好输出就ok;
但不能用二维树状数组,会超内存,,
#include
#include
#include
#define maxn 32001
using namespace std;
int a;
int arr[maxn];
int low(int x)
{
return x&(-x);
}
void u...
分类:
其他好文 时间:
2014-07-21 13:38:26
阅读次数:
213
#include #include #include #include #define MAX 256void move_stars(char* str) { int len = strlen(str) - 1; char* p = str + len; char* ...
分类:
移动开发 时间:
2014-07-16 19:15:02
阅读次数:
200
Stars
Time Limit: 1000MS
Memory Limit: 65536K
Total Submissions: 31172
Accepted: 13595
Description
Astronomers often examine star maps where stars are represented b...
分类:
其他好文 时间:
2014-07-13 14:10:34
阅读次数:
206