设为首页 加入收藏

TOP

Codeforces 12D Ball 树状数组模拟3个元素的排序
2015-11-21 02:01:52 来源: 作者: 【 】 浏览:6
Tags:Codeforces 12D Ball 模拟 元素 排序

题目链接:点击打开链接


#include
  
   
#include
   
     #include
    
      #include
     
       #include
      
        #include
        #include
        
          #include
         
           #include
          
            #include
           
             #include
            
              using namespace std; #define N 500005 #define ll int ll n; ll c[N], maxn; inline ll lowbit(ll x){return x&(-x);} void change(ll pos, ll val){ while(pos)c[pos]=max(c[pos],val), pos-=lowbit(pos); } ll maxx(ll pos){ ll ans = -1; while(pos<=maxn)ans = max(ans,c[pos]),pos+=lowbit(pos); return ans; } struct node{ ll b[3],num; }w[N]; bool cmp0(node x, node y){return x.b[0]
             
              y.b[1];} int main(){ ll i,j; while(cin>>n) { for(i=0;i
              
               w[j].b[2]) ans++; for(j = i; j < n && w[i].b[1] == w[j].b[1]; j++) change(w[j].num, w[j].b[2]); i = j; } cout<
               
                

】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇[BZOJ 1096][ZJOI2007]仓库建设 下一篇修改文件名

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: