[BZOJ3378] [Usaco2004 Open]MooFest 狂欢节(树状数组)


传送门

开2个树状数组

一个存的是下标,一个存的是数量

细节。。。看标称吧,懒得说了,好气啊

#include <cstdio> #include <iostream> #include <algorithm> #define N 20001 #define LL long long #define max(x, y) ((x) > (y) ? (x) : (y)) int n, m; LL ans, sum, c[N], d[N]; struct node p[N]; inline int read() inline bool cmp(node x, node y) inline LL query1(int x) inline LL query2(int x) inline void add1(int x, LL y) inline void add2(int x, LL y) int main() std::sort(p + 1, p + n + 1, cmp); for(i = 1; i <= n; i++) printf("%lld\n", ans); return 0; }

  



上一篇:[BZOJ1592] [Usaco2008 Feb]Making the Grade 路面修整(DP)

下一篇:[BZOJ1575] [Usaco2009 Jan]气象牛Baric(DP)


树状数组
Copyright © 2002-2019 k262电脑网 www.k262.cn 皖ICP备2020016292号
温馨提示:部分文章图片数据来源与网络,仅供参考!版权归原作者所有,如有侵权请联系删除!QQ:251442993 热门搜索 网站地图