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

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 閱讀(147) 評論(1)  編輯 收藏 引用

FeedBack:
# re: Beautiful People
2009-05-10 22:47 | Knignt
額 上面復制的時候搞錯了一句話 自己加到循環(huán)里面就可以了
從0到n的循環(huán)開始的時候加上
for(now=i,j=i+1;j<n&&arr[j].x==arr[i].x;i=j,j++);
用了二分的思想
  回復  更多評論
  

只有注冊用戶登錄后才能發(fā)表評論。
網(wǎng)站導航: 博客園   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>
            亚洲欧美在线另类| 日韩午夜激情电影| 欧美视频四区| 欧美国产日韩一二三区| 国产精品欧美风情| 亚洲人成网站在线播| 国内外成人免费视频| 一区二区日韩免费看| 最新亚洲激情| 麻豆精品传媒视频| 老司机久久99久久精品播放免费 | 免费在线观看成人av| 久久精品国产亚洲aⅴ| 国产精品成人一区二区| 91久久精品一区| 在线免费观看视频一区| 欧美在线播放| 国产精品国产三级国产aⅴ浪潮 | 中日韩美女免费视频网址在线观看 | 亚洲成色最大综合在线| 欧美成人一区二区三区片免费| 久久激情视频久久| 国产欧美一区二区三区视频| 妖精成人www高清在线观看| 一本高清dvd不卡在线观看| 欧美电影资源| 亚洲片在线观看| 99精品福利视频| 欧美日韩国产综合在线| 亚洲伦理在线观看| 一区二区高清| 国产精品日本欧美一区二区三区| 这里只有精品电影| 亚洲综合国产| 国产欧美精品在线| 久久久久国产精品厨房| 欧美成人精品在线| 日韩视频免费在线观看| 欧美日韩亚洲一区二区三区| 亚洲精品在线电影| 亚洲欧美日韩区| 国产精品久久综合| 欧美一区二区精品久久911| 久久久国产精品一区| 欧美精品日韩www.p站| 亚洲激情在线视频| 在线一区二区三区做爰视频网站| 欧美午夜精品理论片a级按摩| 久久婷婷丁香| 亚洲三级免费电影| 欧美日韩国产天堂| 亚洲欧美国产高清| 久久久精品五月天| 亚洲人成毛片在线播放| 欧美三区不卡| 久久精品视频播放| 亚洲免费av片| 欧美在线免费观看亚洲| 亚洲第一视频| 国产精品成人一区二区艾草| 欧美一区二区三区男人的天堂 | 老牛嫩草一区二区三区日本| 亚洲激情另类| 欧美在线网站| 在线观看欧美亚洲| 国产精品二区影院| 麻豆精品视频在线| 亚洲专区一区二区三区| 欧美高清日韩| 翔田千里一区二区| 亚洲精品一区在线| 国产麻豆午夜三级精品| 欧美大胆成人| 欧美一区二区三区免费大片| 亚洲国产一区二区三区青草影视| 欧美一级欧美一级在线播放| 亚洲美女免费精品视频在线观看| 国产精品久久久久aaaa樱花| 鲁大师影院一区二区三区| 亚洲嫩草精品久久| 亚洲美女区一区| 欧美高清视频在线播放| 欧美一区二区三区视频| 亚洲精品自在久久| 国模 一区 二区 三区| 欧美日韩一区二区三区四区五区| 久久美女性网| 香蕉亚洲视频| 亚洲午夜av在线| 亚洲美女色禁图| 亚洲国产高清自拍| 免费一区二区三区| 久久蜜桃精品| 欧美一区二区三区播放老司机| 亚洲精品乱码久久久久久久久 | 久久精品在线播放| 亚洲欧美色一区| 亚洲一级黄色片| 99pao成人国产永久免费视频| 亚洲第一搞黄网站| 欧美激情成人在线视频| 久久久久久精| 久久久久久免费| 久久精品国产一区二区三区| 午夜激情一区| 久久国产视频网站| 久久久噜噜噜久久人人看| 欧美一级视频一区二区| 欧美在线日韩精品| 久久艳片www.17c.com| 久久国产精品网站| 久久综合久久久久88| 久久婷婷一区| 免费欧美高清视频| 亚洲高清av在线| 亚洲欧洲精品一区二区三区不卡| 欧美激情日韩| 亚洲免费久久| 亚洲中字在线| 久久国产精品网站| 久久女同互慰一区二区三区| 免费日韩成人| 欧美日韩免费观看一区| 欧美久久九九| 欧美日韩免费在线视频| 欧美精品三级| 国产精品欧美日韩一区| 国产精品系列在线| 国产精品自拍一区| 国产午夜精品一区二区三区欧美 | 欧美精品在线播放| 欧美激情视频一区二区三区在线播放 | 欧美精品福利视频| 欧美精品成人在线| 欧美日韩精品是欧美日韩精品| 欧美日韩成人综合| 欧美天堂亚洲电影院在线播放| 欧美色区777第一页| 国产精品毛片| 国产亚洲成av人在线观看导航 | 亚洲一二三四久久| 亚洲国产精品一区二区www| 最新国产乱人伦偷精品免费网站| 亚洲第一二三四五区| 日韩视频在线免费| 亚洲欧美色婷婷| 久久久久九九视频| 欧美精品久久99| 国产一区二区中文| 亚洲国产日韩欧美在线99| 亚洲精品四区| 亚洲在线播放| 欧美在线黄色| 亚洲精品一二区| 亚洲女爱视频在线| 久久综合狠狠综合久久激情| 欧美另类女人| 今天的高清视频免费播放成人 | 亚洲一区二区三区四区五区午夜| 久久国产精品久久w女人spa| 麻豆成人精品| 日韩午夜av| 欧美一区视频在线| 欧美激情a∨在线视频播放| 国产伦理一区| 亚洲免费精彩视频| 久久国产高清| 亚洲人屁股眼子交8| 中国成人亚色综合网站| 久久精品99久久香蕉国产色戒| 久久国产精品72免费观看| 欧美激情一区二区在线| 国产精品丝袜白浆摸在线| 亚洲缚视频在线观看| 久久久青草婷婷精品综合日韩| 亚洲黄色有码视频| 欧美专区一区二区三区| 欧美日韩三级电影在线| 国产精品国产三级国产专区53| 亚洲精品色婷婷福利天堂| 欧美专区在线| 日韩亚洲欧美成人一区| 久久综合色天天久久综合图片| 国产日韩在线亚洲字幕中文| 99国产精品自拍| 免费人成精品欧美精品| 午夜精品视频一区| 国产欧美日韩专区发布| 亚洲午夜在线| 亚洲精品一区中文| 欧美18av| 亚洲精品视频二区| 久久综合电影| 久久不射2019中文字幕| 国产精品欧美日韩一区二区| 亚洲欧美日韩在线一区| 亚洲免费电影在线| 欧美精品亚洲二区| 亚洲精品一区在线观看| 日韩亚洲欧美成人一区|