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

Stars Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 39186 Accepted: 17027 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 b…
emm,ssy说可以直接CDQ分治...%%%但是注意到y是有序的,所以可以直接求一下前缀和就行了. 题干: 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…
题意:输入一n颗星星的x,y坐标,给定判断level的标准,即某颗星星左下边(不高于它,不超过他,相当于以他为基准的第三象限)星星的数目为level, 输出level从0到n的星星个数. //poj2352 #include <iostream> #include <string> #include <cstring> #include <queue> #include <vector> #include <cstdio> using…
Stars Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 37323 Accepted: 16278 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 b…
http://acm.hdu.edu.cn/showproblem.php?pid=1541 Stars Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 5993    Accepted Submission(s): 2384 Problem Description Astronomers often examine star maps…
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…
题目链接:https://cn.vjudge.net/problem/HDU-1541 题意 天上有许多星星 现给天空一个平面坐标轴,统计每个星星的level, level是指某一颗星星的左下角(x<=x0 && y<=y0)的星星总数 注意数据以yx排序输入 思路 怎么想也想不到如何查询 若用传统O(n^3)查询必然超时 于是想到记忆化搜索不断读写dp[y][x]即可,目测O(n^2)大一点 算了一下时间空间都不大可行,苦思冥想没有思路,看了别人的题解才晃然大雾 用树状数组维…
题目链接:https://vjudge.net/problem/POJ-2352 题意:在直角坐标系中给出n个点的 (x,y),(0<=x,y<=32000),定义每个点的level为(x',y')的数量,其中x'<=x,y'<=y.输出所有level的点的个数. 思路:这几天开始写树状数组的题,加油!!因为输入为按y升序排列,在y相等时按x升序排列.所以当输入点i时,对其level有贡献的点一定在点i之前,而不会在其后.所以点i的level为之前出现的点的横坐标<=xi的个…
一開始想,总感觉是DP,但是最后什么都没想到.还暴力的交了一发. 然后開始写线段树,结果超时.感觉自己线段树的写法有问题.改天再写.先把树状数组的写法贴出来吧. ~~~~~~~~~~~~~~~~~~~~~~~~ 树状数组不懂的去看刘汝佳的大白书,那个图画得非常清楚. 题目大意:星星的坐标以y递增的顺序给出,这些点的左下方的点数代表这个点的级数,问0~N-1的级数有多少个?事实上y根本木实用. 题目链接:http://poj.org/problem?id=2352 http://acm.hdu.e…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1541 题目大意就是统计其左上位置的星星的个数 由于y已经按升序排列,因此只用按照x坐标生成一维树状数组即可 比较简单的题目: 代码: #include<iostream> #include<cstring> #include<cstdio> #include<cstdlib> #include<algorithm> using namespace s…