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

posts - 74,  comments - 33,  trackbacks - 0

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
神啊原諒我吧我很菜!
看了樹狀數組還沒思路!
代碼ac后更新
posted on 2009-01-10 10:24 KNIGHT 閱讀(192) 評論(1)  編輯 收藏 引用

FeedBack:
# re: Stars[未登錄]
2009-01-12 10:01 | Knight
#include<stdio.h>
#define SIZE1 32000
#define SIZE2 15000
int c[SIZE1],a[SIZE1],out[SIZE2],n;
int lowbit(int k)
{
return k&(-k);
}
int sum(int k)
{
int ret=0;
while(k>0)
{
ret+=c[k];
k-=lowbit(k);
}
return ret;
}
void change(int pos,int delt)
{
while(pos<=SIZE1)
{
c[pos]+=delt;
pos+=lowbit(pos);
}
}
void init()
{
int i;
int x,y;
for(i=0;i<n;i++)
{
scanf("%d%d",&x,&y);
x++;
out[sum(x-1)+a[x]]++;
change(x,1);
a[x]++;
}
}
int main()
{
int i;
scanf("%d",&n);
init();
for(i=0;i<n;i++)
printf("%d\n",out[i]);
}
pip來了,但是他說他也不會他是線段樹過的。。。。。
線段樹。。。。。代碼不是我的。。。網上的。。。。不過不錯。。。題目有個條件就是按y升序給出數據。。。。所以可以用樹狀數組,其實可以排序在用的。。。。。繼續物理。。。。關機。。。  回復  更多評論
  

只有注冊用戶登錄后才能發表評論。
網站導航: 博客園   IT新聞   BlogJava   博問   Chat2DB   管理


<2009年5月>
262728293012
3456789
10111213141516
17181920212223
24252627282930
31123456

常用鏈接

留言簿(8)

隨筆檔案

文章檔案

Friends

OJ

搜索

  •  

最新評論

閱讀排行榜

評論排行榜

青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <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观看一区| 久久久五月天| 国产精品xnxxcom| 亚洲一区二区三区在线播放| 亚洲黄色毛片| 蜜桃av一区二区| 亚洲美女免费精品视频在线观看| 美女图片一区二区| 久久一二三区| 99re6热只有精品免费观看| 最近看过的日韩成人| 欧美日韩亚洲一区二区三区四区| 在线一区亚洲| 亚洲欧美在线x视频| 狠狠色伊人亚洲综合成人| 欧美xx69| 国产精品hd| 久久五月激情| 欧美日韩国产美| 性色av一区二区三区| 久久精品国产2020观看福利| 亚洲高清在线精品| 一区二区三区四区五区精品| 国产日韩亚洲欧美综合| 免费日韩视频| 欧美视频一二三区| 美女亚洲精品| 国产精品久久久久影院色老大| 久久av一区二区三区| 噜噜噜躁狠狠躁狠狠精品视频| 亚洲免费成人av| 欧美在线视频日韩| 9人人澡人人爽人人精品| 午夜亚洲伦理| 亚洲图片欧美日产| 麻豆国产va免费精品高清在线| 亚洲视频第一页| 另类天堂视频在线观看| 亚洲欧美日韩国产成人| 免费在线国产精品| 久久久夜夜夜| 国产精品久久久久久久一区探花| 美女黄网久久| 国产日韩欧美a| 亚洲最新视频在线播放| 亚洲国产影院| 久久爱www| 亚洲欧美日韩国产成人精品影院| 欧美成人午夜影院| 久久久久在线观看| 国产日本欧美在线观看| 一区二区动漫| 一本一本大道香蕉久在线精品| 久久精品二区亚洲w码| 欧美一区网站| 国产精品午夜国产小视频| 亚洲日本理论电影| 亚洲美女中文字幕| 欧美成人精品一区二区| 久久久久国产成人精品亚洲午夜| 欧美好吊妞视频| 猛男gaygay欧美视频| 国产精品久久夜| 亚洲成人在线视频播放| 国产亚洲欧美一区二区| 99国产成+人+综合+亚洲欧美| 尤物精品在线| 久久精品国产亚洲aⅴ| 久久久精品日韩欧美| 国产偷久久久精品专区| 欧美一乱一性一交一视频| **欧美日韩vr在线| 亚洲午夜国产成人av电影男同| 欧美aaaaaaaa牛牛影院| 亚洲国产精品第一区二区三区| 在线观看欧美激情| 久久亚洲综合色| 亚洲国产高清自拍| 9色精品在线| 欧美日韩一区国产| 亚洲免费视频在线观看| 久久精品在线视频| 在线观看成人av电影| 欧美a级片网| 日韩一级二级三级| 小黄鸭视频精品导航| 国产欧美日本| 久热爱精品视频线路一| 亚洲三级电影在线观看| 亚洲一级电影| 国内精品视频久久| 美日韩精品免费观看视频| 亚洲国产精品嫩草影院| 亚洲女性裸体视频| 国产一区二区日韩精品欧美精品| 久久久久久日产精品| 亚洲国产美女| 亚洲欧美综合精品久久成人| 国内精品视频在线观看| 欧美国产视频日韩| 午夜精品久久久久久久蜜桃app| 久久亚洲视频| 一区二区三欧美| 国产欧美高清| 欧美精品久久一区二区| 欧美主播一区二区三区美女 久久精品人| 欧美成人免费视频| 亚洲欧美bt| 亚洲级视频在线观看免费1级| 国产精品久久一级| 久久综合激情| 午夜久久一区| 亚洲久色影视| 母乳一区在线观看| 亚洲欧美乱综合| 亚洲韩国精品一区| 国产热re99久久6国产精品| 欧美大色视频| 久久精品在这里| 亚洲一区免费网站| 亚洲三级免费观看| 免费影视亚洲| 欧美一区中文字幕| 洋洋av久久久久久久一区| 国模精品一区二区三区| 欧美午夜在线| 欧美日韩亚洲一区二区三区在线 | 欧美成人蜜桃| 久久精品99| 欧美一区二区三区久久精品| 亚洲精品欧美极品| 在线观看国产精品淫| 国产欧美韩国高清| 国产精品视频免费观看| 欧美日韩国产美女| 欧美激情精品久久久六区热门| 久久久久久伊人| 久久久女女女女999久久| 亚洲欧美成人综合| 亚洲一区二区动漫| 一本色道久久88综合日韩精品| 亚洲欧洲另类| 亚洲欧洲精品一区二区三区波多野1战4 | 欧美日韩视频在线第一区| 老巨人导航500精品| 久久麻豆一区二区| 亚洲精品资源| 欧美福利视频在线| 久久久精品动漫| 欧美一级专区| 亚洲淫性视频| 黑人巨大精品欧美黑白配亚洲| 欧美日韩日本网| 猛男gaygay欧美视频| 久久夜色精品亚洲噜噜国产mv| 久久国产精品一区二区三区| 久久精品二区| 免费日韩成人| 欧美精品入口| 国产精品色午夜在线观看| 国产色婷婷国产综合在线理论片a| 国产日韩欧美精品在线| 激情欧美一区二区三区| 精品1区2区3区4区| 亚洲精品国产精品国产自| 一区二区三区色| 午夜精品福利在线| 麻豆成人在线播放| 亚洲第一天堂av| 一区二区三区精品国产| 香蕉av777xxx色综合一区| 久久日韩粉嫩一区二区三区 | 亚洲欧洲一区二区三区| 日韩亚洲综合在线| 亚洲天堂成人| 久久国产主播| 欧美激情视频给我| 国产精品国产福利国产秒拍| 国产夜色精品一区二区av| 在线精品国产欧美| 亚洲视频网站在线观看| 久久精品国产免费看久久精品| 欧美jizzhd精品欧美巨大免费| 亚洲免费高清| 久久精品日产第一区二区三区| 欧美精品一区二区三区高清aⅴ| 国产精品黄页免费高清在线观看| 狠狠入ady亚洲精品| 夜夜嗨av一区二区三区四区| 久久久久久综合网天天| 亚洲美女黄网| 久久久久免费观看| 欧美性做爰毛片| 亚洲激情电影在线| 欧美怡红院视频一区二区三区| 亚洲国产99精品国自产| 亚洲免费影院| 欧美日韩精品综合| 亚洲国产岛国毛片在线| 久久电影一区|