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

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>
            久久久亚洲国产美女国产盗摄| 亚洲小说春色综合另类电影| 久久午夜国产精品| 亚洲国产免费看| 夜夜嗨av一区二区三区网页| 久久综合给合| 国产在线精品一区二区中文 | 久久成年人视频| 最新国产の精品合集bt伙计| 久久精品国产99国产精品澳门| 国产精品护士白丝一区av| 91久久久久久久久| 久久亚洲私人国产精品va| 欧美一级大片在线观看| 亚洲一区精品电影| 亚洲一二三区在线| 久久久噜噜噜久久中文字免| 亚洲午夜影视影院在线观看| 欧美日本成人| 一区二区三区偷拍| 亚洲精品国产精品乱码不99| 欧美激情视频在线播放| 亚洲美女少妇无套啪啪呻吟| 亚洲黄色成人| 欧美成人视屏| 夜夜嗨av色一区二区不卡| 亚洲国产精品福利| 欧美日韩成人一区二区三区| 亚洲一区二区三区午夜| 在线亚洲电影| 国产日韩精品一区观看| 久久综合九色99| 欧美黄色免费| 中文在线不卡| 午夜欧美不卡精品aaaaa| 国产一区二区三区电影在线观看| 老司机精品视频网站| 欧美成人国产一区二区| 亚洲一区二区黄色| 欧美亚洲视频在线观看| 亚洲黄色有码视频| 亚洲视频观看| 亚洲大片av| 一区二区三区四区五区在线| 国内欧美视频一区二区| 另类激情亚洲| 欧美猛交免费看| 欧美影院成年免费版| 久久久久久久久久久久久久一区 | 久久国产一区| 久久亚洲二区| 一区二区免费在线观看| 午夜视频在线观看一区二区| 亚洲国产综合在线看不卡| 一区二区av在线| 激情另类综合| 一区二区三区日韩在线观看| 尤物精品在线| 一本色道久久加勒比精品| 国产午夜亚洲精品羞羞网站| 欧美激情91| 久久精品一区二区三区不卡牛牛| 亚洲人成7777| 欧美一区二区免费观在线| 欧美精品一区二区三区视频| 久久er99精品| 欧美日韩国产精品一区| 久久超碰97中文字幕| 欧美日产在线观看| 精品99一区二区三区| 99精品欧美一区| 国精品一区二区三区| 亚洲线精品一区二区三区八戒| 韩国一区二区在线观看| 一区二区欧美激情| 在线成人h网| 欧美在线播放视频| 亚洲人妖在线| 欧美人与禽性xxxxx杂性| 午夜欧美大尺度福利影院在线看| 国产精品99久久不卡二区| 亚洲精品美女在线观看| 亚洲字幕一区二区| 亚洲永久免费av| 久久青草欧美一区二区三区| 久久福利电影| 久久久国产成人精品| 欧美一区二区啪啪| 欧美专区一区二区三区| 亚洲欧美中日韩| 欧美三级日本三级少妇99| 美女国内精品自产拍在线播放| 国产欧美婷婷中文| 一区二区日韩伦理片| 一区二区三区视频在线播放| 久久综合久久88| 欧美成人一区二免费视频软件| 国产精品一区二区在线观看网站 | 亚洲国产精品精华液2区45| 亚洲天堂av在线免费| 一区二区av| 欧美成人一品| 亚洲激情偷拍| 亚洲激情国产| 欧美人与性动交a欧美精品| 亚洲国产精品999| 亚洲伦伦在线| 免费亚洲网站| 亚洲伦理久久| 一本综合精品| 欧美色综合天天久久综合精品| 91久久精品国产91性色| 最新日韩在线| 欧美福利电影网| 亚洲国产精品黑人久久久| 亚洲国产欧美不卡在线观看| 午夜国产精品视频免费体验区| 午夜视频精品| 国产三级欧美三级| 欧美一区二区三区免费视| 欧美综合国产| 国产一区二区三区久久久| 午夜宅男久久久| 久久人人97超碰国产公开结果| 国内精品视频在线观看| 欧美激情精品久久久久久| 老色鬼精品视频在线观看播放| 亚洲欧洲一区二区天堂久久| 免费毛片一区二区三区久久久| 欧美刺激性大交免费视频| 黄色成人在线免费| 欧美大秀在线观看 | 欧美激情一区三区| 亚洲精品一区二| 亚洲专区在线| 国产一区二区福利| 亚洲一区精品电影| 国产日韩1区| 亚洲欧美日韩国产一区二区| 久久美女性网| 欧美精品二区| 亚洲综合色自拍一区| 国产精品久久久久久久久免费桃花| 午夜亚洲福利| 亚洲美女网站| 国产精品美女久久久久aⅴ国产馆| 亚洲一区免费视频| 麻豆av福利av久久av| 日韩视频第一页| 欧美精品一区二区三区四区| 欧美在线视频一区二区| 欧美激情一区三区| 亚洲免费影院| 在线播放中文一区| 欧美日韩成人一区二区三区| 亚洲国产精品高清久久久| 久久久久久亚洲精品中文字幕 | 亚洲全部视频| 久久国产精品久久久久久电车 | 亚洲精品美女| 国产精品久久久一区二区| 久久精品国产清自在天天线| 亚洲精品乱码久久久久久按摩观| 小处雏高清一区二区三区| 在线日韩av片| 国产精品久久久久久久久久妞妞| 欧美另类亚洲| 久久综合色天天久久综合图片| 制服丝袜亚洲播放| 免费在线看一区| 午夜精品久久久久久久久久久久 | 一区二区三区高清视频在线观看| 在线观看欧美日韩| 国产精品一二三视频| 免费看精品久久片| 久久成人在线| 亚洲制服丝袜在线| 亚洲人体一区| 欧美成人午夜剧场免费观看| 午夜精品福利一区二区蜜股av| 亚洲日本一区二区| 狠狠爱成人网| 欧美日韩一级黄| 欧美视频官网| 欧美成人dvd在线视频| 欧美专区福利在线| 午夜视频一区| 亚洲男同1069视频| 久久国产精品一区二区三区四区 | 亚洲国产视频一区| 亚洲人成免费| 亚洲国产精品成人久久综合一区| 免费高清在线视频一区·| 久久精品人人爽| 久久成人在线| 亚洲国产精品久久精品怡红院| 最新国产の精品合集bt伙计| 亚洲黄一区二区三区| 美日韩在线观看| 蜜桃av噜噜一区二区三区|