「CF493A」Vasya and Football
题解
英文阅读模拟题。。。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
#include<map> #include<set> #include<cmath> #include<cstdio> #include<vector> #include<cstring> #include<cstdlib> #include<iostream> #include<algorithm> #define ll long long #define mod 1000000007 #define inf 1000000000 using namespace std; int read() { int x=0,f=1;char ch=getchar(); while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();} while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();} return x*f; } int n; int a[2][105]; char ch[2][50];//h,a struct data{int t,num;char b[2],c[2];}q[105]; bool operator<(data a,data b) { return a.t<b.t; } int main() { scanf("%s%s",ch[0],ch[1]); n=read(); for(int i=1;i<=n;i++) q[i].t=read(),scanf("%s",q[i].b),q[i].num=read(),scanf("%s",q[i].c); sort(q+1,q+n+1); for(int i=1;i<=n;i++) { int team; if(q[i].b[0]=='h')team=0; else team=1; if(a[team][q[i].num]<2) { if(q[i].c[0]=='r')a[team][q[i].num]=2; else a[team][q[i].num]++; if(a[team][q[i].num]==2) printf("%s %d %d\n",ch[team],q[i].num,q[i].t); } } return 0; } |
Subscribe