1350. Canteen(map)

1350

这题没什么  就考一下map的用法吧 

 1 #include <iostream>

 2 #include<cstdio>

 3 #include<cstring>

 4 #include<algorithm>

 5 #include<map>

 6 using namespace std;

 7 map<string,int>q;

 8 int f[110];

 9 char s1[110][44],ss[45];

10 int o[110],p[110];

11 int main()

12 {

13     int i,j,n,k,t;

14     scanf("%d",&n);

15     for(i = 1; i <= n ;i++)

16     {

17         scanf("%s",s1[i]);

18         q[s1[i]] = i;

19     }

20     scanf("%d",&k);

21     scanf("%d",&p[k+1]);

22     for(i = 1; i <= p[k+1] ; i++)

23     {

24         scanf("%s",ss);

25         f[q[ss]] = 1;

26     }

27     for(i = 1; i <= k ; i++)

28     {

29         scanf("%d",&p[i]);

30         for(j = 1; j <= p[i] ; j++)

31         {

32             scanf("%s",ss);

33             if(f[q[ss]])

34             o[i]++;

35         }

36     }

37     scanf("%d",&t);

38     for(i = 1; i <= k ; i++)

39     {

40         if(o[i]==p[i])

41         printf("YES\n");

42         else if(p[i]-o[i]>(n-p[k+1]-t))

43         printf("NO\n");

44         else

45         printf("MAYBE\n");

46     }

47     return 0;

48 }
View Code

 

你可能感兴趣的:(ant)