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

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
額 上面復制的時候搞錯了一句話 自己加到循環里面就可以了
從0到n的循環開始的時候加上
for(now=i,j=i+1;j<n&&arr[j].x==arr[i].x;i=j,j++);
用了二分的思想
  回復  更多評論
  

只有注冊用戶登錄后才能發表評論。
網站導航: 博客園   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国产精品久久久久久久| 国产精品进线69影院| 欧美一区国产二区| 久久精品盗摄| 亚洲国产欧美日韩| 亚洲免费av网站| 国产日韩精品一区二区三区在线| 久久久精品国产99久久精品芒果| 看片网站欧美日韩| 一区二区三区免费看| 亚洲女人天堂成人av在线| 国产一区在线免费观看| 欧美激情影音先锋| 欧美私人啪啪vps| 久久综合五月| 欧美日韩播放| 久久久久久穴| 欧美国产激情二区三区| 性色一区二区| 欧美a级在线| 欧美一级视频免费在线观看| 久久综合伊人77777| 一本色道久久综合亚洲精品按摩| 午夜精品视频网站| 最新成人在线| 欧美尤物巨大精品爽| 日韩天堂在线观看| 午夜性色一区二区三区免费视频| 亚洲国产精品热久久| 一区二区三区导航| 亚洲高清在线观看| 亚洲视频一起| 亚洲毛片在线观看.| 欧美亚洲视频一区二区| 制服丝袜激情欧洲亚洲| 久久久美女艺术照精彩视频福利播放| 中文亚洲欧美| 欧美大秀在线观看| 蜜桃av久久久亚洲精品| 国产精品免费看片| 日韩午夜激情av| 亚洲精品影院在线观看| 久久深夜福利免费观看| 久久精品欧美| 国产精品一区在线观看| 亚洲精品影视| 亚洲美女黄色片| 久久视频在线视频| 久久深夜福利免费观看| 国产伦精品一区二区三区四区免费 | 国产日韩欧美在线看| 亚洲伦理在线观看| 亚洲人在线视频| 久久综合网络一区二区| 久久综合中文| 激情成人中文字幕| 久久精品国产91精品亚洲| 亚洲欧美日本日韩| 国产精品扒开腿做爽爽爽软件| 亚洲国产精品999| 最新亚洲视频| 欧美黄色一级视频| 亚洲精品免费观看| 99一区二区| 欧美日韩一区在线播放| 亚洲乱码精品一二三四区日韩在线| 亚洲人成在线观看一区二区| 欧美成人免费在线观看| 亚洲人成网站777色婷婷| 亚洲每日在线| 国产精品久久久久久久久久免费看| 亚洲毛片在线观看| 亚洲男人天堂2024| 国产农村妇女毛片精品久久莱园子| 亚洲一线二线三线久久久| 性欧美xxxx视频在线观看| 国产欧美一区在线| 久久精品中文字幕一区| 欧美国产乱视频| 亚洲美女淫视频| 欧美色网一区二区| 亚洲欧美日本日韩| 免费在线观看成人av| 亚洲人成亚洲人成在线观看图片| 欧美日韩麻豆| 欧美在线观看一区二区| 欧美二区在线| 亚洲视频在线播放| 国产亚洲欧洲997久久综合| 久久综合婷婷| 亚洲小说春色综合另类电影| 久久久国产精品一区二区三区| 亚洲第一页在线| 国产精品家教| 久久婷婷丁香| 亚洲视频碰碰| 蜜臀va亚洲va欧美va天堂| 艳妇臀荡乳欲伦亚洲一区| 国产情人节一区| 免费观看在线综合色| 一区二区三区偷拍| 蜜乳av另类精品一区二区| 亚洲与欧洲av电影| 在线电影国产精品| 国产精品久久网站| 老鸭窝亚洲一区二区三区| a91a精品视频在线观看| 蜜臀av一级做a爰片久久| 亚洲伊人久久综合| 亚洲国产一区在线| 国产日韩欧美电影在线观看| 欧美激情一区二区三区成人| 欧美一区二区在线| 在线视频亚洲| 亚洲免费观看| 欧美激情第二页| 久久综合五月| 久久不射2019中文字幕| 亚洲视频观看| 一本久道综合久久精品| 亚洲国产cao| 国内成人精品2018免费看 | 午夜天堂精品久久久久| 亚洲人成7777| 欧美大片一区二区| 久久久999精品免费| 亚洲制服丝袜在线| 日韩亚洲欧美一区| 亚洲美女视频在线观看| 在线观看日产精品| 国内成人精品一区| 国产一区二区三区在线观看免费视频 | 国产精品theporn| 欧美区在线播放| 欧美成人免费一级人片100| 久久亚洲综合网| 久久久久久久一区二区三区| 欧美自拍偷拍| 欧美在线亚洲综合一区| 欧美在线观看www| 欧美一二三区在线观看| 欧美一级视频免费在线观看| 亚洲欧美美女| 欧美一区二区日韩| 久久er99精品| 久久综合国产精品| 老司机免费视频久久| 免费观看一区| 欧美日韩激情小视频| 欧美性猛交一区二区三区精品| 欧美三日本三级少妇三2023| 欧美午夜精品理论片a级按摩| 欧美日韩人人澡狠狠躁视频| 欧美日本一区二区三区| 欧美体内she精视频| 国产精品久久久久影院色老大| 国产精品一区二区久久国产| 国产亚洲激情视频在线| 伊人成人在线| 一区二区三区av| 午夜精品美女久久久久av福利| 欧美在线免费播放| 美女露胸一区二区三区| 亚洲国产高清aⅴ视频| 一本一道久久综合狠狠老精东影业| 一区二区三区四区国产| 欧美一区二区三区另类| 免费国产一区二区| 国产精品高清网站| 激情欧美一区| 亚洲色在线视频| 久久男女视频| 亚洲美女在线视频| 欧美资源在线观看| 欧美日韩p片| 激情综合自拍| 亚洲午夜电影网| 欧美mv日韩mv国产网站| 一个人看的www久久| 久久精品三级| 欧美性事在线| 亚洲国产精品www| 亚洲欧美精品suv| 欧美激情中文字幕一区二区| 中文亚洲免费| 欧美成年人视频网站| 国产乱码精品1区2区3区| 亚洲欧洲一区| 久久久久久久97| 亚洲影音一区| 欧美日韩成人一区二区三区| 伊人狠狠色丁香综合尤物| 亚洲在线播放| 日韩午夜激情av|