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

ACM___________________________

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

常用鏈接

留言簿(24)

隨筆分類(332)

隨筆檔案(182)

FRIENDS

搜索

積分與排名

最新隨筆

最新評論

閱讀排行榜

評論排行榜

MiYu原創, 轉帖請注明 : 轉載自 ______________白白の屋    

題目地址 :

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
 與樹狀數組的解法一樣,  查詢更新就可以了. 
	樹狀數組 解法傳送門 : 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>
            激情亚洲网站| 一区二区三区精品在线| 久久久久久久久伊人| 亚洲欧美日韩精品久久| 国产麻豆日韩| 久久亚洲捆绑美女| 欧美一区二区视频在线观看| 国产亚洲va综合人人澡精品| 久久九九国产精品| 美女日韩在线中文字幕| 亚洲巨乳在线| 亚洲视频播放| 在线不卡欧美| 国产日韩欧美亚洲一区| 久久日韩粉嫩一区二区三区| 嫩模写真一区二区三区三州| 亚洲一区久久久| 久久精品国产一区二区电影| 亚洲精品美女91| 亚洲一区精彩视频| 亚洲国产日韩综合一区| 夜夜夜久久久| 在线观看国产日韩| av成人免费观看| 在线观看日韩欧美| 亚洲一区二区高清| 91久久线看在观草草青青| 亚洲午夜国产一区99re久久 | 亚洲欧美视频在线| 影音先锋久久资源网| 亚洲日本激情| 国产一区视频在线观看免费| 亚洲日本精品国产第一区| 国产日韩亚洲欧美精品| 亚洲黄色影片| 尹人成人综合网| 一区二区三区回区在观看免费视频| 国模套图日韩精品一区二区| 99国产精品视频免费观看一公开 | 国产精品www色诱视频| 另类国产ts人妖高潮视频| 欧美午夜宅男影院在线观看| 欧美国产日韩二区| 国产亚洲精品bt天堂精选| 在线亚洲免费视频| 日韩午夜中文字幕| 麻豆精品在线视频| 久久免费午夜影院| 国产精品一区2区| 一区二区三区欧美在线观看| 亚洲精选在线| 欧美成人激情视频| 欧美成人免费全部| 伊人精品成人久久综合软件| 午夜精品福利在线观看| 亚洲免费视频网站| 欧美视频第二页| 亚洲毛片av在线| 在线亚洲一区| 欧美日韩一区二区三区免费| 亚洲精品国产精品乱码不99按摩| 91久久精品国产91久久| 久久亚洲综合网| 欧美福利精品| 亚洲看片网站| 欧美精品一区二区三区在线播放| 亚洲第一偷拍| 日韩亚洲视频| 欧美日韩一区二区免费视频| 日韩视频精品在线观看| 日韩一区二区精品葵司在线| 欧美黄色视屏| 亚洲最新色图| 性感少妇一区| 国产一区视频观看| 久久人人爽爽爽人久久久| 欧美成人中文字幕| 99国产精品国产精品毛片| 欧美日韩亚洲一区二区三区在线| 一区二区欧美日韩视频| 午夜精品久久久久久久| 国产日产欧美一区| 久久免费国产精品1| 欧美成人dvd在线视频| 亚洲美女精品成人在线视频| 欧美午夜精品理论片a级大开眼界| 亚洲午夜精品久久| 久久久久成人精品| 亚洲精品免费电影| 国产精品国产三级国产普通话三级 | 黄色免费成人| 欧美激情第一页xxx| 亚洲无吗在线| 欧美成人自拍视频| 亚洲午夜视频在线观看| 国内精品福利| 欧美日韩高清免费| 欧美一区二区三区久久精品茉莉花 | 亚洲欧美日韩久久精品| 国内精品免费午夜毛片| 欧美精品色网| 久久成人18免费网站| 亚洲国产精品999| 欧美在线一二三四区| 亚洲国产一区在线| 国产精品色网| 欧美精品一区二区三区在线看午夜| 亚洲一区二区在线免费观看| 欧美aⅴ一区二区三区视频| 亚洲小视频在线观看| 在线精品视频一区二区| 国产精品毛片高清在线完整版| 久久另类ts人妖一区二区| 99re6热在线精品视频播放速度| 久久一区视频| 欧美在线一级va免费观看| 亚洲三级免费| 在线精品亚洲一区二区| 国产视频一区免费看| 国产精品黄页免费高清在线观看| 免费av成人在线| 欧美一区二区视频在线| 亚洲视频免费看| 亚洲精品少妇网址| 欧美成人亚洲成人| 久久在线播放| 久久精品国产亚洲精品| 亚洲在线日韩| 亚洲影视综合| 亚洲小视频在线| 日韩视频中文字幕| 亚洲激情第一页| 亚洲国产精品激情在线观看| 国内久久精品视频| 国产一区二区三区久久精品| 国产精品免费看久久久香蕉| 欧美日韩亚洲91| 欧美日韩国产限制| 欧美另类女人| 欧美视频在线观看免费| 欧美激情网友自拍| 欧美久久99| 欧美午夜精品一区| 国产精品福利在线| 国产精品拍天天在线| 国产精品久久久久aaaa九色| 国产精品啊啊啊| 国产精品五区| 国产一区二区三区直播精品电影 | 在线观看中文字幕亚洲| 激情五月婷婷综合| 亚洲国产福利在线| 亚洲欧洲精品一区| 99精品国产在热久久婷婷| 99视频精品在线| 亚洲视频电影在线| 亚洲综合色网站| 久久精品欧美| 欧美成人伊人久久综合网| 亚洲东热激情| 一区二区三区久久网| 亚洲尤物精选| 久久久久久香蕉网| 欧美精品精品一区| 国产精品一区二区三区成人| 国产一区日韩二区欧美三区| 亚洲第一级黄色片| 在线一区二区三区做爰视频网站| 亚洲欧美一区二区三区久久 | 狼人社综合社区| 亚洲国产清纯| 亚洲欧美一区二区在线观看| 久久久午夜电影| 欧美黑人多人双交| 国产精品综合视频| 亚洲国产电影| 香蕉av福利精品导航| 欧美成人激情在线| 一区二区三区免费在线观看| 欧美亚洲综合久久| 欧美精品大片| 国产一级久久| 宅男噜噜噜66一区二区 | 亚洲国产欧美日韩另类综合| 亚洲图片在线观看| 久色成人在线| 亚洲一区二区精品在线观看| 久久三级福利| 国产欧美日韩在线| 99视频精品在线| 可以看av的网站久久看| a91a精品视频在线观看| 久久婷婷成人综合色| 国产精品成人一区二区艾草| 亚洲第一区在线观看| 欧美在线视频全部完| 夜夜爽99久久国产综合精品女不卡| 久久久久www| 国产女人aaa级久久久级| 一区二区三区国产精品|