版本比较
栈
正文
增加 7 行删除 4 行
79 行未改动808182838484858687882 行未改动91929394959596979899138 行未改动全部展开23823924024124224224324424524674 行未改动32132232332432532632732832933033128 行未改动36036136236336136436536636736851 行未改动79 行未改动如题目描述。:::info[代码]```cpp line-numbers#include<iostream>#define int unsigned long long //不开 ull 见祖宗 #define int unsigned long long //不开 ull 见祖宗using namespace std;const int N=1e6+010;int st[N],tot;int n;2 行未改动 cin.tie(0),cout.tie(0); int t; cin>>t; while(t--){ tot=0; //多测清空 tot=0; //多测清空 cin>>n; string str; while(n--){ cin>>str;138 行未改动全部展开void Change(){ for(int i=1;i<=tot;i++) str[++t]={s[i],t-1,t+1}; str[1].lst=-1; str[t].nxt=-1; str[t].nxt=-1;}int qpow(int a,int b){ int ans=1; while(b){74 行未改动while(!st.empty()&&st.top()<x) st.pop();st.push(x);```$$\LARGE\bold{例题}$$## [$\color{black}\bold{P5788\ 【模板】单调栈}$](https://www.luogu.com.cn/problem/P5788)### 思路对于每个在插入第 $i$ 个元素时弹出的元素,记录其结果为 $i$ 。:::info[代码]28 行未改动```cpp#include<iostream>#include<cstdio>#include<stack>#define int long long //不开 long long 见祖宗 #define int long long //不开 long long 见祖宗using namespace std;const int maxn=5e5+010;template<typename T>struct Stack{51 行未改动