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

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>
            亚洲一区二区在线视频| 亚洲综合另类| 一区二区三区导航| 久久成人精品一区二区三区| 亚洲精品久久视频| 久久在线免费观看视频| 午夜久久久久| 国产日产高清欧美一区二区三区| 一区二区三区欧美激情| 亚洲欧洲日本在线| 欧美激情第1页| 一本色道久久综合狠狠躁篇的优点 | 欧美韩国一区| 国产一区视频网站| 欧美在线视频免费观看| 亚洲视频在线观看三级| 欧美午夜精品| 午夜国产精品视频| 午夜精品在线视频| 国产日韩综合| 另类av导航| 羞羞视频在线观看欧美| 亚洲伊人第一页| 国产色产综合色产在线视频| 久久人人97超碰精品888| 久久综合999| 99视频精品在线| 在线中文字幕一区| 国产亚洲精品v| 欧美大片在线看免费观看| 美日韩在线观看| 一区二区三区毛片| 亚洲综合社区| 影音先锋日韩精品| 亚洲免费福利视频| 国产日韩欧美一区| 欧美激情精品久久久久久免费印度| 欧美电影打屁股sp| 午夜一区二区三视频在线观看| 欧美在线免费视频| 99综合在线| 欧美亚洲三级| 99热这里只有成人精品国产| 午夜精彩国产免费不卡不顿大片| 永久域名在线精品| 日韩视频在线观看一区二区| 国产欧美不卡| 亚洲成人在线视频播放| 麻豆av福利av久久av| 亚洲视频第一页| 久久国产一区二区| 亚洲一区黄色| 欧美a级一区| 久久精品国产精品亚洲综合| 欧美黄色免费网站| 久久视频在线视频| 国产精品毛片a∨一区二区三区|国| 在线精品国精品国产尤物884a| 亚洲人成在线影院| 国内外成人免费视频| 9久re热视频在线精品| 伊甸园精品99久久久久久| 一区二区三区高清在线| 亚洲国内在线| 欧美在线看片a免费观看| 久热精品视频在线免费观看| 亚洲一区二区三区国产| 免费一级欧美片在线播放| 久久精品亚洲乱码伦伦中文 | 午夜精品久久久久久 | 亚洲性av在线| 99re6这里只有精品| 久久视频精品在线| 久久精品视频在线免费观看| 国产精品极品美女粉嫩高清在线| 91久久精品国产91久久性色tv| 国产一区二区三区免费在线观看 | 日韩午夜av电影| 亚洲精品久久嫩草网站秘色| 久久亚洲不卡| 久久婷婷国产麻豆91天堂| 国产性色一区二区| 亚洲一区二区三区四区在线观看 | 久久综合一区二区| 国产综合色精品一区二区三区| 亚洲免费伊人电影在线观看av| 亚洲视频一区二区| 欧美三级不卡| 日韩视频在线观看国产| 这里只有精品丝袜| 欧美三级午夜理伦三级中视频| 亚洲国产高清在线| 亚洲日本成人网| 欧美肥婆在线| av成人黄色| 99国产精品自拍| 欧美日韩亚洲国产精品| 夜夜狂射影院欧美极品| 亚洲一区日韩| 亚洲国产色一区| 亚洲国产一区二区三区在线播| 久久亚洲精品中文字幕冲田杏梨| 免费在线观看日韩欧美| 亚洲黄一区二区三区| 久久综合给合久久狠狠狠97色69| 免费试看一区| 一区二区高清视频在线观看| 欧美午夜片在线免费观看| 亚洲视频在线观看三级| 欧美一进一出视频| 一区在线影院| 欧美国产日韩一区二区| 亚洲最新色图| 欧美在线影院在线视频| 国内精品久久久久久| 久久深夜福利| 日韩亚洲欧美精品| 狠狠色狠狠色综合人人| 麻豆精品视频在线观看| 亚洲理论电影网| 欧美一区激情| 在线日本欧美| 欧美视频在线看| 久久爱91午夜羞羞| 亚洲电影在线观看| 亚洲免费在线观看| 激情亚洲网站| 欧美三级在线视频| 欧美一区在线视频| 亚洲人精品午夜| 久久精视频免费在线久久完整在线看| 亚洲高清久久久| 欧美午夜在线观看| 麻豆国产精品va在线观看不卡| 99pao成人国产永久免费视频| 久久精品国产精品亚洲综合| 一区二区电影免费观看| 韩国在线视频一区| 欧美视频中文字幕在线| 卡一卡二国产精品| 亚洲欧美卡通另类91av| 亚洲人成欧美中文字幕| 久久久亚洲高清| 亚洲视频一二区| 91久久久久久久久久久久久| 国产日韩精品在线观看| 欧美日韩免费高清| 你懂的一区二区| 欧美一区二区三区在线播放| 亚洲免费电影在线| 亚洲电影第1页| 久久伊人一区二区| 欧美一区二区三区另类 | 日韩视频在线播放| 亚洲福利免费| 久热精品视频在线观看| 午夜精品理论片| 一区二区三区成人| 亚洲精品系列| 伊人成综合网伊人222| 国产精品―色哟哟| 国产精品theporn| 欧美日本在线一区| 欧美成人免费播放| 久久夜色精品国产欧美乱| 欧美一区二区三区喷汁尤物| 亚洲一区二区三区久久| 亚洲图片欧洲图片av| 亚洲私人影院在线观看| 正在播放欧美视频| 这里只有视频精品| 亚洲一区国产一区| 亚洲制服丝袜在线| 午夜精品亚洲| 99视频精品全部免费在线| 亚洲国产欧美不卡在线观看| 在线欧美视频| 亚洲人成在线播放网站岛国| 亚洲国产欧美一区| 亚洲区第一页| 99亚洲伊人久久精品影院红桃| 亚洲精品视频在线看| 亚洲图片激情小说| 亚洲男人的天堂在线观看| 午夜视频精品| 欧美有码在线观看视频| 久久精品亚洲一区二区三区浴池| 久久精品一区二区三区不卡| 久久综合中文字幕| 欧美寡妇偷汉性猛交| 亚洲丁香婷深爱综合| 99国产精品视频免费观看一公开| 在线综合亚洲| 欧美影院在线播放| 91久久亚洲| 中国av一区| 久久国产日韩欧美| 米奇777在线欧美播放| 欧美日韩成人一区| 国产欧美一区二区精品忘忧草 |