Http://codeforces.com/problemset/problem/755/B
Test instructions: A can shout out n string, B can shout out M string, if a string was shouted before, then it could no longer shout, a first shout, finally did not shout lose. Ask who wins.
Idea: Use map to judge A, b in the same number of strings, because a can shout first, then B shout, everyone can shout the number to subtract CNT/2 (if it is odd, a can shout more one), said the other shouted. If the last N<=m is a lose, otherwise a win, equal to the situation is because a first shout, B again shout, to the last a will lose.
1#include <cstdio>2#include <cstring>3#include <cmath>4#include <cstdlib>5#include <algorithm>6#include <string>7#include <iostream>8#include <stack>9#include <map>Ten#include <queue> One#include <Set> A using namespacestd; -typedefLong LongLL; - #defineN 100010 the #defineINF 0x3f3f3f3f - strings1[1010]; - strings2[1010]; -map<string,int>MP; + - intMain () + { A intn,m; atCIN >> N >>m; - for(inti =1; I <= N; i++) Cin >>S1[i]; - for(inti =1; I <= m; i++) Cin >>S2[i]; - intf =0; - for(inti =1; I <= N; i++) Mp[s1[i] =1; - for(inti =1; I <= m; i++)if(Mp[s2[i]]) f++; inN-= (f/2); M-= (F-f/2); - if(n > M) puts ("YES"); to ElsePuts"NO"); + return 0; -}
Codeforces 755b:polandball and Game (map+ thinking)