Sunday 15 January 2017

8VC Venture Cup 2017 - Elimination Round/B. PolandBall and Game

Problem: http://codeforces.com/contest/755/problem/B
Code:
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s1,s2;
    long long n,m,i,j,f,c;
    map<string,bool> mp;
    while(cin>>n>>m)
    {
        for(i=0; i<n; i++)
        {
            cin>>s1;
            mp[s1]=true;
        }
        c=0;
        for(i=0; i<m; i++)
        {
            cin>>s2;
            if(mp[s2]==true)
                c++;
        }
      if(c%2==1)
        m--;
        if(n>m)
            cout<<"YES"<<endl;
        else
            cout<<"NO"<<endl;
    }
    return 0;

}

No comments:

Post a Comment