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

ACM___________________________

______________白白の屋
posts - 182, comments - 102, trackbacks - 0, articles - 0
<2010年8月>
25262728293031
1234567
891011121314
15161718192021
22232425262728
2930311234

常用鏈接

留言簿(24)

隨筆分類(332)

隨筆檔案(182)

FRIENDS

搜索

積分與排名

最新隨筆

最新評論

閱讀排行榜

評論排行榜

MiYu原創(chuàng), 轉(zhuǎn)帖請注明 : 轉(zhuǎn)載自 ______________白白の屋    

題目地址 :

http://poj.org/problem?id=2352

題目描述:

Stars
Time Limit: 1000MSMemory Limit: 65536K
Total Submissions: 14814Accepted: 6404

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
 與樹狀數(shù)組的解法一樣,  查詢更新就可以了. 
	樹狀數(shù)組 解法傳送門 : http://www.cnblogs.com/MiYu/archive/2010/08/26/1808963.html 
代碼如下 : 
/*
Mail to   : miyubai@gamil.com
Link      : http://www.cnblogs.com/MiYu  || http://m.shnenglu.com/MiYu
Author By : MiYu
Test      : 1
Complier  : g++ mingw32-3.4.2
Program   : POJ_2352
Doc Name  : Stars
*/
//#pragma warning( disable:4789 )
#include <iostream>
#include <fstream>
#include <sstream>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <utility>
#include <queue>
#include <stack>
#include <list>
#include <vector>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
using namespace std;
struct P{
       int x, y;
}p[15010];
int seg[100000];
int NN = 32768, res[15010];
int get ( int &n ) {
    int i = 1;
    while ( i < n ) i << 1;
    return i;    
}
void modify ( int &pos ) {
     pos += NN;
     seg[pos] ++;
     while ( pos > 1 ) {
           if ( ~pos & 1 ) seg[pos>>1] ++;
           pos >>= 1;
     }
}
int query ( int pos ) {
     pos += NN;  
     int sum = seg[pos];
     while ( pos > 1 ) {
            if ( pos & 1 ) {
                 sum += seg[pos>>1];  
            }      
            pos >>= 1;
     }   
     return sum;
}
int main ()
{
    int N;
    while ( scanf ( "%d", &N ) == 1 ) {
           int pos;
           memset ( res, 0, sizeof ( res ) );
           memset ( seg, 0, sizeof ( seg ) );
           for ( int i = 0; i < N; ++ i ) {
                  scanf ( "%d%*d", &pos );
                  res[ query ( pos ) ] ++;
                  modify ( pos );   
           }   
           for ( int i = 0; i < N; ++ i ) {
                printf ( "%d\n", res[i] );     
           } 
    }
    return 0;
}

 

青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <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>
            国产精品一国产精品k频道56| 老司机一区二区| 亚洲日本激情| 亚洲欧美三级在线| 欧美母乳在线| 欧美日韩免费网站| 国产精品一区亚洲| 亚洲国产欧美一区| 亚洲国内欧美| 日韩视频免费观看高清完整版| 欧美bbbxxxxx| 国内精品视频666| 亚洲图片在区色| 欧美激情国产日韩精品一区18| 国产欧美视频一区二区三区| 亚洲一线二线三线久久久| 免费成人av在线看| 亚洲国产欧美一区二区三区同亚洲 | 国产欧美日韩视频一区二区| 一区二区三区欧美| 久久全球大尺度高清视频| 韩国精品一区二区三区| 久久蜜桃av一区精品变态类天堂| 一区二区三区四区精品| 亚洲精品美女在线| 欧美在线免费一级片| 亚洲国产高清在线观看视频| 国产精品亚洲产品| 亚洲一级片在线看| 欧美日韩国产小视频| 欧美亚洲视频一区二区| 久久av红桃一区二区小说| 国产精品一级在线| 欧美黄色日本| 免费久久精品视频| 亚洲精品中文字| 韩国精品在线观看| 好吊日精品视频| 9色精品在线| 欧美日韩免费一区二区三区| 亚洲欧美激情一区二区| 麻豆91精品91久久久的内涵| 久久久久欧美精品| 欧美一区不卡| 日韩午夜激情电影| 国产农村妇女毛片精品久久麻豆| 久久久精品动漫| 欧美性生交xxxxx久久久| 欧美www视频| 亚洲视频在线观看免费| 免费av成人在线| 你懂的网址国产 欧美| 国产精品视频久久一区| 免费看的黄色欧美网站| 理论片一区二区在线| 国产欧美一区二区精品婷婷| 亚洲综合视频网| 亚洲国产一区二区三区高清| 国产一区香蕉久久| 国产精品99久久久久久久vr| 男女视频一区二区| av不卡在线看| 久久精品亚洲国产奇米99| 亚洲一区日本| 香港久久久电影| 一区二区视频欧美| 亚洲国产婷婷香蕉久久久久久99 | 欧美成人一二三| 国产精品免费在线 | 久久精品成人一区二区三区蜜臀 | 欧美午夜在线| 欧美视频日韩视频| 国产日韩一级二级三级| 久久久久免费| 久久精品成人欧美大片古装| 亚洲国产综合在线| 亚洲视频免费| 在线日韩av| 国产婷婷色综合av蜜臀av | 久久噜噜噜精品国产亚洲综合| 久久久久久色| 久久久久网站| 在线观看福利一区| 午夜精品久久久久久99热软件| 一区二区日韩| 性久久久久久久久久久久| 免费亚洲电影在线| 国产亚洲a∨片在线观看| 99re8这里有精品热视频免费| 久久九九99视频| 亚洲精品欧美日韩| 国产精品久久久久一区二区| 欧美激情综合| 亚洲欧美制服另类日韩| 亚洲激情国产| 亚洲激情图片小说视频| 亚洲韩国精品一区| 亚洲视频欧美视频| 中日韩高清电影网| 亚洲无毛电影| 久久精品国产亚洲精品| 欧美高清视频一区二区三区在线观看| 久久精品视频免费观看| 在线观看亚洲视频| 久久噜噜噜精品国产亚洲综合 | 国产精品99久久久久久久久久久久| 欧美日韩亚洲一区在线观看| 亚洲福利视频在线| 精品盗摄一区二区三区| 亚洲国产第一页| 欧美三级免费| 欧美激情一区二区三区蜜桃视频| 亚洲国产精品久久人人爱蜜臀| 亚洲韩国一区二区三区| 欧美日韩在线免费观看| 欧美激情亚洲精品| 亚洲午夜女主播在线直播| 一区二区精品在线| 亚洲欧美日韩网| 亚洲高清123| 免费观看一级特黄欧美大片| 亚洲三级免费电影| 久久夜色精品国产噜噜av| 欧美日韩一本到| 亚洲精品在线免费| 欧美一级午夜免费电影| 国产精品av免费在线观看| 欧美一区二区精品久久911| 欧美在线观看视频一区二区| 国产精品国色综合久久| 午夜精彩视频在线观看不卡 | 中文在线不卡视频| 女仆av观看一区| 久久综合一区二区| 一区二区三区在线观看国产| 午夜一级久久| 亚洲一区精品视频| 国产免费亚洲高清| 香蕉视频成人在线观看| 日韩一二三在线视频播| 欧美日韩精品欧美日韩精品| 国产精品成人一区二区网站软件 | 亚洲一区免费视频| 亚洲国产裸拍裸体视频在线观看乱了| 在线不卡a资源高清| 欧美成人精品在线视频| 欧美在线观看视频| 亚洲国产精品一区二区www| 国产欧美日韩免费| 亚洲精品国产精品国自产观看| 欧美吻胸吃奶大尺度电影| 国产情人节一区| 亚洲黄页一区| 欧美成人精品三级在线观看| 国产日韩精品在线| 91久久精品国产91久久性色tv | 黄色成人在线网址| 亚洲午夜女主播在线直播| 国产一区二区三区自拍| 亚洲精品久久久一区二区三区| 欧美aa在线视频| 一本久道久久综合婷婷鲸鱼| 国产精品综合不卡av| 久久久久久久91| 欧美日韩一区二区三区在线视频| 久久五月婷婷丁香社区| 欧美三级乱码| 激情综合电影网| 另类国产ts人妖高潮视频| 欧美成人激情在线| 久久综合色一综合色88| 激情视频一区二区| 欧美xart系列高清| 亚洲国产成人久久综合一区| 麻豆av一区二区三区久久| 午夜性色一区二区三区免费视频| 久久综合九色99| 亚洲国产一区二区三区在线播 | 国产精品国产三级国产| 亚洲激情视频| 欧美成人一区二区| 夜夜嗨网站十八久久| 玖玖国产精品视频| 欧美日韩国产综合久久| 一区二区91| 欧美诱惑福利视频| 亚洲欧美日韩国产成人| 欧美激情网友自拍| 国产自产v一区二区三区c| 久久av资源网| 日韩午夜精品| 99在线热播精品免费| 激情国产一区| 日韩视频在线免费| 国产一区二区三区黄视频| 免费观看日韩| 久久九九热re6这里有精品| 在线精品国精品国产尤物884a| 久久久人人人| 欧美aaa级|