求助各位大佬,程序超时了
#include<bits/stdc++.h>
using namespace std;
stack <int> st;
int n,x,m,y;
string chos;
int main() {
cin>>n;
for (int i=1;i<=n;i++)
{
cin>>x;
for (int i=1;i<=x;i++)
{
cin>>chos;
if (chos=="push")
{
cin>>y;
st.push (y);
}
else if (chos=="pop")
{
if (st.empty())
cout<<"Empty"<<endl;
else
st.pop();
}
else if (chos=="query")
{
if (st.empty())
cout<<"Anguei!"<<endl;
else
cout<<st.top()<<endl;
}
else
cout<<st.size()<<endl;
}
while (!st.empty())
st.top();
}
return 0;
}