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

posts - 74,  comments - 33,  trackbacks - 0

Beautiful People
The most prestigious sports club in one city has exactly N members. Each of its members is strong and beautiful. More precisely, i-th member of this club (members being numbered by the time they entered the club) has strength Si and beauty Bi. Since this is a very prestigious club, its members are very rich and therefore extraordinary people, so they often extremely hate each other. Strictly speaking, i-th member of the club Mr X hates j-th member of the club Mr Y if Si <= Sj and Bi >= Bj or if Si >= Sj and Bi <= Bj (if both properties of Mr X are greater then corresponding properties of Mr Y, he doesn??t even notice him, on the other hand, if both of his properties are less, he respects Mr Y very much).

To celebrate a new 2005 year, the administration of the club is planning to organize a party. However they are afraid that if two people who hate each other would simultaneouly attend the party, after a drink or two they would start a fight. So no two people who hate each other should be invited. On the other hand, to keep the club prestige at the apropriate level, administration wants to invite as many people as possible.

Being the only one among administration who is not afraid of touching a computer, you are to write a program which would find out whom to invite to the party.


This problem contains multiple test cases!

The first line of a multiple input is an integer N, then a blank line followed by N input blocks. Each input block is in the format indicated in the problem description. There is a blank line between input blocks.

The output format consists of N output blocks. There is a blank line between output blocks.


Input

The first line of the input file contains integer N - the number of members of the club. (2 <= N <= 100 000). Next N lines contain two numbers each - Si and Bi respectively (1 <= Si, Bi <= 109).


Output

On the first line of the output file print the maximum number of the people that can be invited to the party. On the second line output N integers - numbers of members to be invited in arbitrary order. If several solutions exist, output any one.


Sample Input

1

4
1 1
1 2
2 1
2 2


Sample Output

2
1 4


Author: Andrew Stankevich
很猥瑣的最長上升子序列,寫的很猥瑣 ,輸出為給出序列的序號,因為這個錯了幾次 開始的時候二分寫錯一直TLE
部分代碼如下

?

#include < cstdio >
#include
< cstring >
#include
< algorithm >
#define ?MAXN?120000
using ? namespace ?std;
struct ?NODE {
????
int ?x,y,mark;
}
arr[MAXN],num[MAXN];
bool ?OK;
int ?pre[MAXN],root[MAXN];
int ?n,top,max_sum,best_road;
int ?Search( int ?now) {
????
int ?left = 0 ,right = top,mid;
????
while (left < right) {
????????mid
= (right + left) >> 1 ;
????????
if (num[mid].y >= now)right = mid;
????????
else ?left = mid + 1 ;
????}

????mid
= (left + right) >> 1 ;
????
return ?mid;????
}

bool ?cmp(NODE?a,NODE?b) {
????
if (a.x != b.x) return ?a.x < b.x;
????
return ?a.y < b.y;????
}

void ?PRINT( int ?x) {
????
if (pre[x])PRINT(pre[x]);
????
if (OK)printf( " ? " );
????
else ?OK = true ;
????printf(
" %d " ,arr[x - 1 ].mark);
}

int ?main() {
????
int ?cases,i,j,now;
????scanf(
" %d " , & cases);
????num[
0 ].x = num[ 0 ].y = 0 ;
????
while (cases -- ) {
????????max_sum
= 0 ,top = 1 ;
????????scanf(
" %d " , & n);
????????
for (i = 0 ;i < n;i ++ ) {
????????????arr[i].mark
= i + 1 ;
????????????scanf(
" %d?%d " , & arr[i].x, & arr[i].y);????
????????}

????????sort(arr,arr
+ n,cmp);
????????memset(pre,
0 , sizeof (pre));
????????memset(num,
0 , sizeof (num));
????????
for (i = 0 ;i < n;i ++ ) {????
????????????
for (j = now;j < i + 1 ;j ++ ) {
????????????????
int ?t = Search(arr[j].y);
????????????????root[j]
= t;pre[j + 1 ] = num[t - 1 ].x;
????????????????
if (max_sum < t) {
????????????????????max_sum
= t;best_road = j + 1 ;????
????????????????}
????
????????????}

????????????
for (j = now;j < i + 1 ;j ++ ) {
????????????????
if (root[j] == top) {
????????????????????num[top].x
= j + 1 ;
????????????????????num[top
++ ].y = arr[j].y;????
????????????????}

????????????????
else ? if (arr[j].y < num[root[j]].y) {
????????????????????num[root[j]].x
= j + 1 ;
????????????????????num[root[j]].y
= arr[j].y;????
????????????????}
????
????????????}

????????}

????????OK
= false ;
????????printf(
" %d\n " ,max_sum);
????????PRINT(best_road);printf(
" \n " );
????}

}

posted on 2009-05-10 22:43 KNIGHT 閱讀(145) 評論(1)  編輯 收藏 引用

FeedBack:
# re: Beautiful People
2009-05-10 22:47 | Knignt
額 上面復制的時候搞錯了一句話 自己加到循環里面就可以了
從0到n的循環開始的時候加上
for(now=i,j=i+1;j<n&&arr[j].x==arr[i].x;i=j,j++);
用了二分的思想
  回復  更多評論
  
<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>
            国产精品久久久久久模特| 午夜伦欧美伦电影理论片| 国内在线观看一区二区三区| 国产亚洲福利社区一区| 精品粉嫩aⅴ一区二区三区四区| 在线播放豆国产99亚洲| 99v久久综合狠狠综合久久| 亚洲制服丝袜在线| 欧美一区二区在线| 亚洲一级网站| 农夫在线精品视频免费观看| 欧美性视频网站| 亚洲国产精品日韩| 久久精品国产第一区二区三区最新章节 | 亚洲网友自拍| 极品av少妇一区二区| 91久久久久久国产精品| 亚洲理论在线观看| 久久成人人人人精品欧| 亚洲片区在线| 老色鬼久久亚洲一区二区| 国产精品一区二区久久国产| 亚洲精品国精品久久99热一| 久久综合色8888| 亚洲男人av电影| 国产精品免费网站在线观看| 六十路精品视频| 欧美无砖砖区免费| 欧美成人一区二区三区在线观看| 西瓜成人精品人成网站| 国产精品99一区二区| 老司机精品视频网站| 国产精品久久久久久超碰 | 国产精品久线观看视频| 欧美成人免费网| 国产欧美日韩一级| 久久婷婷久久一区二区三区| 欧美一级专区免费大片| 一区二区三区精品视频| 日韩视频在线播放| 欧美伦理影院| 夜夜狂射影院欧美极品| 亚洲精品一区二区三区不| 欧美肉体xxxx裸体137大胆| 亚洲一区免费在线观看| 欧美大片在线观看一区二区| 亚洲人成人77777线观看| 亚洲肉体裸体xxxx137| 在线欧美福利| 日韩亚洲不卡在线| 亚洲精品免费看| 猫咪成人在线观看| 亚洲影院色无极综合| 欧美激情小视频| 久久精品91久久香蕉加勒比| 国产精品第十页| 亚洲午夜精品一区二区三区他趣| aa级大片欧美三级| 欧美精品麻豆| 亚洲精品激情| 一本大道av伊人久久综合| 在线日韩中文| 老司机精品视频网站| 麻豆国产va免费精品高清在线| 国产视频一区二区三区在线观看| 麻豆精品视频在线| 极品日韩av| 久久久久.com| aⅴ色国产欧美| 欧美日韩精品免费看| 久久精品综合网| 欧美激情一区二区三区在线| 亚洲二区三区四区| 国产精品久久久久秋霞鲁丝| 亚洲午夜精品久久久久久浪潮 | 国产午夜精品一区二区三区欧美| 亚洲欧美三级伦理| 亚洲精品三级| 欧美日韩午夜在线| 巨乳诱惑日韩免费av| 在线精品视频在线观看高清| 美女免费视频一区| 亚洲理论在线观看| 亚洲欧美日韩精品久久亚洲区 | 夜夜嗨av一区二区三区网页| 国产一区成人| 蜜臀av一级做a爰片久久| 亚洲人成人一区二区在线观看| 一本色道久久综合亚洲精品婷婷 | 亚洲精品系列| 国产精品色一区二区三区| 亚洲高清不卡av| 亚洲一区二区三区精品在线观看| 久久伊伊香蕉| 亚洲精品一区二区在线观看| 欧美一区二区三区视频在线| 欧美日韩在线第一页| 亚洲欧美日韩一区在线观看| 欧美激情精品久久久久久黑人| 久久精品一区二区三区中文字幕 | 牛夜精品久久久久久久99黑人| 亚洲精选久久| 久久精品夜色噜噜亚洲aⅴ| 91久久一区二区| 国产女人aaa级久久久级| 免费成人高清视频| 亚洲欧美中文字幕| 亚洲国产欧美日韩| 亚洲成人在线网站| 国产精品美女主播在线观看纯欲| 久久先锋资源| 你懂的亚洲视频| 一区二区自拍| 国产精品色婷婷| 欧美精品日韩一本| 欧美中文字幕不卡| 欧美jizz19性欧美| 欧美一区视频| 亚洲一区日韩在线| 日韩午夜电影在线观看| 激情婷婷久久| 国产丝袜一区二区| 国产精品欧美日韩| 欧美日韩在线精品| 欧美日产国产成人免费图片| 麻豆精品一区二区av白丝在线| 欧美一级黄色录像| 亚洲免费小视频| 亚洲视频欧美在线| 久久gogo国模啪啪人体图| 中日韩在线视频| 国产一区二区高清不卡| 国产精品久久久久久久9999| 欧美日韩国产三区| 欧美日韩国产片| 欧美日韩国产va另类| 欧美精品一区二区久久婷婷| 久久最新视频| 蜜臀av在线播放一区二区三区| 久久久久久久一区二区三区| 亚洲欧洲在线视频| 亚洲激情在线观看视频免费| 你懂的国产精品永久在线| 久久久久久久久综合| 久久精选视频| 美女精品自拍一二三四| 亚洲午夜精品久久| 亚洲女同精品视频| 欧美一区二区国产| 久久久久久久久久久久久女国产乱| 欧美中文字幕视频| 久久午夜激情| 亚洲国产成人av好男人在线观看| 亚洲高清免费视频| 一本大道久久精品懂色aⅴ| 一区二区三区导航| 亚洲电影欧美电影有声小说| 91久久精品一区二区三区| 亚洲精选一区二区| 亚洲免费视频在线观看| 久久精品亚洲一区二区| 能在线观看的日韩av| 欧美全黄视频| 国产女人精品视频| 在线欧美小视频| 夜夜嗨一区二区三区| 欧美一区二区在线| 欧美成人激情视频| 夜夜爽av福利精品导航| 欧美一区三区二区在线观看| 免费高清在线一区| 国产精品xvideos88| 黄色一区二区三区| 一本久久综合亚洲鲁鲁| 久久精品一区二区三区不卡| 亚洲国产女人aaa毛片在线| 一区二区三区高清在线| 久久久久久久久蜜桃| 欧美日韩免费观看一区=区三区| 国产日韩免费| 在线一区二区三区四区| 久久久精品国产99久久精品芒果| 亚洲精品1234| 欧美中文日韩| 欧美日韩视频在线第一区| 国产日韩欧美在线播放| 一区二区三区国产精品| 久久综合色8888| 亚洲永久在线| 国产欧美午夜| 亚洲精品在线观看免费| 久久精品99国产精品酒店日本| 91久久在线观看| 久久久久成人精品| 国产精品资源| 亚洲一区日韩在线| 91久久一区二区| 久久综合一区二区三区| 国产区欧美区日韩区| 亚洲一区二区三区精品动漫|