Codeforces 228 div2 A,B,C(二)

2014-11-24 08:45:59 · 作者: · 浏览: 4
the second box directly on the top of the first one, and then the third box directly on the top of the second one. We will call such a construction of boxes a pile.

\

Fox Ciel wants to construct piles from all the boxes. Each pile will contain some boxes from top to bottom, and there cannot be mZ http://www.2cto.com/kf/ware/vc/" target="_blank" class="keylink">vcmUgdGhhbjxlbT54PC9lbT48ZW0+aTwvZW0+IGJveGVzCiBvbiB0aGUgdG9wIG9mIDxlbT5pPC9lbT4tdGggYm94LiBXaGF0IGlzIHRoZSBtaW5pbWFsIG51bWJlciBvZiBwaWxlcyBzaGUgbmVlZHMgdG8gY29uc3RydWN0PzwvcD4KCgoKSW5wdXQKPHA+ClRoZSBmaXJzdCBsaW5lIGNvbnRhaW5zIGFuIGludGVnZXIgPGVtPm48L2VtPiAoMT+h3D88ZW0+bjwvZW0+P6HcPzEwMCkuCiBUaGUgbmV4dCBsaW5lIGNvbnRhaW5zIDxlbT5uPC9lbT4gaW50ZWdlcnMgPGVtPng8L2VtPjEsPzxlbT54PC9lbT4yLD8uLi4sPzxlbT54PC9lbT48ZW0+bjwvZW0+ICgwP6HcPzxlbT54PC9lbT48ZW0+aTwvZW0+P6HcPzEwMCkuPC9wPgoKCgpPdXRwdXQKPHA+Ck91dHB1dCBhIHNpbmdsZSBpbnRlZ2VyIKGqIHRoZSBtaW5pbWFsIHBvc3NpYmxlIG51bWJlciBvZiBwaWxlcy48L3A+CgoKClNhbXBsZSB0ZXN0KHMpCgoKCmlucHV0CjxwcmUgY2xhc3M9"brush:java;">3 0 0 10

output
2
input
5
0 1 2 3 4
output
1
input
4
0 0 0 0
output
4
input
9
0 1 0 2 0 1 1 2 10
output
3
Note

In example 1, one optimal way is to build 2 piles: the first pile contains boxes 1 and 3 (from top to bottom), the second pile contains only box 2.

\

In example 2, we can build only 1 pile that contains boxes 1, 2, 3, 4, 5 (from top to bottom).

\


#include 
        
         
#include 
         
           #include 
          
            #include 
           
             using namespace std; int st[1000],n,ans=0; int vis[1000]; int main() { scanf("%d",&n); for(int i=0;i
            
             =strength) { vis[j]=ans; strength++; } } } } printf("%d\n",ans); return 0; }