正文
增加 5 行删除 5 行
24 行未改动25262728293031323347 行未改动8182838485868788899091929394954 行未改动24 行未改动代码:```c++while(!st.empty()&&a[st.top()]<=a[i]){st.pop();}```### 入栈:47 行未改动for(int i=1;i<=n;i++){cin>>a[i];}for(int i=1;i<=n;i++){//使用栈来维护一个单调减序列,序列中每个元素都是后缀最大值//存的是下标,可以访问每一个值//出栈条件:非空,栈顶元素小于新元素,如果等于也出栈while(!st.empty()&&a[st.top()]<=a[i]){//出栈ans^=st.top();st.pop();}st.push(i);ans^=i;cout<<ans<<endl;4 行未改动24 行未改动25262728293031323347 行未改动8182838485868788899091929394954 行未改动24 行未改动代码:```c++while(!st.empty()&&a[st.top()]<=a[i]){st.pop();}```### 入栈:47 行未改动for(int i=1;i<=n;i++){cin>>a[i];}for(int i=1;i<=n;i++){//使用栈来维护一个单调减序列,序列中每个元素都是后缀最大值//存的是下标,可以访问每一个值//出栈条件:非空,栈顶元素小于新元素,如果等于也出栈while(!st.empty()&&a[st.top()]<=a[i]){//出栈ans^=st.top();st.pop();}st.push(i);ans^=i;cout<<ans<<endl;4 行未改动