Welcome, Guest! Sign Up RSS

Clever Space

Friday, 11.22.2024
Main » 2013 » October » 20

还是GSS的思想

把区间分开,段用lazy-tag更新(ps:写死了)

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<vector>
#include<set>
#include<map>
#include<string>
#include<algorithm>
#define FOR(i,a,b) for(i=(a);i<=(b);i++)
#define ROF(i,a,b) for(i=(a);i>=(b);i--)
#define pb push_back
#define mp make_pair
#define LC(x) ((x)<<1)
#define RC(x) (((x)<<1)+1)
#define N 50100
using namespace std;
typedef long long LL;
typedef long double LD;
struct node
{
  int l,r,fill,lm,rm,om;
  int dis(){return r-l+1;}
  void init(){lm=rm=om=dis();fill=0;}
  void calc(){if (fill==0) lm=rm=om=dis();else if (fill==1) ... Read more »
Views: 320 | Added by: dhy0077 | Date: 10.20.2013

RT
Views: 378 | Added by: dhy0077 | Date: 10.20.2013