[Cpp]
/* The program is made by pyy */
/*----------------------------------------------------------------------------//
Copyright (c) 2012 panyanyany All rights reserved.
URL: http://poj.org/problem? Id = 1548
Name: 1548 Robots
Date: Monday, July 9, 2012
Time Stage: half an hour
Result:
10405836 panyanyany
1548
Accepted 172 K 0 ms c ++
1775B 13:02:39
Test Data:
Review:
//----------------------------------------------------------------------------*/
# Include <stdio. h>
# Include <stdlib. h>
# Include <string. h>
# Include <math. h>
# Include <vector>
# Include <algorithm>
# Include <iostream>
# Include <queue>
# Include <set>
# Include <string>
Using namespace std;
# Define MEM (a, v) memset (a, v, sizeof (a) // a for address, v for value
# Define max (x, y) (x)> (y )? (X): (y ))
# Define min (x, y) (x) <(y )? (X): (y ))
# Define INF (0x3f3f3f)
# Define MAXN (24*25)
# Define L (x) <1)
# Define R (x) <1) | 1)
# Define M (x, y) (x) + (y)> 1)
# Define DB //
Struct NODE {
Int x, y;
};
Bool cmp (const NODE & lhs, const NODE & rhs)
{
If (lhs. x = rhs. x)
Return lhs. y <rhs. y;
Return lhs. x <rhs. x;
}
NODE a [MAXN];
Int order [MAXN];
Int LDesS (NODE a [], int n)
{
Int I, r, l, len, m;
MEM (order, 0 );
Sort (a, a + n, cmp );
Len = 1;
For (I = 0; I <n; ++ I)
{
L = 1;
R = len;
While (l <= r)
{
M = (l + r)> 1;
If (order [m]> a [I]. y)
L = m + 1;
Else
R = m-1;
}
If (order [l] <a [I]. y)
Order [l] = a [I]. y;
Len = max (len, l );
}
Return len;
}
Int main ()
{
Int x, y, n;
N = 0;
While (scanf ("% d", & x, & y )! = EOF)
{
If (x =-1 & y =-1)
Break;
If (x! = 0 & y! = 0)
{
A [n]. x = x;
A [n]. y = y;
++ N;
} Www.2cto.com
Else
{
Printf ("% d \ n", LDesS (a, n ));
N = 0;
}
}
Return 0;
}
Author: panyanyany