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

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 閱讀(150) 評論(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久久久久久久久久久久 | 女人天堂亚洲aⅴ在线观看| 国产精品美女久久久久久2018| 亚洲视频 欧洲视频| 日韩亚洲在线| 国产午夜精品理论片a级大结局| 欧美在线一区二区| 久久久久久久久久久久久久一区| 在线观看欧美激情| 91久久精品国产91性色tv| 欧美电影免费观看高清| 亚洲视频免费在线| 亚洲欧美综合另类中字| 激情成人综合| 亚洲日本免费电影| 国产精品theporn| 久久久综合网站| 欧美成人免费观看| 亚洲欧美激情视频| 久久婷婷一区| 亚洲一区二区三区乱码aⅴ| 亚洲欧美日本另类| 亚洲精品免费看| 亚洲免费网址| 亚洲国产精品成人一区二区 | 欧美黄色一区| 欧美日韩精品系列| 久久综合激情| 欧美日韩亚洲一区二区三区四区| 欧美在线首页| 欧美激情一级片一区二区| 欧美一区二区三区精品电影| 毛片av中文字幕一区二区| 亚洲一区高清| 久久久伊人欧美| 亚洲一区二区三区午夜| 久久久久久成人| 欧美一级二区| 欧美日韩视频在线一区二区观看视频| 久久国产精品久久久久久久久久 | 国产在线精品成人一区二区三区| 91久久综合| 加勒比av一区二区| 亚洲欧美日韩国产中文| 99精品黄色片免费大全| 久久理论片午夜琪琪电影网| 亚洲一区精品电影| 欧美成人日韩| 免费在线观看精品| 国产亚洲精品久久久久婷婷瑜伽 | 日韩一区二区久久| 亚洲国产精品久久久久| 欧美亚洲一区在线| 亚洲欧美视频| 国产精品hd| 亚洲美女在线视频| 99pao成人国产永久免费视频| 久久大香伊蕉在人线观看热2| 亚洲影院污污.| 欧美男人的天堂| 亚洲国产日韩美| 最新国产乱人伦偷精品免费网站| 久久免费视频在线| 美女视频一区免费观看| 黄色av日韩| 久久久久久久综合色一本| 久久艳片www.17c.com| 国产日产欧美精品| 欧美在线一二三四区| 久久狠狠亚洲综合| 国产字幕视频一区二区| 欧美在线二区| 久久综合999| 亚洲国产日本| 欧美成人精品福利| 亚洲精品乱码久久久久久久久| 99精品欧美一区| 欧美日一区二区在线观看 | 日韩视频永久免费观看| 亚洲视频999| 国产欧美一区二区精品忘忧草| 亚洲小说春色综合另类电影| 久久疯狂做爰流白浆xx| 国产亚洲欧美日韩一区二区| 欧美一区国产二区| 免费观看成人| 一本色道婷婷久久欧美| 欧美性猛片xxxx免费看久爱| 亚洲欧美视频在线| 蜜桃av一区二区三区| 亚洲人体一区| 国产精品日日做人人爱| 久久成人精品视频| 亚洲观看高清完整版在线观看| 在线一区二区三区四区五区| 国产精品日本一区二区| 裸体一区二区| 宅男66日本亚洲欧美视频| 久久精品最新地址| 亚洲免费观看视频| 国产精品视频免费观看www| 久久精品日韩欧美| 亚洲精品免费电影| 久久夜色精品一区| 亚洲女性裸体视频| 在线观看日韩欧美| 国产精品伦一区| 你懂的国产精品永久在线| 亚洲天堂久久| 欧美肥婆bbw| 香蕉乱码成人久久天堂爱免费| 亚洲国产二区| 国产一区日韩二区欧美三区| 欧美精品福利在线| 久久国产直播| 在线综合+亚洲+欧美中文字幕| 毛片基地黄久久久久久天堂| 亚洲综合电影一区二区三区| 亚洲破处大片| 国产中文一区二区三区| 欧美日韩国产在线播放| 久久视频这里只有精品| 亚洲一区免费看| 亚洲最新合集| 最新成人av网站| 欧美成年人视频网站| 亚洲欧美综合精品久久成人| 亚洲麻豆一区| 亚洲高清在线视频| 国产一区二区三区无遮挡| 国产精品久久午夜夜伦鲁鲁| 欧美激情一区二区在线 | 美女爽到呻吟久久久久| 久久不射中文字幕| 亚洲网站啪啪| 一本色道久久综合亚洲91| 亚洲国产美女| 欧美激情国产精品| 欧美aⅴ一区二区三区视频| 久久九九热免费视频| 欧美怡红院视频| 亚洲欧美视频一区二区三区| 亚洲香蕉在线观看| 亚洲视频图片小说| 亚洲天堂网在线观看| 一本色道久久综合亚洲二区三区| 亚洲黄色影片| 亚洲美女电影在线| 中日韩在线视频| 亚洲一区视频| 欧美在线1区| 久久国产欧美精品| 久久久久久久97| 久久亚洲精品视频| 蜜桃av一区二区在线观看| 蜜桃久久av一区| 亚洲国产精品久久91精品| 亚洲日韩欧美一区二区在线| 亚洲国产精品美女| 一区二区欧美日韩| 亚洲女同同性videoxma| 亚洲欧美中文另类| 久久看片网站| 欧美日韩国产页| 国产精品美女久久久浪潮软件| 国产午夜精品在线| 亚洲国产精品va在看黑人| a91a精品视频在线观看| 亚洲综合电影一区二区三区| 久久久精品国产免大香伊| 美女精品自拍一二三四| 亚洲国产精品一区二区第四页av| 亚洲人妖在线| 欧美在线一二三| 欧美日韩不卡在线| 国产女主播一区二区| 尤物网精品视频| 一区二区欧美国产| 久久精品国产99国产精品澳门| 免费成人高清| 亚洲视频在线观看一区| 久久亚洲影音av资源网| 欧美视频精品在线观看| 国产自产v一区二区三区c| 亚洲精品一区二区三| 欧美一区二区三区婷婷月色 | 亚洲一区二区动漫| 麻豆精品在线视频| 亚洲网站在线观看| 免费在线观看成人av| 国产精品一二三四| 日韩一级免费| 久久女同互慰一区二区三区| 亚洲剧情一区二区| 久久久xxx| 国产精品入口| 亚洲一区二区伦理| 亚洲国产经典视频| 久久久99国产精品免费| 国产精品极品美女粉嫩高清在线|