Sdoi2017 相關分析 線段樹

2022-04-06 19:37:36 字數 1269 閱讀 3281

題意:沙茶線段樹

md其實我考場上還剩乙個多小時寫了40分

其實當時寫正解也可以吧1h也就寫完了不過還要拍一下

正解**比40分短2333

#include #include #include #include #include using namespace std;

typedef long long ll;

#define fir first

#define sec second

#define lc x<<1

#define rc x<<1|1

#define mid ((l+r)>>1)

#define lson lc, l, mid

#define rson rc, mid+1, r

const int n=1e5+5, inf=1e9, m=1e5+5;

inline int read()

while(c>='0' && c<='9')

return x*f;

}int n, q, op, ql, qr;

double a[n], b[n], s, w;

namespace seg

meow(double a, double b, double c, double a2): a(a), b(b), c(c), a2(a2), ta(0), tb(0), sa(-1), sb(-1){}

} t[n<<2];

meow operator + (const meow &x, const meow &y)

inline double cal2(double n)

inline void _set(int x, int l, int r, double s, double w)

inline void _add(int x, int l, int r, double s, double w)

inline void pushdn(int x, int l, int r)

if(t[x].ta || t[x].tb)

} void build(int x, int l, int r)

} void add(int x, int l, int r)

} void cha(int x, int l, int r)

} meow que(int x, int l, int r) }

void quer()

}int main()

}

Sdoi2017 相關分析 線段樹

題意 沙茶線段樹 md其實我考場上還剩乙個多小時寫了40分 其實當時寫正解也可以吧1h也就寫完了不過還要拍一下 正解 比40分短2333 include include include include include using namespace std typedef long long ll ...

SDOI2017 相關分析

題目傳送門 看了 loj 300多份 似乎我是唯二寫分塊的?剛開始感覺線段樹比較難寫,就開始碼分塊了。現在知道為什麼沒人寫分塊了 很容易想到將式子進行拆分,然後維護各種東西 操作1 a frac x i y i x i overline overline y i overline overline ...

SDOI2017 相關分析(用線段樹維護平方和)

題目啊,這道題目一點思路都沒有啊。這麼神奇的嗎。就是死命的推式子,這裡用一下這位大佬的證明。當然,寫這個部落格主要是想講一下維護平方和和區間加減。首先,區間的 lazy 標記具有可加性 x k k 2 x 2k 2 因此,lazy 標記可以疊加,只要計算每乙個 lazy 標記會對維護的值產生多少的貢...