为什么MLE?(悬赏1关注)
  • 板块CF190C STL
  • 楼主konyakest
  • 当前回复15
  • 已保存回复15
  • 发布时间2022/8/28 17:42
  • 上次更新2023/10/27 13:18:13
查看原帖
为什么MLE?(悬赏1关注)
482660
konyakest楼主2022/8/28 17:42

rt

#include <bits/stdc++.h>
using namespace std;
#define F(i,j,k) for (signed i=signed(j);i<=signed(k);i++)
#define endl '\n'
int n;
string s;
string stk[100005];
int top;
signed main() { 
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cin>>n;
	while(cin>>s){
		stk[++top]=s;
		if(s=="int"){
			while(top>=3&&stk[top-1]!="pair"&&stk[top-2]=="pair"){
				string tmp=stk[top-2]+"<"+stk[top-1]+","+stk[top]+">";
				top-=2;
				stk[top]=tmp;
				stk[top+1]=stk[top+2]="";
			}
		}
	}
	cout<<(top==1?stk[top]:"Error occurred")<<endl;
	return 0; 
}
2022/8/28 17:42
加载中...