11402

#include <iostream> #include <cstdio> #include <cstring> #include <string> #define sz 1024001 #define INV 1 #define SET 2 #define RESET 3 using namespace std; struct segment{ int pending_op_typ; int sum; int left,right; int len; }; segment tree[sz*4]; string ss; void init(int node,int b,int e) { tree[node].len = e-b+1; tree[node].left=b; tree[node].right=e; tree[node].pending_op_typ=0; if(b==e) { if(ss[b]=='1') tree[node].sum=1; else

12436

#include <iostream> #include <cstdio> #include <cstring> #include <string> #include <vector> #define ll long long #define sz 250005 using namespace std; struct segment{ ll left,right; ll len; ll first_inc,last_inc; ll totalAB; bool isSetvalue; ll cary; ll sum; }; segment arr[sz*4]; void changeAB(ll frist_incr,ll last_incr,int node,ll step) { arr[node].totalAB += step; arr[node].first_inc += frist_incr; arr[node].last_inc += last_incr;