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

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

只有注冊用戶登錄后才能發(fā)表評論。
網(wǎng)站導(dǎo)航: 博客園   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>
            国语自产精品视频在线看| 欧美性开放视频| 在线欧美视频| 亚洲第一成人在线| 欧美精品亚洲| 亚洲午夜激情免费视频| 亚洲综合欧美日韩| 在线观看日韩| 日韩午夜在线视频| 国产亚洲一区二区三区在线播放| 老妇喷水一区二区三区| 麻豆freexxxx性91精品| 亚洲视屏在线播放| 久久av资源网| 狼人社综合社区| 欧美jizz19性欧美| 亚洲自拍电影| 久久夜色精品亚洲噜噜国产mv | 国产精品久久久久高潮| 久久久久国产精品www | 亚洲图片在线观看| 狠狠久久婷婷| 亚洲精品在线三区| 黄色成人免费观看| 夜夜嗨av一区二区三区四季av| 国产午夜精品全部视频播放| 亚洲国产综合视频在线观看| 国产精品自拍小视频| 亚洲国产精品ⅴa在线观看| 国产精品免费观看在线| 欧美高清你懂得| 国产伦精品一区二区三区高清| 亚洲国产欧美一区二区三区同亚洲 | 亚洲欧美在线免费观看| 久久综合网络一区二区| 欧美一区国产在线| 欧美日韩国产在线看| 欧美99在线视频观看| 国产毛片久久| 夜夜爽www精品| 亚洲精品婷婷| 麻豆成人在线观看| 久久婷婷成人综合色| 国产精品狼人久久影院观看方式| 亚洲国产一成人久久精品| 狠狠色狠狠色综合日日五| 亚洲欧美国产va在线影院| 亚洲网站在线播放| 欧美高清自拍一区| 欧美激情一区二区| 亚洲电影免费观看高清完整版在线观看 | 亚洲国产欧美一区二区三区同亚洲| 亚洲性感美女99在线| 亚洲性人人天天夜夜摸| 欧美日本网站| 亚洲精品综合| 亚洲视频专区在线| 欧美天堂亚洲电影院在线播放| 亚洲青涩在线| 国产精品99久久久久久久vr | 久久激情综合| 久久尤物视频| 好吊日精品视频| 久久久久国产免费免费| 免费在线成人av| 在线日韩欧美| 欧美精品成人一区二区在线观看| 亚洲电影第1页| 99pao成人国产永久免费视频| 欧美激情久久久| 一本久道久久综合狠狠爱| 亚洲综合色在线| 国产日韩一级二级三级| 久久精品免费看| 欧美激情视频一区二区三区不卡| 91久久精品国产91久久性色tv| 欧美sm重口味系列视频在线观看| 欧美成人精品在线播放| 亚洲精品一区二区在线| 欧美三级午夜理伦三级中视频| 亚洲午夜精品| 老色批av在线精品| 亚洲毛片在线看| 国产欧美精品在线| 久久综合久久美利坚合众国| 91久久精品国产91久久性色tv| 亚洲午夜免费福利视频| 国产日韩精品在线| 欧美激情中文不卡| 亚洲综合成人在线| 欧美freesex8一10精品| 在线视频日本亚洲性| 国产一区二区三区四区在线观看| 美国十次成人| 亚洲欧美精品一区| 久久久欧美一区二区| 日韩亚洲一区二区| 久久综合久久综合这里只有精品| 亚洲美女av网站| 国产一区清纯| 欧美午夜精品久久久久久超碰| 久久精品国产成人| av72成人在线| 欧美黑人一区二区三区| 欧美一区高清| 中文有码久久| 亚洲国产婷婷香蕉久久久久久| 国产精品亚洲精品| 欧美激情小视频| 久久精品国产亚洲aⅴ| aⅴ色国产欧美| 91久久综合| 欧美成人久久| 久久天堂精品| 欧美在线一二三区| 亚洲尤物视频网| 日韩写真在线| 亚洲精品国久久99热| 好吊一区二区三区| 国产午夜精品一区理论片飘花 | 久久精品在线播放| 亚洲欧美日韩精品久久久| 99re8这里有精品热视频免费| 久热综合在线亚洲精品| 欧美在线一二三区| 亚洲欧美日韩电影| 亚洲午夜国产成人av电影男同| 最近看过的日韩成人| 欲香欲色天天天综合和网| 国产婷婷成人久久av免费高清 | 欧美精选一区| 欧美精品亚洲一区二区在线播放| 老司机免费视频一区二区| 久久精品国产免费观看| 性欧美xxxx大乳国产app| 亚洲欧美成人一区二区在线电影| 一区二区三区四区国产精品| 99热这里只有精品8| 一本色道久久99精品综合| 亚洲免费成人| 一区二区激情| 亚洲一区二区三区在线| 亚洲欧美在线播放| 久久国产精品网站| 久久久噜久噜久久综合| 噜噜噜噜噜久久久久久91| 免费成人高清在线视频| 欧美国产高清| 欧美三区不卡| 国产亚洲精品久久久久久| 国产女主播在线一区二区| 国内偷自视频区视频综合| 伊人成人开心激情综合网| 在线成人免费观看| 亚洲每日更新| 亚洲综合欧美| 久久精品视频在线播放| 欧美成人按摩| 日韩视频一区| 亚洲综合日韩在线| 欧美制服丝袜第一页| 美女视频黄 久久| 欧美日韩一二三区| 国产日韩视频一区二区三区| 在线视频观看日韩| av成人激情| 久久久久久久久综合| 亚洲高清视频一区| 亚洲调教视频在线观看| 久久久999精品| 欧美日韩国产在线播放| 欧美一区二区三区免费观看视频| 久久综合99re88久久爱| 亚洲人成啪啪网站| 香蕉尹人综合在线观看| 免费欧美电影| 国产亚洲欧美另类一区二区三区| 亚洲国产视频一区| 性久久久久久久久久久久| 欧美成人精品在线观看| 亚洲一区在线免费| 欧美激情中文字幕乱码免费| 国产日本亚洲高清| 99视频超级精品| 女人香蕉久久**毛片精品| 中文一区二区| 欧美国产精品专区| 韩国欧美一区| 欧美亚洲在线视频| 亚洲风情亚aⅴ在线发布| 欧美一级视频免费在线观看| 欧美日本一区| 亚洲精品免费一二三区| 久久久久久久欧美精品| 亚洲综合视频一区| 欧美亚洲成人网| 一区二区av| 亚洲精品乱码久久久久久蜜桃91 | 久久精品123| 国产毛片一区|