If the VC fails, the request is submitted
# Include <stdio. h>
# Include <stdlib. h>
Struct C
{
Int X;
Int y;
Int ord;
} D [100];
Int CMP (const struct C * a, const struct C * B)
{
If (* A). x = (* B). X)
Return (* A). Y-(* B). Y;
Else
Return (* A). X-(* B). X;
}
Int main ()
{
Int I, j, N, Max;
While (scanf ("% d", & N), n)
{
For (max = I = 0; I <n; I ++)
{
Scanf ("% d", & D [I]. X, & D [I]. y );
D [I]. ord = 1;
}
Qsort (d, n, sizeof (struct C), CMP );
D [n-1]. ord = 1;
For (I = n-2; I> = 0; I --)
{
For (j = I + 1; j <n; j ++)
{
If (d [I]. Y <= d [J]. X & D [I]. ord <D [J]. ord + 1)
D [I]. ord = d [J]. ord + 1;
}
If (max <D [I]. ORD)
Max = d [I]. ord;
}
Printf ("% d \ n", max );
}
Return 0;
}
VC passed, submission failed
# Include <stdio. h>
# Include <stdlib. h>
Struct C
{
Int X;
Int y;
Int ord;
} D [100];
Int CMP (const void * a, const void * B)
{
If (* (C *) a). x = (* (C *) B). X)
Return (* (C *) a). Y-(* (C *) B). Y;
Else
Return (* (C *) a). X-(* (C *) B). X;
}
Int main ()
{
Int I, j, N, Max;
While (scanf ("% d", & N), n)
{
For (max = I = 0; I <n; I ++)
{
Scanf ("% d", & D [I]. X, & D [I]. y );
D [I]. ord = 1;
}
Qsort (d, n, sizeof (struct C), CMP );
D [n-1]. ord = 1;
For (I = n-2; I> = 0; I --)
{
For (j = I + 1; j <n; j ++)
{
If (d [I]. Y <= d [J]. X & D [I]. ord <D [J]. ord + 1)
D [I]. ord = d [J]. ord + 1;
}
If (max <D [I]. ORD)
Max = d [I]. ord;
}
Printf ("% d \ n", max );
}
Return 0;
}