青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品

poj2352

Stars

Time Limit: 1000MS Memory Limit: 65536K
Total Submissions: 22097 Accepted: 9620

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 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

The first line of the input file contains a number of stars N (1<=N<=15000). The following N lines describe coordinates of stars (two integers X and Y per line separated by a space, 0<=X,Y<=32000). 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 0, the second does amount of stars of the level 1 and so on, the last line contains amount of stars of the level N-1.

Sample Input

5
1 1
5 1
7 1
3 3
5 5

Sample Output

1
2
1
1
0

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 1999

統計問題嘛,用樹狀數組,線段樹都可以
#include <cstdio>
#include 
<cstdlib>
#include 
<cstring>
#include 
<cmath>
#include 
<ctime>
#include 
<cassert>
#include 
<iostream>
#include 
<sstream>
#include 
<fstream>
#include 
<map>
#include 
<set>
#include 
<vector>
#include 
<queue>
#include 
<algorithm>
#include 
<iomanip>
using namespace std;
#define maxn 15005
#define maxlen 32005
#define lowbit(x) x&(-x)
#define max(a,b) a>b?a:b
int n;
int a,b;
int f[maxlen];
int level[maxn];
void add(int x,int nn)
{
    
while(x<=32001)//這里要加1
    {
        f[x]
+=nn;
        x
+=lowbit(x);
    }

}

int getsum(int x)
{
    
int sum=0;
    
while(x>0)
    
{
        sum
+=f[x];
        x
-=lowbit(x);
    }

    
return sum;
}

int main()
{
    
int tmp;
    scanf(
"%d",&n);
    memset(f,
0,sizeof(f));
    memset(level,
0,sizeof(level));
    
for(int i=1; i<=n; i++)
    
{
        scanf(
"%d%d",&a,&b);
        tmp
=getsum(a+1);//坐標又可能為0,+1
        level[tmp]++;
        add(a
+1,1);
    }

    
for(int i=0; i<=n-1; i++)
        printf(
"%d\n",level[i]);
    
return 0;
}



posted on 2012-07-24 19:25 jh818012 閱讀(175) 評論(0)  編輯 收藏 引用


只有注冊用戶登錄后才能發表評論。
網站導航: 博客園   IT新聞   BlogJava   博問   Chat2DB   管理


<2025年11月>
2627282930311
2345678
9101112131415
16171819202122
23242526272829
30123456

導航

統計

常用鏈接

留言簿

文章檔案(85)

搜索

最新評論

  • 1.?re: poj1426
  • 我嚓,,輝哥,,居然搜到你的題解了
  • --season
  • 2.?re: poj3083
  • @王私江
    (8+i)&3 相當于是 取余3的意思 因為 3 的 二進制是 000011 和(8+i)
  • --游客
  • 3.?re: poj3414[未登錄]
  • @王私江
    0ms
  • --jh818012
  • 4.?re: poj3414
  • 200+行,跑了多少ms呢?我的130+行哦,你菜啦,哈哈。
  • --王私江
  • 5.?re: poj1426
  • 評論內容較長,點擊標題查看
  • --王私江
青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            午夜精品久久久99热福利| 免费观看成人鲁鲁鲁鲁鲁视频 | 性欧美激情精品| 午夜在线播放视频欧美| 久久精品中文| 免费在线观看一区二区| 亚洲第一福利视频| 亚洲国产精品va在线看黑人动漫| 亚洲高清三级视频| 亚洲视频高清| 久久久久88色偷偷免费| 欧美高清视频一区二区三区在线观看| 欧美极品在线观看| 国产精品亚洲一区| 国产亚洲精品v| 欧美一区日韩一区| 久久天堂国产精品| 欧美韩国日本一区| 亚洲精品精选| 久久伊人亚洲| 国产精品久久久久久久第一福利| 国产日韩综合| 亚洲美洲欧洲综合国产一区| 欧美一区二区三区在线看| 欧美成人精品在线| 亚洲宅男天堂在线观看无病毒| 久久久久成人精品| 国产精品黄视频| 亚洲欧洲在线一区| 久久久777| 亚洲少妇在线| 欧美日韩成人精品| 激情另类综合| 亚洲男人av电影| 欧美电影免费| 午夜精品久久| 国产精品一卡二| 在线视频免费在线观看一区二区| 亚洲欧美bt| 亚洲黄色免费网站| 久久精品亚洲精品| 国产视频观看一区| 亚洲免费小视频| 亚洲精品一二三| 欧美电影在线观看完整版| 国产一级久久| 欧美一区二区日韩| 亚洲少妇在线| 国产精品高潮呻吟久久av无限| 亚洲福利在线观看| 一本色道久久88亚洲综合88| 欧美国产视频在线观看| 久久久久久久久久久一区 | 国产精品亚洲一区二区三区在线| 日韩视频在线观看国产| 欧美国产激情二区三区| 久久综合中文色婷婷| 伊人久久大香线| 久久一区欧美| 久久中文字幕一区二区三区| 尤物精品在线| 欧美国产免费| 欧美成人网在线| 亚洲免费成人av电影| 亚洲精品乱码久久久久久蜜桃麻豆 | 亚洲视频香蕉人妖| 欧美体内谢she精2性欧美| 欧美激情一区| 一本大道久久a久久精品综合| 亚洲国产日韩一级| 欧美日韩1区2区| 99综合在线| 在线午夜精品| 国产亚洲日本欧美韩国| 久久亚洲免费| 欧美极品欧美精品欧美视频| 欧美少妇一区| 午夜久久美女| 久久精品论坛| 亚洲精品女人| 99热在这里有精品免费| 国产精品v日韩精品v欧美精品网站| 亚洲午夜精品国产| 欧美影视一区| 日韩午夜在线播放| 亚洲欧美日韩专区| 亚洲福利一区| 亚洲亚洲精品在线观看| 国产一二精品视频| 亚洲高清自拍| 国产精品美女| 蘑菇福利视频一区播放| 欧美成人一区二区三区在线观看| 亚洲一区在线免费| 久久黄金**| 99视频精品在线| 性欧美videos另类喷潮| 亚洲另类在线视频| 亚洲一区国产| 亚洲精品一区久久久久久| 午夜精品久久久| 亚洲精品久久久久久一区二区| 亚洲视频一二区| 亚洲精品一区在线观看| 欧美怡红院视频一区二区三区| 一本色道久久88亚洲综合88| 久久精品盗摄| 午夜精品视频| 欧美日本一区| 久久久之久亚州精品露出| 嫩模写真一区二区三区三州| 亚洲欧美日韩一区| 蜜臀a∨国产成人精品| 亚洲欧美国产一区二区三区| 久热精品视频在线| 久久久精品日韩欧美| 国产精品国产三级国产专播品爱网| 欧美搞黄网站| 1000部国产精品成人观看| 亚洲女性裸体视频| 亚洲一区在线视频| 欧美日韩精品欧美日韩精品一| 老司机午夜免费精品视频| 国产精品少妇自拍| 一本色道**综合亚洲精品蜜桃冫| 亚洲国产一成人久久精品| 久久精品国产久精国产爱| 欧美一区二区三区四区在线观看| 欧美日韩国产一区精品一区| 亚洲二区在线观看| 在线日本成人| 9l国产精品久久久久麻豆| 亚洲高清在线观看一区| 久久精品国产69国产精品亚洲 | 一区二区三区高清视频在线观看| 久久久久久综合网天天| 久久精品亚洲精品| 免费人成精品欧美精品| 黄色精品一区二区| 久久激情网站| 久久午夜视频| 亚洲电影在线免费观看| 欧美连裤袜在线视频| 欧美一级免费视频| 国产精品久久久一区麻豆最新章节| 99视频一区二区三区| 亚洲女人小视频在线观看| 国产精品久久久久久久久久久久久 | 国产日韩欧美亚洲| 小黄鸭精品密入口导航| 久久这里有精品15一区二区三区| 狠狠色丁香婷婷综合影院| 久久欧美肥婆一二区| 美女免费视频一区| 亚洲精品久久久久久一区二区| 欧美日韩另类视频| 亚洲欧美欧美一区二区三区| 久久亚洲一区二区三区四区| 在线观看亚洲一区| 欧美日韩视频在线第一区| 亚洲视频一区二区在线观看| 久久久欧美精品sm网站| 日韩一级黄色片| 国产区精品在线观看| 久久综合久久美利坚合众国| 亚洲成色精品| 亚洲女人天堂av| 在线观看视频一区二区| 欧美日本久久| 欧美一区二区黄| 亚洲韩国日本中文字幕| 欧美一二三视频| 亚洲人妖在线| 国产日韩欧美在线| 欧美激情视频一区二区三区免费 | 亚洲欧美精品在线| 女仆av观看一区| 亚洲一区二区三区三| 一区在线观看| 国产精品美女一区二区| 狼人社综合社区| 亚洲欧美日韩国产综合在线 | 久久嫩草精品久久久久| 一本一本久久a久久精品综合麻豆| 久久久综合免费视频| 亚洲婷婷在线| 亚洲精品视频在线播放| 国内精品伊人久久久久av影院 | 亚洲在线一区二区三区| 亚洲福利视频网站| 久久久久久久网| 久久久精品国产一区二区三区| 国产亚洲一区二区在线观看 | 亚洲伦理精品| 国产自产v一区二区三区c| 欧美成人午夜免费视在线看片| 亚洲一区日韩在线| 亚洲精品免费电影| 欧美国产日韩亚洲一区| 久久精品国产2020观看福利|