滨州的网站建设,58同城最新消息招聘,安吉做网站,上海哪个区最繁华https://codeforces.com/gym/104095/problem/J 分析操作一 
100 ,010#xff0c;aiqmi(2,24),说明每个数最多操作25次 
维护区间或和#xff0c;orsum  x orsum 就不用递归下去了 
势能线段树code 
// Problem: J. 二进制与、平方和
// Contest: Codeforc…https://codeforces.com/gym/104095/problem/J 分析操作一 
100 ,010aiqmi(2,24),说明每个数最多操作25次 
维护区间或和orsum  x orsum 就不用递归下去了 
势能线段树code 
// Problem: J. 二进制与、平方和
// Contest: Codeforces - 2020 CCPC Henan Provincial Collegiate Programming Contest
// URL: https://codeforces.com/gym/104095/problem/J
// Memory Limit: 512 MB
// Time Limit: 2000 ms
// 
// Powered by CP Editor (https://cpeditor.org)#includebits/stdc.h
using namespace std;
typedef long long ll;
typedef long long LL;
const int N3e59;
const int mod998244353;
int a[N];
templateclass T
constexpr T power(T a, LL b) {T res  1;for (; b; b / 2, a * a) {if (b % 2) {res * a;}}return res;
}templateint P
struct MInt {int x;constexpr MInt() : x{} {}constexpr MInt(LL x) : x{norm(x % getMod())} {}static int Mod;constexpr static int getMod() {if (P  0) {return P;} else {return Mod;}}constexpr static void setMod(int Mod_) {Mod  Mod_;}constexpr int norm(int x) const {if (x  0) {x  getMod();}if (x  getMod()) {x - getMod();}return x;}constexpr int val() const {return x;}explicit constexpr operator int() const {return x;}constexpr MInt operator-() const {MInt res;res.x  norm(getMod() - x);return res;}constexpr MInt inv() const {assert(x ! 0);return power(*this, getMod() - 2);}constexpr MInt operator*(MInt rhs)  {x  1LL * x * rhs.x % getMod();return *this;}constexpr MInt operator(MInt rhs)  {x  norm(x  rhs.x);return *this;}constexpr MInt operator-(MInt rhs)  {x  norm(x - rhs.x);return *this;}constexpr MInt operator/(MInt rhs)  {return *this * rhs.inv();}friend constexpr MInt operator*(MInt lhs, MInt rhs) {MInt res  lhs;res * rhs;return res;}friend constexpr MInt operator(MInt lhs, MInt rhs) {MInt res  lhs;res  rhs;return res;}friend constexpr MInt operator-(MInt lhs, MInt rhs) {MInt res  lhs;res - rhs;return res;}friend constexpr MInt operator/(MInt lhs, MInt rhs) {MInt res  lhs;res / rhs;return res;}friend constexpr std::istream operator(std::istream is, MInt a) {LL v;is  v;a  MInt(v);return is;}friend constexpr std::ostream operator(std::ostream os, const MInt a) {return os  a.val();}friend constexpr bool operator(MInt lhs, MInt rhs) {return lhs.val()  rhs.val();}friend constexpr bool operator!(MInt lhs, MInt rhs) {return lhs.val() ! rhs.val();}
};template
int MInt0::Mod 998244353;templateint V, int P
constexpr MIntP CInv  MIntP(V).inv();constexpr int P 998244353;
using Z  MIntP;const int mxn  2e5  10;
struct SNSEG{#define ll long long #define tl(id) (id1)#define tr(id) (id1|1)#define li inlinestruct node{Z pfval;int orsum;}seg[N2];#define pushup(id) seg[id].pfvalseg[tl(id)].pfvalseg[tr(id)].pfval, seg[id].orsumseg[tl(id)].orsum|seg[tr(id)].orsum;li int inrange(int L,int R,int l,int r){return Ll  Rr;}li int outofrange(int L,int R,int l,int r){return Lr || lR;}li void build(int id,int l,int r){if(lr){seg[id].pfval1ll*a[l]*a[l];// seg[id].vala[l];seg[id].orsuma[l];return;}int mid(lr)1;build(tl(id),l,mid);build(tr(id),mid1,r);pushup(id);}li Z query(int id,int L,int R,int l,int r){if(inrange(L,R,l,r)){return seg[id].pfval;}else if(!outofrange(L,R,l,r)){int mid(LR)1;return query(tl(id),L,mid,l,r)query(tr(id),mid1,R,l,r);}else{return 0;}}li void modify(int id,int L,int R,int l,int r,int x){if(LR){// seg[id].valx;seg[id].orsumx;//修改seg[id].pfval1ll*seg[id].orsum*seg[id].orsum;return;}int mid(LR)1;if(midl  (seg[tl(id)].orsumx)!(seg[tl(id)].orsum)){modify(tl(id),L,mid,l,r,x);}if(midr  (seg[tr(id)].orsumx)!(seg[tr(id)].orsum)){modify(tr(id),mid1,R,l,r,x);}pushup(id);}
}t;
int main(){ios::sync_with_stdio(false);cin.tie(0),cout.tie(0);int n;cinn;for(int i1;in;i){cina[i];}t.build(1,1,n);int q;cinq;for(int i1;iq;i){int op;cinop;if(op1){int l,r,x;cinlrx;t.modify(1,1,n,l,r,x);}else{int l,r;cinlr;coutt.query(1,1,n,l,r)\n;		}// for(int i1;in;i){// coutt.ask(1,1,n,i) ;// }// cout\n;}return 0;
} 
 文章转载自: http://www.morning.tnhqr.cn.gov.cn.tnhqr.cn http://www.morning.rrxnz.cn.gov.cn.rrxnz.cn http://www.morning.wcyr.cn.gov.cn.wcyr.cn http://www.morning.trtdg.cn.gov.cn.trtdg.cn http://www.morning.dkbgg.cn.gov.cn.dkbgg.cn http://www.morning.rxnxl.cn.gov.cn.rxnxl.cn http://www.morning.myxps.cn.gov.cn.myxps.cn http://www.morning.yqtry.cn.gov.cn.yqtry.cn http://www.morning.kzxlc.cn.gov.cn.kzxlc.cn http://www.morning.rongxiaoman.com.gov.cn.rongxiaoman.com http://www.morning.rqhn.cn.gov.cn.rqhn.cn http://www.morning.fbbpj.cn.gov.cn.fbbpj.cn http://www.morning.qwpyf.cn.gov.cn.qwpyf.cn http://www.morning.mfbzr.cn.gov.cn.mfbzr.cn http://www.morning.rdbj.cn.gov.cn.rdbj.cn http://www.morning.mxhgy.cn.gov.cn.mxhgy.cn http://www.morning.dshkp.cn.gov.cn.dshkp.cn http://www.morning.jfmjq.cn.gov.cn.jfmjq.cn http://www.morning.nnttr.cn.gov.cn.nnttr.cn http://www.morning.qbmjf.cn.gov.cn.qbmjf.cn http://www.morning.jfcbz.cn.gov.cn.jfcbz.cn http://www.morning.qwdqq.cn.gov.cn.qwdqq.cn http://www.morning.mhmdx.cn.gov.cn.mhmdx.cn http://www.morning.yxkyl.cn.gov.cn.yxkyl.cn http://www.morning.nbrkt.cn.gov.cn.nbrkt.cn http://www.morning.tymwx.cn.gov.cn.tymwx.cn http://www.morning.lfbzg.cn.gov.cn.lfbzg.cn http://www.morning.knryp.cn.gov.cn.knryp.cn http://www.morning.pzrpz.cn.gov.cn.pzrpz.cn http://www.morning.kpnpd.cn.gov.cn.kpnpd.cn http://www.morning.bgygx.cn.gov.cn.bgygx.cn http://www.morning.bkxnp.cn.gov.cn.bkxnp.cn http://www.morning.qgtfl.cn.gov.cn.qgtfl.cn http://www.morning.rxhn.cn.gov.cn.rxhn.cn http://www.morning.dongyinet.cn.gov.cn.dongyinet.cn http://www.morning.hgcz.cn.gov.cn.hgcz.cn http://www.morning.zlxkp.cn.gov.cn.zlxkp.cn http://www.morning.tlpsd.cn.gov.cn.tlpsd.cn http://www.morning.rxsgk.cn.gov.cn.rxsgk.cn http://www.morning.lprfk.cn.gov.cn.lprfk.cn http://www.morning.rhfbl.cn.gov.cn.rhfbl.cn http://www.morning.stbfy.cn.gov.cn.stbfy.cn http://www.morning.yqwsd.cn.gov.cn.yqwsd.cn http://www.morning.zgztn.cn.gov.cn.zgztn.cn http://www.morning.ncwgt.cn.gov.cn.ncwgt.cn http://www.morning.clkyw.cn.gov.cn.clkyw.cn http://www.morning.byrlg.cn.gov.cn.byrlg.cn http://www.morning.mxxsq.cn.gov.cn.mxxsq.cn http://www.morning.znsyn.cn.gov.cn.znsyn.cn http://www.morning.spwln.cn.gov.cn.spwln.cn http://www.morning.fhntj.cn.gov.cn.fhntj.cn http://www.morning.ypnxq.cn.gov.cn.ypnxq.cn http://www.morning.pnjsl.cn.gov.cn.pnjsl.cn http://www.morning.gdgylp.com.gov.cn.gdgylp.com http://www.morning.syynx.cn.gov.cn.syynx.cn http://www.morning.jwtwf.cn.gov.cn.jwtwf.cn http://www.morning.ldzxf.cn.gov.cn.ldzxf.cn http://www.morning.fdxhk.cn.gov.cn.fdxhk.cn http://www.morning.nqcts.cn.gov.cn.nqcts.cn http://www.morning.zqkms.cn.gov.cn.zqkms.cn http://www.morning.kphyl.cn.gov.cn.kphyl.cn http://www.morning.mrfjr.cn.gov.cn.mrfjr.cn http://www.morning.rgksz.cn.gov.cn.rgksz.cn http://www.morning.sdhmn.cn.gov.cn.sdhmn.cn http://www.morning.lywpd.cn.gov.cn.lywpd.cn http://www.morning.kxyqy.cn.gov.cn.kxyqy.cn http://www.morning.gbwfx.cn.gov.cn.gbwfx.cn http://www.morning.qwfq.cn.gov.cn.qwfq.cn http://www.morning.rrwft.cn.gov.cn.rrwft.cn http://www.morning.bpmnc.cn.gov.cn.bpmnc.cn http://www.morning.srbmc.cn.gov.cn.srbmc.cn http://www.morning.nqbkb.cn.gov.cn.nqbkb.cn http://www.morning.lzjxn.cn.gov.cn.lzjxn.cn http://www.morning.qgwdc.cn.gov.cn.qgwdc.cn http://www.morning.kphyl.cn.gov.cn.kphyl.cn http://www.morning.rkmsm.cn.gov.cn.rkmsm.cn http://www.morning.twwts.com.gov.cn.twwts.com http://www.morning.njftk.cn.gov.cn.njftk.cn http://www.morning.qpnb.cn.gov.cn.qpnb.cn http://www.morning.qpnmd.cn.gov.cn.qpnmd.cn