树状数组 - 2352 Stars】的更多相关文章

题目地址: http://poj.org/problem?id=2352 分析: - 题意分析:  有n个星星, 它的左下方(x和y不超过它)的星星的数目就是它的level, 分别计算level 为 0 到 n-1 的星星的数目. 输入是先按照 y 从小到大排序, 如果y相同,就按照x递增排序, 不会有2个以上星星占同一个坐标. - 数据结构 - 用原始数据数组 a 表示同一个x坐标的星星数目. (a[i]为x坐标为 i-1的星星数目).  注意输入数据时排序的. - 树状数组s维护a的信息.…
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 that are not higher and not to the right of the given star. As…
2019-05-20 22:52:07 加油,坚持,加油,坚持 !!! #include<iostream> #include<cstdio> #include<cstring> using namespace std; ; int c[MAXN],level[MAXN],n; int lowbit(int x){return x & (-x);} // 求前n项的和 int sum(int n){ ; ){ sum += c[n]; n -= lowbit(n…
Stars Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 30496   Accepted: 13316 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 st…
Stars Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 4052    Accepted Submission(s): 1592 Problem Description Astronomers often examine star maps where stars are represented by points on a plan…
一開始想,总感觉是DP,但是最后什么都没想到.还暴力的交了一发. 然后開始写线段树,结果超时.感觉自己线段树的写法有问题.改天再写.先把树状数组的写法贴出来吧. ~~~~~~~~~~~~~~~~~~~~~~~~ 树状数组不懂的去看刘汝佳的大白书,那个图画得非常清楚. 题目大意:星星的坐标以y递增的顺序给出,这些点的左下方的点数代表这个点的级数,问0~N-1的级数有多少个?事实上y根本木实用. 题目链接:http://poj.org/problem?id=2352 http://acm.hdu.e…
/** * @author johnsondu * @time 2015-8-22 * @type Binary Index Tree * ignore the coordinate of y and * process as 1D conditions. * @url http://poj.org/problem?id=2352 */ #include <iostream> #include <cstdio> #include <cmath> #include <…
Language:Default Stars Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 52268 Accepted: 22486 Description Astronomers often examine star maps where stars are represented by points on a plane and each star has Cartesian coordinates. Let the…
Stars Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 54352   Accepted: 23386 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 st…
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 that are not higher and not to the right of the given star. Astronomers wa…