teamnote default

This commit is contained in:
2026-06-03 09:20:51 +09:00
commit f50ed902fe
65 changed files with 6033 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();