codeforce 755 B
Posted ronnielee
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了codeforce 755 B相关的知识,希望对你有一定的参考价值。
代码来自tourist,先码
http://codeforces.com/contest/755/problem/B
#include <bits/stdc++.h>
using namespace std;
const int N = 1234567;
string a[N];
char foo[N];
void get(string &s)
{
scanf("%s", foo);
s = "";
for (int j = 0; foo[j]; j++)
s += foo[j];
}
int main()
{
int n, m;
scanf("%d %d", &n, &m);
for (int i = 0; i < n + m; i++)
get(a[i]);
sort(a, a + n + m);
int common = 0;
for (int i = 0; i < n + m - 1; i++)
{
if (a[i] == a[i + 1])
common++;
}
n -= common;
m -= common;
for (int it = 0; ; it++)
{
if (it % 2 == 0)
{
if (common > 0)
common--;
else if (n > 0)
n--;
else
{
puts("NO");
break;
}
}
else
{
if (common > 0)
common--;
else if (m > 0)
m--;
else
{
puts("YES");
break;
}
}
}
return 0;
}
以上是关于codeforce 755 B的主要内容,如果未能解决你的问题,请参考以下文章
CodeForces - 755B PolandBall and Game(博弈)
[Codeforces Round #522 (Div. 2, based on Technocup 2019 Elimination Round 3)][C. Playing Piano](代码片段
CodeForces755F PolandBall and Gifts