POJ2352:Stars
题目
Time Limit: 1000MS | Memory Limit: 65536K | |
Total Submissions: 34016 | Accepted: 14839 |
Description

For example, look at the map shown on the figure above. Level of the star number 5 is equal to 3 (it's formed by three stars with a numbers 1, 2 and 4). And the levels of the stars numbered by 2 and 4 are 1. At this map there are only one star of the level 0, two stars of the level 1, one star of the level 2, and one star of the level 3.
You are to write a program that will count the amounts of the stars of each level on a given map.
Input
Output
Sample Input
5
1 1
5 1
7 1
3 3
5 5
Sample Output
1
2
1
1
0
Hint
Source
题解
题目大意:在一片苍茫的大海上,有很多很多明亮的星星【他们一共有N个】,他们经常相互追逐,每个星星都可以干掉他们左下角之内的星星,请统计能干掉0~N-1个星星的数量。我写不下去了【=_=||其实我不懂英文,前面都是我瞎翻译的。】其实-有N个星星(X0,Y0),每个星星的等级为其左下角的星星的数量,统计不同level的星星的数量。并从0~N-1输出。
用树状数组统计每个x之前的星星的数量,并将星星在x位置插入。注意处理x可能等于0的情况。
代码
Stars
Time Limit: 1000MS Memory Limit: 65536K
Total Submissions: Accepted: 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. Astronomers want to know the distribution of the levels of the stars. For example, look at the map shown on the figure above. Level of the star number is equal to (it's formed by three stars with a numbers 1, 2 and 4). And the levels of the stars numbered by 2 and 4 are 1. At this map there are only one star of the level 0, two stars of the level 1, one star of the level 2, and one star of the level 3. You are to write a program that will count the amounts of the stars of each level on a given map.
Input The first line of the input file contains a number of stars N (<=N<=). The following N lines describe coordinates of stars (two integers X and Y per line separated by a space, <=X,Y<=). There can be only one star at one point of the plane. Stars are listed in ascending order of Y coordinate. Stars with equal Y coordinates are listed in ascending order of X coordinate. Output The output should contain N lines, one number per line. The first line contains amount of stars of the level , the second does amount of stars of the level and so on, the last line contains amount of stars of the level N-.
Sample Input Sample Output Hint This problem has huge input data,use scanf() instead of cin to read data to avoid time limit exceed.
Source Ural Collegiate Programming Contest
POJ2352:Stars的更多相关文章
- POJ2352:Stars——题解
http://poj.org/problem?id=2352 Astronomers晚上仰望星空,看到了很多星星.回到办公桌,Astronomers将这些星星画到二维坐标系,每个星星的坐标都是整数.例 ...
- 用Python作GIS之二:STARS开发环境配置
STARS的一般使用可以通过REGAL网页快速学习http://regionalanalysislab.org/?n=STARS再次不做详细介绍这里关注的主题是对STARS源代码分析即为使用Pytho ...
- 51nod 1208 && POJ 2482:Stars in Your Window
1208 Stars in Your Window 题目来源: Poj 基准时间限制:2 秒 空间限制:131072 KB 分值: 160 难度:6级算法题 收藏 取消关注 整点上有N颗星星,每颗 ...
- HDU - 5126: stars (求立方体内点数 CDQ套CDQ)
题意:现在给定空空的三维平面,有加点操作和询问立方体点数. 思路:考虑CDQ套CDQ.复杂度是O(NlogN*logN*logN),可以过此题. 具体的,这是一个四维偏序问题,4维分别是(times, ...
- POJ - 2482:Stars in Your Window (扫描线 )
题意:二维平面上给你N颗星,给出星星的坐标,亮度: 然后给你一个W*H的窗口,问你最大的亮度和. 思路:扫描线,假设有一个inf*H的窗口,按照y排序,那么就把H范围内的星星放入了这个窗口(单调队列实 ...
- 用Python作GIS之一:介入STARS
STARS的全称是Space-Time Analysis of Regional Systems,直译过来就是区域系统时空分析软件.这是针对区域多时相数据的分析包,源代码公开.该软件将最近几年发展起来 ...
- NeHe OpenGL教程 第九课:移动图像
转自[翻译]NeHe OpenGL 教程 前言 声明,此 NeHe OpenGL教程系列文章由51博客yarin翻译(2010-08-19),本博客为转载并稍加整理与修改.对NeHe的OpenGL管线 ...
- R语言学习笔记:基础知识
1.数据分析金字塔 2.[文件]-[改变工作目录] 3.[程序包]-[设定CRAN镜像] [程序包]-[安装程序包] 4.向量 c() 例:x=c(2,5,8,3,5,9) 例:x=c(1:100) ...
- 前端每日实战:96# 视频演示如何用纯 CSS 和 D3 创作一艘遨游太空的宇宙飞船
效果预览 按下右侧的"点击预览"按钮可以在当前页面预览,点击链接可以全屏预览. https://codepen.io/comehope/pen/oMqNmv 可交互视频 此视频是可 ...
随机推荐
- Android Studio Module疑问
ERROR: APK path is not specified for module From your existing project, go to 'File' -> 'Project ...
- Windows的历史zt
原文地址:http://windows.microsoft.com/zh-CN/windows/history#T1=era0 1975–1981:Microsoft 起步 Microsoft 联合创 ...
- Web自动化基础分享
一.Selenium 简介 Selenium 是 ThoughtWorks 专门为 Web 应用程序编写的一个验收测试工具. 与其他测试工具相比,使用 Selenium 的最大好处是: Seleniu ...
- SSH Session Recorder
If you want to record your root ssh session create a file .bash_profile . and copy below line by l ...
- 交通银行万事达Y-POWER信用卡 普卡
签账消费 免息尽享 失卡保护 风险全无 密码签名 任选 境外使用 本币还款 国内海外 环球支持 适合人群:年轻一族 发行状态:发行中 年费: 140元 币种: 人民币+美元 免年费政策:免首年 ...
- JavaMail学习笔记
适逢计算机网络课程设计,本着挑战自己的态度,选择了一个从未接触的东西:邮箱客户端代理软件的设计.由于对相关协议非常陌生,只能依靠查找资料完成,在学习过程中碰到了一个非常好的博客,故向大家推荐一下. 一 ...
- Address already in use: JVM_Bind <null>:8080
解决方法: 1重开eclipse,端口号被占用,或者杀掉进程
- Babelfish(二分)
Babelfish Time Limit: 3000MS Memory Limit: 65536K Total Submissions: 37238 Accepted: 15879 Descr ...
- Ceph对象存储网关中的索引工作原理<转>
Ceph 对象存储网关允许你通过 Swift 及 S3 API 访问 Ceph .它将这些 API 请求转化为 librados 请求.Librados 是一个非常出色的对象存储(库)但是它无法高效的 ...
- SQL Server 中的跨库视图
SQL Server 中的跨库视图 在一个SQL中,有多个数据库,A.B.C,在使用C为连接库中,现在要查询A中的表T1. 那么,在C中建创视图(A_T1). SELECT *FROM A.dbo.T ...