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

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>
            久久久成人网| 欧美精彩视频一区二区三区| 国产精品第一区| 亚洲一区二区三区国产| 一本一本久久a久久精品牛牛影视| 欧美久久久久久久久久| 在线视频一区二区| 亚洲欧美国产精品专区久久| 国产精品资源| 免费看成人av| 欧美精品尤物在线| 新67194成人永久网站| 久久国产手机看片| 91久久精品美女高潮| 日韩视频不卡| 国产婷婷成人久久av免费高清| 欧美91大片| 欧美亚一区二区| 久久精品女人| 欧美精品亚洲| 久久本道综合色狠狠五月| 久久久777| 一区二区日韩伦理片| 亚洲在线观看视频网站| 一区在线影院| 日韩西西人体444www| 国产日韩欧美日韩| 欧美激情按摩在线| 国产精品网站在线| 亚洲欧洲另类国产综合| 国产精品夜色7777狼人| 欧美不卡在线视频| 国产精品综合久久久| 欧美激情视频一区二区三区在线播放 | 亚洲大片在线| 欧美午夜精品一区| 性久久久久久久久| 欧美黑人多人双交| 久久经典综合| 欧美日韩日本视频| 欧美激情视频给我| 伊人狠狠色j香婷婷综合| 99精品99| 亚洲精品免费看| 久久精品国产亚洲高清剧情介绍| 亚洲少妇自拍| 美女任你摸久久| 久久一区二区三区av| 国产精品都在这里| 亚洲日本欧美| 91久久久在线| 久久久噜噜噜久久久| 久久精视频免费在线久久完整在线看| 欧美精品少妇一区二区三区| 欧美成人亚洲成人| 狠狠入ady亚洲精品经典电影| 亚洲网站在线看| 亚洲视频图片小说| 欧美美女福利视频| 亚洲人成网站色ww在线| 亚洲伦理在线观看| 牛牛精品成人免费视频| 欧美激情一区二区三区在线视频 | 欧美国产乱视频| 免费成人黄色av| 狠狠干综合网| 久久三级福利| 玖玖玖免费嫩草在线影院一区| 国产视频在线观看一区| 欧美一区二区福利在线| 久久高清一区| 国产综合香蕉五月婷在线| 欧美在线观看视频一区二区| 久久精品系列| 精品999在线观看| 久久久午夜视频| 亚洲国产成人av| 99精品免费视频| 欧美特黄一级| 性色av一区二区三区| 久久久综合免费视频| 伊人成综合网伊人222| 嫩草影视亚洲| 日韩视频一区二区在线观看 | 亚洲午夜久久久久久久久电影院| 亚洲免费一区二区| 国产视频一区在线观看| 久久野战av| 日韩一级免费| 久久久久91| 亚洲美女视频在线免费观看| 欧美另类videos死尸| 亚洲女女女同性video| 欧美/亚洲一区| 一区二区精品| 国内精品免费在线观看| 欧美国产欧美综合| 亚洲综合国产激情另类一区| 久久久综合网站| 一区二区三区欧美激情| 国产视频在线观看一区| 欧美激情成人在线| 性18欧美另类| 亚洲精品人人| 久久偷窥视频| 香蕉久久一区二区不卡无毒影院| 在线电影国产精品| 国产精品午夜在线观看| 蜜臀av国产精品久久久久| 亚洲一级黄色片| 亚洲国产一区二区三区a毛片 | 激情偷拍久久| 欧美亚洲成人免费| 久久视频在线视频| 亚洲午夜视频在线| 亚洲国产精品一区| 欧美在线观看网址综合| 一本大道久久a久久精二百| 狠狠久久亚洲欧美| 国产伦精品一区二区三区高清版 | 亚洲在线国产日韩欧美| 亚洲国产精品成人精品| 久久久青草婷婷精品综合日韩| 夜夜嗨av一区二区三区网站四季av | 中文久久乱码一区二区| 欧美国产视频日韩| 欧美在线一二三| 一区二区三区欧美激情| 亚洲电影第1页| 含羞草久久爱69一区| 国产日韩在线一区| 国产精品卡一卡二| 欧美日韩在线三级| 欧美精品一区二区三区蜜桃| 蜜臀久久99精品久久久画质超高清| 欧美一区二区视频网站| 午夜亚洲激情| 先锋资源久久| 小处雏高清一区二区三区| 亚洲女爱视频在线| 亚洲欧美视频在线| 亚洲欧美综合另类中字| 亚洲永久字幕| 亚洲一二三区在线| 亚洲图片自拍偷拍| 亚洲一区二区欧美| 亚洲欧美成人一区二区在线电影| 亚洲婷婷在线| 亚洲欧美视频一区| 久久gogo国模裸体人体| 久久久中精品2020中文| 另类综合日韩欧美亚洲| 免费日韩av电影| 欧美精品高清视频| 欧美日韩中文在线| 国产精品乱码| 国产婷婷色综合av蜜臀av| 黄色精品一区二区| 亚洲国产精品久久久久秋霞影院 | 亚洲小说欧美另类社区| 亚洲欧美国产视频| 久久er99精品| 麻豆精品在线观看| 亚洲福利视频一区| 一本色道久久综合一区| 欧美亚洲一区三区| 欧美成人精品福利| 国产精品a久久久久久| 国产欧美一区二区视频| 一区免费观看| 在线视频亚洲欧美| 久久精品亚洲乱码伦伦中文| 免费亚洲电影在线观看| 亚洲精品色婷婷福利天堂| 亚洲天堂网站在线观看视频| 久久久精品日韩欧美| 欧美裸体一区二区三区| 国产亚洲激情| 夜夜嗨av一区二区三区四季av| 香蕉视频成人在线观看| 亚洲国产高清视频| 亚洲影院在线观看| 蜜臀久久久99精品久久久久久| 国产精品久久久久9999吃药| 一区二区三区在线视频免费观看| 99视频热这里只有精品免费| 欧美在线|欧美| 亚洲欧洲三级电影| 久久精品五月| 国产精品性做久久久久久| 亚洲级视频在线观看免费1级| 亚洲欧美成人一区二区三区| 欧美大片免费| 久久精品123| 亚洲欧美日韩国产精品| 日韩视频免费观看高清在线视频 | 久久精品五月婷婷| 欧美吻胸吃奶大尺度电影| 亚洲激情小视频| 久久久久天天天天|