标签:bool lin max turn pac add int bit ==
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<=b;++i)
/*
1 add
2 beq
3 bne
4 blt
5 bgt
*/
const int maxn=1e4+5;
int n,r;
int con[maxn][5];
int cnt[maxn];
inline int query(char a[])
{
switch(a[1])
{
case ‘d‘:
return 1;
case ‘e‘:
return 2;
case ‘n‘:
return 3;
case ‘l‘:
return 4;
case ‘g‘:
return 5;
}
}
int main()
{
int T;scanf("%d",&T);
while(T--)
{
memset(cnt,0,sizeof cnt);
int r=0;
scanf("%d",&n);
for(int i=1;i<=n;++i)
{
char tmp[10];
scanf("%s",tmp);
con[i][0]=query(tmp);
if(con[i][0]==1)scanf("%d",&con[i][1]);
else scanf("%d%d",&con[i][1],&con[i][2]);
}
bool flag=true;
for(int i=1;i<=n;++i)
{
//printf("%d: r=%d\n",i,r);
if(con[i][0]==1)r=(r+con[i][1])%256;
else{
if(++cnt[i]>256){flag=false;break;}
bool what=false;
switch(con[i][0])
{
case 2:
if(r==con[i][1])what=true;
break;
case 3:
if(r!=con[i][1])what=true;
break;
case 4:
if(r<con[i][1])what=true;
break;
case 5:
if(r>con[i][1])what=true;
break;
}
if(what)i=con[i][2]-1;
}
}
if(flag)printf("Yes\n");
else printf("No\n");
}
}
标签:bool lin max turn pac add int bit ==
原文地址:https://www.cnblogs.com/maoruimas/p/9657108.html