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

ACM___________________________

______________白白の屋
posts - 182, comments - 102, trackbacks - 0, articles - 0
<2025年12月>
30123456
78910111213
14151617181920
21222324252627
28293031123
45678910

常用鏈接

留言簿(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://www.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>
            一区二区三区日韩在线观看 | 亚洲女人天堂成人av在线| 亚洲国产精品视频一区| 亚洲主播在线观看| 欧美日韩午夜在线视频| 亚洲精品专区| 欧美日韩精品一区二区天天拍小说 | 国内精品久久久久久久影视麻豆| 欧美在线视频在线播放完整版免费观看 | 欧美一区二区三区四区在线观看地址| 亚洲一区二区四区| 国产亚洲免费的视频看| 老司机亚洲精品| 久久视频在线免费观看| 亚洲精品欧洲| 在线亚洲免费| 韩国精品一区二区三区| 亚洲国产高清在线观看视频| 欧美日韩综合在线免费观看| 久久精品二区| 欧美不卡高清| 香港成人在线视频| 美日韩精品视频免费看| 亚洲欧美日韩在线一区| 老牛影视一区二区三区| 亚洲男人av电影| 久久综合久久久| 亚洲免费一级电影| 蜜臀91精品一区二区三区| 亚洲欧美日韩国产综合精品二区| 久久久www| 亚洲男人第一av网站| 久久夜色精品国产欧美乱极品| 一区二区三区免费观看| 久久久www成人免费毛片麻豆| 一区二区三区欧美日韩| 久久久亚洲国产美女国产盗摄| 亚洲无吗在线| 久久久久成人精品免费播放动漫| 亚洲婷婷综合久久一本伊一区| 久久精品成人一区二区三区| 国产精品国产三级欧美二区| 亚洲看片一区| 久久精品日产第一区二区| 亚洲免费婷婷| 欧美—级在线免费片| 美女久久一区| 国产亚洲午夜| 亚洲欧美日韩国产中文| 欧美亚洲视频在线看网址| 亚洲精品视频免费观看| 久久久久久久尹人综合网亚洲| 亚洲欧美激情精品一区二区| 欧美成人a∨高清免费观看| 久久人人爽人人爽| 国产精品男人爽免费视频1| 99xxxx成人网| 在线视频欧美日韩| 欧美乱在线观看| 亚洲第一天堂av| 亚洲福利久久| 蜜桃av综合| 亚洲第一福利社区| 亚洲国产一区二区三区青草影视| 久久久久久久久蜜桃| 久久久久久久久久久久久9999| 国产婷婷精品| 欧美一区深夜视频| 久久日韩粉嫩一区二区三区| 国产综合香蕉五月婷在线| 性做久久久久久| 久久久精品网| 在线观看日韩av先锋影音电影院 | 久久久久久久一区| 国产综合色在线视频区| 久久国产精品亚洲77777| 久久综合影视| 亚洲第一区在线| 欧美激情免费在线| 一本久道久久久| 亚洲综合丁香| 国内免费精品永久在线视频| 久久久久久久精| 亚洲国产精品悠悠久久琪琪| 一区二区三区免费看| 国产精品久久看| 久久精品2019中文字幕| 欧美成人首页| 亚洲午夜电影网| 国产一本一道久久香蕉| 快播亚洲色图| 9国产精品视频| 欧美在线二区| 一区二区三区在线免费播放| 欧美成年人网站| 一本到12不卡视频在线dvd| 欧美一级日韩一级| 亚洲福利国产精品| 欧美日韩另类丝袜其他| 亚洲女同精品视频| 亚洲电影免费在线观看| 午夜精品亚洲| 亚洲清纯自拍| 国产欧美亚洲视频| 欧美激情一区二区久久久| 午夜精品国产更新| 亚洲激情一区| 久久久一区二区| 亚洲视频香蕉人妖| 亚洲国产另类久久精品| 国产精品久久一级| 开心色5月久久精品| 亚洲综合大片69999| 欧美激情1区| 久久国产直播| 一区二区三区久久精品| 影院欧美亚洲| 国产色爱av资源综合区| 欧美日韩综合久久| 女生裸体视频一区二区三区| 亚久久调教视频| 中文在线资源观看网站视频免费不卡 | 亚洲综合社区| 亚洲日本电影| 欧美成人一区在线| 久久精品道一区二区三区| 在线视频日本亚洲性| 亚洲第一区在线| 国内精品久久国产| 国产精品自拍小视频| 欧美三级乱码| 欧美了一区在线观看| 免费成人av| 久久看片网站| 久久精品国产久精国产思思| 亚洲永久在线| 在线一区观看| 亚洲网站在线播放| 一二美女精品欧洲| 99re热精品| 99精品热6080yy久久 | 亚洲欧洲av一区二区| 在线性视频日韩欧美| 亚洲精品在线三区| 亚洲破处大片| 亚洲麻豆视频| 夜夜嗨av一区二区三区网页| 亚洲精选中文字幕| 亚洲毛片网站| 一区二区免费在线观看| 一区二区三区欧美日韩| 一区二区三区毛片| 亚洲综合成人婷婷小说| 午夜精品在线| 欧美在线三级| 老巨人导航500精品| 欧美激情在线播放| 亚洲精品久久久蜜桃| 一区电影在线观看| 亚洲女人av| 久久久噜噜噜久久久| 欧美大片一区| 欧美日韩亚洲一区二区| 国产精品久久久久久久app| 国产精品日韩二区| 国产亚洲一级| 亚洲精品资源美女情侣酒店| 亚洲午夜小视频| 久久精品国产精品| 欧美激情中文字幕乱码免费| 亚洲精品乱码久久久久久日本蜜臀| 99视频精品| 久久国产福利| 欧美日韩成人在线视频| 国产毛片一区二区| 亚洲第一二三四五区| 亚洲一区二区三区成人在线视频精品| 亚洲欧美日韩在线一区| 牛牛精品成人免费视频| 99视频+国产日韩欧美| 欧美一区激情视频在线观看| 欧美a级大片| 国产精品无人区| 亚洲三级国产| 久久精品二区亚洲w码| 亚洲人成亚洲人成在线观看图片 | 久久久99久久精品女同性| 亚洲国产精品t66y| 亚洲一区影院| 欧美劲爆第一页| 黄色亚洲在线| 亚洲免费综合| 亚洲国产日韩在线一区模特| 亚洲欧美日韩成人| 欧美日本一区| 亚洲激情av| 久久久久青草大香线综合精品| 亚洲精品在线免费| 久久婷婷丁香| 国内精品久久久久久久影视麻豆|