#include<cstdio>
typedef struct
{
int attack,health;
} cus; cus info[][];
int aliv[];
int player = ; void summon();
void attack();
void solven();
void del(int,int);
//void init(); int main()
{
int n=;
char order[];
//init();
scanf("%d",&n);
info[][].health = ;
info[][].health = ;
while(n--)
{
scanf("%s",order);
if(order[] == 'e')
player = !player;
else if(order[] == 's')
summon();
else if(order[] == 'a')
attack();
}
solven();
} void summon()
{
int p,a,h;
scanf("%d%d%d",&p,&a,&h);
++aliv[player];
for(int i=aliv[player]; i>p; --i)
{
info[player][i].attack = info[player][i-].attack;
info[player][i].health = info[player][i-].health;
}
info[player][p].attack = a;
info[player][p].health = h;
//init();
} void attack()
{
int p1,p2;
scanf("%d%d",&p1,&p2);
if(p2 != )
{
info[player][p1].health -= info[(!player)][p2].attack;
info[(!player)][p2].health -= info[player][p1].attack;
if(info[player][p1].health < )
del(player,p1);
if(info[(!player)][p2].health <)
del((!player),p2);
}
else
info[(!player)][p2].health -= info[player][p1].attack;
//init();
} void solven()
{
//init();
int num;
if(info[][].health < && info[][].health > )
printf("-1\n");
else if(info[][].health < && info[][].health > )
printf("1\n");
else
printf("0\n"); printf("%d\n%d",info[][].health,aliv[]);
for(int i=; i<=aliv[]; ++i)
printf(" %d",info[][i].health);
printf("\n"); printf("%d\n%d",info[][].health,aliv[]);
for(int i=; i<=aliv[]; ++i)
printf(" %d",info[][i].health);
printf("\n");
} void del(int x,int p)
{
for(int i=p; i<aliv[x]; ++i)
{
info[x][i].attack = info[x][i+].attack;
info[x][i].health = info[x][i+].health;
}
info[x][aliv[x]].attack = ;
info[x][aliv[x]].health = ;
--aliv[x];
} /*void init()
{
puts("\n*************************");
puts("player1's attack:");
for(int i=0; i<8; ++i)
printf("%d ",info[0][i].attack);
puts(""); puts("player1's health:");
for(int i=0; i<8; ++i)
printf("%d ",info[0][i].health);
puts(""); puts("player2's attack:");
for(int i=0; i<8; ++i)
printf("%d ",info[1][i].attack);
puts(""); puts("player2's health:");
for(int i=0; i<8; ++i)
printf("%d ",info[1][i].health);
puts("");
puts("*************************\n");
}*/
05-11 22:16