Solved by 963 users: ...
UserDateAttemptTimeCMSC
white_dragon`09 jan 2010`Perl6301.5721
white_dragon`09 jan 2010`Perl2301.4826
white_dragon`09 jan 2010`Perl1501.2032
white_dragon`09 jan 2010`Perl1401.1938
xtender`08 jan 2010`Perl2001.2048
kil`11 jul 2007`Ruby2503.0150
vi002`11 jul 2007`Ruby2202.9851
var`11 jul 2007`Ruby1403.0851
var`11 jul 2007`Ruby1302.9453
kil`11 jul 2007`Ruby1603.0154
sb3ar`11 may 2008`Ruby1703.2155
sb3ar`12 feb 2008`Ruby1503.2156
kil`11 jul 2007`Ruby2403.0057
sb3ar`11 may 2008`Ruby1603.0358
s97302`29 jan 2010`Ruby802.6660
s97302`29 jan 2010`Ruby402.5761
s97302`29 jan 2010`Ruby302.4962
qdiesel`07 nov 2008`Ruby303.0663
bush`25 feb 2013`Ruby202.1967
stasg7`10 dec 2009`Ruby1302.0768
 C++ 622 C 211 FPC 58 Java 42 Python 18 Kylix 15 Ruby 15 Perl 5 Lua 3 Scheme 1
` >  >  >  >  >  >  >  >  >  > `

## Athletes

Time limit = 3 second(s)

Every athlete is characterized by his mass mi (in kg) and strength si(in kg).

You are to find the maximum number of athletes that can form a tower standing one upon another.

An athlete can hold a tower of athlets with total mass equal to his strength or less than his strength.

Input contains the number of athletes n and their parameters:

```n
m1 s1
m2 s2
...
mn  sn
```

If mi > mj then si > sj, but athletes with equal masses can be of different strength.

Number of athletes n < 100000. Masses and strengths are positive integers less than 2000000.

 Input#1```4 3 4 2 2 7 6 4 5 ``` Output#1```3 ```

Author:

 © acm.mipt DevGroupThe page was generated in 200ms