Welcome, Guest! Sign Up RSS

Clever Space

Friday, 11.22.2024
Main » 2013 » September » 16
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<vector>
#define N 500010
#define L 600010
using namespace std;
vector<int> pos[N];
vector<int> Q[N];
long long c[L],a[N],M=0;
long long LC[N][2],RC[N][2],D[N],P[N];
long long lowbit(long long x){return x&(-x);}
long long getsum(long long x)
{long long res=0;for (long long i=x;i>0;i-=lowbit(i)) res+=c[i];return res;}
void modify(long long x,long long delta)
{for (long long i=x;i<=M;i+=lowbit(i)) c[i]+=delta;}
int main()
{
  int n,m,i,j;
  scanf("%d %d",&n,&m);
  for (i=1;i<=n;i++) 
  {
    scanf("%d",&a[i]);   
    if (a[i]>M) M=a[i];
Views: 315 | Added by: dhy0077 | Date: 09.16.2013