@[encore](/space/show?uid=113385)
**别人不能轻易看你的评测记录!!!**
by Leap_Frog @ 2019-04-03 19:45:41
~~这代码能看?~~
by SSerxhs @ 2019-04-03 20:03:34
@[SSerxhs](/space/show?uid=29826)
去掉读优的话大概是这样子的:
```cpp
#include <cstdio>
#include <iostream>
namespace luogu3374{
using namespace IO;
typedef size_t _Tp;
const _Tp maxn = 5e5;
_Tp n, m;
_Tp c[maxn | 1];
inline _Tp lowbit(_Tp x) { return x & (~ x + 1);}
inline void add(_Tp x, _Tp v) {
for (; x<= n; x += lowbit(x)) c[x] += v;
}
inline _Tp Sum(_Tp x) {
_Tp retval = 0;
for (; x; x -= lowbit(x)) retval += c[x];
return retval;
}
inline _Tp sum(_Tp x, _Tp y) {
return Sum(y) - Sum(x - 1);
}
}
int main(int argc, char const *argv[]) {
{
using namespace luogu3374;
redi(n, m);
_Tp x1, x2, x3;
for (register _Tp i = 1; i <= n; ++ i) add(i, (redi(x1), x1));
do {
redi(x1, x2, x3);
if (x1 == 1) add(x2, x3);
else put(sum(x2, x3));
} while(-- m);
}
return 0;
}
```
by encore @ 2019-04-05 15:12:28