|  | 
|  | 
| back to board | WA #5, why !! :-( I always get WA in #5here is my code, somebody help me please.
 <code>
 #include<stack>
 #include<iostream>
 #include<algorithm>
 #include<vector>
 #include<list>
 #include<iterator>
 using namespace std;
 
 int getSafe(vector<string> a,int an, vector<string> b, int bn){
 int d=0;
 for(int i=0;i<an;i++){
 for(int j=0;j<bn;j++)
 if(a[i]==b[j]){
 d++;
 break;
 }
 }
 return d;
 }
 struct ve{
 vector<string> v;
 };
 
 int main(){
 int n,N,m;
 cin>>N;
 string str;
 vector<string> menu;
 for(int i=0;i<N;i++){
 cin>>str;
 menu.push_back(str);
 }
 cin>>n;
 int a,b;
 cin>>b;
 vector<string> fMenu;
 for(int i=0;i<b;i++){
 cin>>str;
 fMenu.push_back(str);
 }
 int i=0;
 int nums[102];
 ve res[102];
 while(i<n){
 cin>>a;
 nums[i]=a;
 for(int j=0;j<a;j++){
 //cout<<"d";
 cin>>str;
 //cout<<"s";
 res[i].v.push_back(str);
 }
 i++;
 }
 cin>>m;
 for(int i=0;i<n;i++){
 int x=getSafe(res[i].v,nums[i],fMenu,n);
 int c=getSafe(menu,N,res[i].v,nums[i]);
 if(x-nums[i]==0)
 cout<<"YES\n";
 else
 if(N-b-nums[i]+x-m<0)
 cout<<"NO\n";
 else
 cout<<"MAYBE\n";
 }
 return 0;
 }
 </code>
 | 
 | 
|