diff --git a/QUSTOJ/1713.cpp b/QUSTOJ/1713.cpp new file mode 100644 index 0000000..1b6c85b --- /dev/null +++ b/QUSTOJ/1713.cpp @@ -0,0 +1,125 @@ +#include +#include +#include +#include +using namespace std; + +int node[20000000]= {0}; + +int require(int targetleft,int targetright,int cnode,int leftbound,int rightbound) +{ + if(targetleft<=leftbound&&targetright>=rightbound) + { + return node[cnode]; + } + if(targetrightrightbound) + { + return 0; + } + int a=require(targetleft,targetright,cnode*2+1,leftbound,(rightbound+leftbound)/2); + int b=require(targetleft,targetright,cnode*2+2,(leftbound+rightbound)/2+1,rightbound); + return max(a,b); +} + +void special(int q) +{ + /// n==1 + int x=0; + scanf("%d",&x); + for(int i=0; i0) + { + for(int toadd=0; toadd0) + { + node[cnt]=max(node[cnt*2+1],node[cnt*2+2]); + cnt=(cnt-1)/2; + } + node[0]=max(node[1],node[2]); + } + break; + case 'Q': + { + if(a==b) + { + printf("%d\n",node[realn-1+a-1]); + } + else + { + if(b