代码球跳

B3666 求数列所有后缀最大值的位置

?
by Pjy000 @ 2024-04-25 20:42:56


@[wuhansen](/user/548166) 你在干嘛? 举报举报 @[duck](/user/66143) 33
by kaizel @ 2024-04-25 20:44:06


``` #include<bits/stdc++.h> using namespace std; const int N=1e5+10; int a[N],ans=0; int b[N],n,c[N]; stack<int>st; int main() { cin>>n; for(int i=1;i<=n;i++) cin>>a[i]; a[0]=1e9; st.push(0); for(int j=1;j<=n;j++) { for(int k=1;k<=j;k++) c[k]=a[k]; for(int i=j;i>=1;i--) { while(c[st.top()]<=c[i]) st.pop(); b[i]=st.top(); st.push(i); } for(int k=1;k<=j;k++) ans^=b[k]; cout<<ans<<'\n'; } return 0; } ``` 调好了,球冠
by kezhiyu0828 @ 2024-04-25 20:47:51


@[duck33](/user/402881) 你看看他在干什么 @[wuhansen](/user/548166)
by taikongsha @ 2024-04-29 16:31:27


@[kezhiyu0828](/user/823921) 大佬大佬你啥也没改呀
by wuhansen @ 2024-04-30 16:07:59


|