teamnote history merge

This commit is contained in:
2026-06-03 09:36:52 +09:00
parent f50ed902fe
commit 7176febe54
142 changed files with 13243 additions and 0 deletions

View File

@@ -0,0 +1,13 @@
int A[N], par[N];
stack<int> st;
forr(i, n) {
int l = -1;
while(!st.empty() && A[st.top()] < A[i])
l = st.top(), st.pop();
if(l != -1) par[l] = i;
if(!st.empty()) par[i] = st.top();
st.push(i);
}
while(st.size() != 1) st.pop();
par[st.top()] = st.top();