IkunFriendsChat @ 2024-10-02 22:59:05
本人的AC代码无法通过样例,却通过了原题?求助
#include<bits/stdc++.h>
using namespace std;
int T;
int main()
{
scanf("%d",&T);
while(T--)
{
int nm[29]={0},g[29]={0},lp[114]={0};
string s1,s2;
int a;string tm;
cin>>a>>tm;
int inde=0;int loopn=0,k=0,loopnow=0,n=0,m=0;
for(int i=4;i<tm.size();i++)if(isdigit(tm[i]))inde=(inde<<3)+(inde<<1)+tm[i]-'0';
int fl=1;//printf("%d ",inde);
while(a)
{
a--;
cin>>s1;
if(s1=="F")
{
++loopn;cin>>s1;
if(nm[s1[0]-'a'+1])loopn=-1;
nm[s1[0]-'a'+1]=1;g[loopn]=s1[0]-'a'+1;
cin>>s1>>s2;
if(s1!="n"&&s2=="n"&&!k)loopnow++,lp[loopn]=1;
else if(((s1.size()==s2.size()&&s1>s2)||(s1.size()>s2.size())||(s1[0]=='n'&&s2[0]!='n'))&&!k)k=1,n=loopn;
m=max(m,loopnow);
}
else
{
m=max(m,loopnow);nm[g[loopn]]=0;
if(lp[loopn]==1)loopnow--,lp[loopn]=0;
loopn--;
if(n>0&&loopn<n)k=0,n=0;
}
if(loopn==-1)fl=0;
}
if(loopn!=0||!fl)printf("ERR\n");
else
{
if(m==inde)printf("Yes\n");
else printf("No\n");
}
}
}
对于样例的第8个数据,我的代码会return 3221225477,但是可以通过原题,求条