codeforces#281 A
脑子有点秀逗
1 #include<iostream> 2 #include<cstdio> 3 #include<cstring> 4 #include<algorithm> 5 #include<cmath> 6 using namespace std; 7 int teama[120]={0}; 8 int teamb[120]={0}; 9 int main() 10 { 11 string away,home; 12 cin>>home>>away; 13 int n; 14 cin>>n; 15 for(int i=0;i<n;i++) 16 { 17 int nu,time; 18 string ca,peo; 19 cin>>time>>peo>>nu>>ca; 20 if(peo=="h"){ 21 if(ca=="r"&&teama[nu]!=-1){ 22 cout<<home<<" "<<nu<<" "<<time<<endl; 23 teama[nu]=-1; 24 } 25 if(ca=="y"){ 26 if(teama[nu]==1){ 27 cout<<home<<" "<<nu<<" "<<time<<endl; 28 teama[nu]=-1; 29 } 30 if(teama[nu]!=-1) 31 teama[nu]++; 32 } 33 } 34 else{ 35 if(ca=="r"&&teamb[nu]!=-1){ 36 cout<<away<<" "<<nu<<" "<<time<<endl; 37 teamb[nu]=-1; 38 } 39 if(ca=="y"){ 40 if(teamb[nu]==1) 41 { 42 cout<<away<<" "<<nu<<" "<<time<<endl; 43 teamb[nu]=-1; 44 } 45 if(teamb[nu]!=-1) 46 teamb[nu]++; 47 } 48 } 49 } 50 return 0; 51 }